Make WordPress Core


Ignore:
Timestamp:
08/06/2021 09:55:31 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Tests: Replace assertNotRegExp() with assertDoesNotMatchRegularExpression().

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-51565].

Props jrf.
See #46149.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post/template.php

    r51565 r51566  
    320320        );
    321321
    322         $this->assertNotRegExp( '/<select[^>]+class=\'/', $found );
     322        $this->assertDoesNotMatchRegularExpression( '/<select[^>]+class=\'/', $found );
    323323    }
    324324
     
    427427        // After falling back, the markup should include whitespace around <li>'s.
    428428        $this->assertMatchesRegularExpression( '/\s<li.*>|<\/li>\s/U', $menu );
    429         $this->assertNotRegExp( '/><li.*>|<\/li></U', $menu );
     429        $this->assertDoesNotMatchRegularExpression( '/><li.*>|<\/li></U', $menu );
    430430
    431431        // No menus + wp_nav_menu() falls back to wp_page_menu(), this time without a container.
     
    449449
    450450        // After falling back, the markup should not include whitespace around <li>'s.
    451         $this->assertNotRegExp( '/\s<li.*>|<\/li>\s/U', $menu );
     451        $this->assertDoesNotMatchRegularExpression( '/\s<li.*>|<\/li>\s/U', $menu );
    452452        $this->assertMatchesRegularExpression( '/><li.*>|<\/li></U', $menu );
    453453
Note: See TracChangeset for help on using the changeset viewer.