Changeset 50986 for trunk/tests/phpunit/includes/phpunit7/testcase.php
- Timestamp:
- 05/25/2021 01:07:43 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/phpunit7/testcase.php
r49037 r50986 12 12 * All WordPress unit tests should inherit from this class. 13 13 */ 14 class WP_UnitTestCase extends WP_UnitTestCase_Base { 15 16 /** 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 31 */ 32 public static function assertEqualsWithDelta( $expected, $actual, float $delta, string $message = '' ): void { 33 $constraint = new PHPUnit\Framework\Constraint\IsEqual( 34 $expected, 35 $delta 36 ); 37 38 static::assertThat( $actual, $constraint, $message ); 39 } 40 } 14 class WP_UnitTestCase extends WP_UnitTestCase_Base {}
Note: See TracChangeset
for help on using the changeset viewer.