Make WordPress Core


Ignore:
Timestamp:
09/07/2020 03:12:17 AM (3 years ago)
Author:
SergeyBiryukov
Message:

Tests: Add a polyfill for assertEqualsWithDelta() to WP_UnitTestCase and use it where appropriate.

assertEqualsWithDelta() was added in PHPUnit 7.5, while WordPress still supports PHPUnit 5.4.x as the minimum version.

See #38266.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/date/query.php

    r48937 r48952  
    525525
    526526        $message = "Expected {$expected}, got {$found}";
    527         $this->assertEquals( strtotime( $expected ), strtotime( $found ), $message, 10 );
     527        $this->assertEqualsWithDelta( strtotime( $expected ), strtotime( $found ), 10, $message );
    528528    }
    529529
     
    560560
    561561        $message = "Expected {$expected}, got {$found}";
    562         $this->assertEquals( strtotime( $expected ), strtotime( $found ), $message, 10 );
     562        $this->assertEqualsWithDelta( strtotime( $expected ), strtotime( $found ), 10, $message );
    563563
    564564    }
     
    584584
    585585        $message = "Expected {$expected}, got {$found}";
    586         $this->assertEquals( strtotime( $expected ), strtotime( $found ), $message, 10 );
     586        $this->assertEqualsWithDelta( strtotime( $expected ), strtotime( $found ), 10, $message );
    587587    }
    588588
Note: See TracChangeset for help on using the changeset viewer.