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/category/wpDropdownCategories.php

    r51565 r51566  
    228228
    229229        // Test to see if it contains the "required" attribute.
    230         $this->assertNotRegExp( '/<select[^>]+required/', $dropdown_categories );
     230        $this->assertDoesNotMatchRegularExpression( '/<select[^>]+required/', $dropdown_categories );
    231231    }
    232232
     
    252252
    253253        // Test to see if it contains the "required" attribute.
    254         $this->assertNotRegExp( '/<select[^>]+required/', $dropdown_categories );
     254        $this->assertDoesNotMatchRegularExpression( '/<select[^>]+required/', $dropdown_categories );
    255255    }
    256256}
Note: See TracChangeset for help on using the changeset viewer.