Make WordPress Core


Ignore:
Timestamp:
08/06/2021 09:52:06 PM (4 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/term/wpGenerateTagCloud.php

    r51462 r51565  
    130130        );
    131131
    132         $this->assertRegExp( "|^<ul class='wp-tag-cloud' role='list'>|", $found );
    133         $this->assertRegExp( "|</ul>\n|", $found );
     132        $this->assertMatchesRegularExpression( "|^<ul class='wp-tag-cloud' role='list'>|", $found );
     133        $this->assertMatchesRegularExpression( "|</ul>\n|", $found );
    134134        $this->assertStringContainsString( '>' . $tags[0]->name . '<', $found );
    135135    }
     
    185185        );
    186186
    187         $this->assertRegExp( "|^<ul class='wp-tag-cloud' role='list'>|", $found );
    188         $this->assertRegExp( "|</ul>\n|", $found );
     187        $this->assertMatchesRegularExpression( "|^<ul class='wp-tag-cloud' role='list'>|", $found );
     188        $this->assertMatchesRegularExpression( "|</ul>\n|", $found );
    189189
    190190        foreach ( $tags as $tag ) {
Note: See TracChangeset for help on using the changeset viewer.