Make WordPress Core


Ignore:
Timestamp:
09/07/2020 03:12:17 AM (5 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/getFeedBuildDate.php

    r48937 r48952  
    6161        );
    6262
    63         $this->assertEquals(
     63        $this->assertEqualsWithDelta(
    6464            strtotime( $datetime_utc->format( DATE_RFC3339 ) ),
    6565            strtotime( get_feed_build_date( DATE_RFC3339 ) ),
    66             'Fall back to time of last post modified with no posts',
    67             2
     66            2,
     67            'Fall back to time of last post modified with no posts'
    6868        );
    6969
     
    7575        $wp_query->posts = array( $post_broken );
    7676
    77         $this->assertEquals(
     77        $this->assertEqualsWithDelta(
    7878            strtotime( $datetime_utc->format( DATE_RFC3339 ) ),
    7979            strtotime( get_feed_build_date( DATE_RFC3339 ) ),
    80             'Fall back to time of last post modified with broken post object',
    81             2
     80            2,
     81            'Fall back to time of last post modified with broken post object'
    8282        );
    8383    }
Note: See TracChangeset for help on using the changeset viewer.