tests: Replace assertRegExp with assertMatchesRegularExpression

The method was renamed in PHPUnit 9.

Done automatically with:
grep -rl assertRegExp tests/ | xargs sed -r -i "s/>assertRegExp\(/>assertMatchesRegularExpression\(/"

Also extend MediaWikiIntegrationTestCase, so that it can use the
forward-compatible assertMatchesRegularExpression method.

Bug: T243600
Change-Id: I6859b48f7a9084101e981fb48449c1c1dc17a80c
This commit is contained in:
Daimona Eaytoy 2022-10-07 14:18:40 +02:00
parent fd686f79d6
commit b156d227aa

View file

@ -3,18 +3,18 @@
/**
* @covers HTMLFancyCaptchaField
*/
class HTMLFancyCaptchaFieldTest extends PHPUnit\Framework\TestCase {
class HTMLFancyCaptchaFieldTest extends MediaWikiIntegrationTestCase {
public function testGetHTML() {
$html = $this->getForm( [ 'imageUrl' => 'https://example.com/' ] )->getHTML( false );
$this->assertRegExp( '/"fancycaptcha-image"/', $html );
$this->assertRegExp( '#src="https://example.com/"#', $html );
$this->assertMatchesRegularExpression( '/"fancycaptcha-image"/', $html );
$this->assertMatchesRegularExpression( '#src="https://example.com/"#', $html );
$this->assertNotRegExp( '/"mw-createacct-captcha-assisted"/', $html );
$html = $this->getForm( [ 'imageUrl' => '', 'showCreateHelp' => true ] )->getHTML( false );
$this->assertRegExp( '/"mw-createacct-captcha-assisted"/', $html );
$this->assertMatchesRegularExpression( '/"mw-createacct-captcha-assisted"/', $html );
$html = $this->getForm( [ 'imageUrl' => '', 'label' => 'FooBarBaz' ] )->getHTML( false );
$this->assertRegExp( '/FooBarBaz/', $html );
$this->assertMatchesRegularExpression( '/FooBarBaz/', $html );
}
public function testValue() {