- Timestamp:
- 09/21/2021 07:29:38 PM (3 years ago)
- Location:
- branches/5.6
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.6
- Property svn:mergeinfo changed
/trunk merged: 51559-51560,51810-51813,51828
- Property svn:mergeinfo changed
-
branches/5.6/tests/phpunit/includes/phpunit7/testcase.php
r49037 r51840 1 1 <?php 2 3 use Yoast\PHPUnitPolyfills\Helpers\AssertAttributeHelper; 4 use Yoast\PHPUnitPolyfills\Polyfills\AssertClosedResource; 5 use Yoast\PHPUnitPolyfills\Polyfills\AssertEqualsSpecializations; 6 use Yoast\PHPUnitPolyfills\Polyfills\AssertFileDirectory; 7 use Yoast\PHPUnitPolyfills\Polyfills\AssertFileEqualsSpecializations; 8 use Yoast\PHPUnitPolyfills\Polyfills\AssertionRenames; 9 use Yoast\PHPUnitPolyfills\Polyfills\AssertIsType; 10 use Yoast\PHPUnitPolyfills\Polyfills\AssertNumericType; 11 use Yoast\PHPUnitPolyfills\Polyfills\AssertObjectEquals; 12 use Yoast\PHPUnitPolyfills\Polyfills\AssertStringContains; 13 use Yoast\PHPUnitPolyfills\Polyfills\EqualToSpecializations; 14 use Yoast\PHPUnitPolyfills\Polyfills\ExpectException; 15 use Yoast\PHPUnitPolyfills\Polyfills\ExpectExceptionMessageMatches; 16 use Yoast\PHPUnitPolyfills\Polyfills\ExpectExceptionObject; 17 use Yoast\PHPUnitPolyfills\Polyfills\ExpectPHPException; 2 18 3 19 require_once dirname( __DIR__ ) . '/abstract-testcase.php'; … … 14 30 class WP_UnitTestCase extends WP_UnitTestCase_Base { 15 31 32 use AssertAttributeHelper; 33 use AssertClosedResource; 34 use AssertEqualsSpecializations; 35 use AssertFileDirectory; 36 use AssertFileEqualsSpecializations; 37 use AssertionRenames; 38 use AssertIsType; 39 use AssertNumericType; 40 use AssertObjectEquals; 41 use AssertStringContains; 42 use EqualToSpecializations; 43 use ExpectException; 44 use ExpectExceptionMessageMatches; 45 use ExpectExceptionObject; 46 use ExpectPHPException; 47 16 48 /** 17 * Asserts that two variables are equal (with delta). 18 * 19 * This method has been backported from a more recent PHPUnit version, 20 * as tests running on PHP 5.6 use PHPUnit 5.7.x. 21 * 22 * @since 5.6.0 23 * 24 * @param mixed $expected First value to compare. 25 * @param mixed $actual Second value to compare. 26 * @param float $delta Allowed numerical distance between two values to consider them equal. 27 * @param string $message Optional. Message to display when the assertion fails. 28 * 29 * @throws ExpectationFailedException 30 * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException 49 * Wrapper method for the `setUpBeforeClass()` method for forward-compatibility with WP 5.9. 31 50 */ 32 public static function assertEqualsWithDelta( $expected, $actual, float $delta, string $message = '' ): void { 33 $constraint = new PHPUnit\Framework\Constraint\IsEqual( 34 $expected, 35 $delta 36 ); 51 public static function set_up_before_class() { 52 static::setUpBeforeClass(); 53 } 37 54 38 static::assertThat( $actual, $constraint, $message ); 55 /** 56 * Wrapper method for the `tearDownAfterClass()` method for forward-compatibility with WP 5.9. 57 */ 58 public static function tear_down_after_class() { 59 static::tearDownAfterClass(); 60 } 61 62 /** 63 * Wrapper method for the `setUp()` method for forward-compatibility with WP 5.9. 64 */ 65 public function set_up() { 66 static::setUp(); 67 } 68 69 /** 70 * Wrapper method for the `tearDown()` method for forward-compatibility with WP 5.9. 71 */ 72 public function tear_down() { 73 static::tearDown(); 39 74 } 40 75 }
Note: See TracChangeset
for help on using the changeset viewer.