Tests: Use more complete mock to prevent php8.1 deprecated warnings

Fixes:

1) TextExtracts\Test\ApiQueryExtractsTest::testMemCacheHelpers
strtr(): Passing null to parameter #1 ($string) of type string is deprecated

Change-Id: Id39cb89bb5d49fbea543181da678b191f70311ac
This commit is contained in:
Brian Wolff 2022-10-03 10:38:44 -07:00
parent 1ce6d8861a
commit c77adce065

View file

@ -49,9 +49,12 @@ class ApiQueryExtractsTest extends \MediaWikiIntegrationTestCase {
->method( 'getMain' )
->willReturn( $main );
$langConv = $this->createMock( ILanguageConverter::class );
$langConv->method( 'getPreferredVariant' )
->willReturn( 'en' );
$langConvFactory = $this->createMock( LanguageConverterFactory::class );
$langConvFactory->method( 'getLanguageConverter' )
->willReturn( $this->createMock( ILanguageConverter::class ) );
->willReturn( $langConv );
return new ApiQueryExtracts(
$query,
@ -71,6 +74,10 @@ class ApiQueryExtractsTest extends \MediaWikiIntegrationTestCase {
$page = $this->createMock( \WikiPage::class );
$page->method( 'getTitle' )
->willReturn( $title );
$page->method( 'getId' )
->willReturn( 123 );
$page->method( 'getTouched' )
->willReturn( '20010101000000' );
$text = 'Text to cache';