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/post/nav-menu.php

    r51449 r51565  
    461461
    462462        // The markup should include whitespace between <li>'s.
    463         $this->assertRegExp( '/\s<li.*>|<\/li>\s/U', $menu );
     463        $this->assertMatchesRegularExpression( '/\s<li.*>|<\/li>\s/U', $menu );
    464464        $this->assertNotRegExp( '/<\/li><li.*>/U', $menu );
    465465
     
    475475        // The markup should not include whitespace around <li>'s.
    476476        $this->assertNotRegExp( '/\s<li.*>|<\/li>\s/U', $menu );
    477         $this->assertRegExp( '/><li.*>|<\/li></U', $menu );
     477        $this->assertMatchesRegularExpression( '/><li.*>|<\/li></U', $menu );
    478478    }
    479479
Note: See TracChangeset for help on using the changeset viewer.