Make WordPress Core


Ignore:
Timestamp:
08/06/2021 09:52:06 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Tests: Replace assertRegExp() with assertMatchesRegularExpression().

The assertRegExp() and assertNotRegExp() methods were hard deprecated in PHPUnit 9.1 and the functionality will be removed in PHPUnit 10.0.

The assertMatchesRegularExpression() and assertDoesNotMatchRegularExpression() methods were introduced as a replacement in PHPUnit 9.1.

These new PHPUnit methods are polyfilled by the PHPUnit Polyfills and switching to them will future-proof the tests some more.

References:

Follow-up to [51559-51564].

Props jrf.
See #46149.

File:
1 edited

Legend:

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

    r51462 r51565  
    714714        // $compare value is floating point - use regex to account for
    715715        // varying precision on different PHP installations.
    716         $this->assertRegExp( "/DATE_FORMAT\( post_date, '%H\.%i' \) = 5\.150*/", $wpdb->remove_placeholder_escape( $found ) );
     716        $this->assertMatchesRegularExpression( "/DATE_FORMAT\( post_date, '%H\.%i' \) = 5\.150*/", $wpdb->remove_placeholder_escape( $found ) );
    717717    }
    718718
     
    725725        // $compare value is floating point - use regex to account for
    726726        // varying precision on different PHP installations.
    727         $this->assertRegExp( "/DATE_FORMAT\( post_date, '%H\.%i%s' \) = 5\.15350*/", $wpdb->remove_placeholder_escape( $found ) );
     727        $this->assertMatchesRegularExpression( "/DATE_FORMAT\( post_date, '%H\.%i%s' \) = 5\.15350*/", $wpdb->remove_placeholder_escape( $found ) );
    728728    }
    729729
     
    736736        // $compare value is floating point - use regex to account for
    737737        // varying precision on different PHP installations.
    738         $this->assertRegExp( "/DATE_FORMAT\( post_date, '0\.%i%s' \) = 0\.15350*/", $wpdb->remove_placeholder_escape( $found ) );
     738        $this->assertMatchesRegularExpression( "/DATE_FORMAT\( post_date, '0\.%i%s' \) = 0\.15350*/", $wpdb->remove_placeholder_escape( $found ) );
    739739    }
    740740
Note: See TracChangeset for help on using the changeset viewer.