tests: Make some PHPUnit data providers static
Initally used a new sniff with autofix (T333745), but some provide are defined non-static in TestBase class and need more work to make them static in a compatible way Bug: T332865 Change-Id: I889d33424f0c01fb26f2d86f8d4fc3de3e568843
This commit is contained in:
parent
c4cdffcd49
commit
d36073cdcf
60 changed files with 95 additions and 95 deletions
|
|
@ -345,7 +345,7 @@ class MediaWikiServicesTest extends MediaWikiIntegrationTestCase {
|
|||
$this->assertInstanceOf( $type, $service );
|
||||
}
|
||||
|
||||
public function provideGetService() {
|
||||
public static function provideGetService() {
|
||||
global $IP;
|
||||
$serviceList = require "$IP/includes/ServiceWiring.php";
|
||||
$ret = [];
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ class WikiMapTest extends MediaWikiLangTestCase {
|
|||
);
|
||||
}
|
||||
|
||||
public function provideGetWikiFromUrl() {
|
||||
public static function provideGetWikiFromUrl() {
|
||||
return [
|
||||
[ 'http://this.wiki.org', 'thiswiki' ],
|
||||
[ 'https://this.wiki.org', 'thiswiki' ],
|
||||
|
|
@ -239,7 +239,7 @@ class WikiMapTest extends MediaWikiLangTestCase {
|
|||
$this->assertEquals( $wiki, WikiMap::getWikiFromUrl( $url ) );
|
||||
}
|
||||
|
||||
public function provideGetWikiIdFromDbDomain() {
|
||||
public static function provideGetWikiIdFromDbDomain() {
|
||||
return [
|
||||
[ 'db-prefix_', 'db-prefix_' ],
|
||||
[ WikiMap::getCurrentWikiId(), WikiMap::getCurrentWikiId() ],
|
||||
|
|
@ -281,7 +281,7 @@ class WikiMapTest extends MediaWikiLangTestCase {
|
|||
$this->assertTrue( WikiMap::isCurrentWikiDbDomain( WikiMap::getCurrentWikiDbDomain() ) );
|
||||
}
|
||||
|
||||
public function provideIsCurrentWikiId() {
|
||||
public static function provideIsCurrentWikiId() {
|
||||
return [
|
||||
[ 'db', 'db', null, '' ],
|
||||
[ 'db-schema-','db', 'schema', '' ],
|
||||
|
|
|
|||
|
|
@ -588,7 +588,7 @@ class ApiParseTest extends ApiTestCase {
|
|||
$this->assertParsedToRegexp( $expected, $res );
|
||||
}
|
||||
|
||||
public function providerTestParsoid() {
|
||||
public static function providerTestParsoid() {
|
||||
// Legacy parses, with and without pre-existing content.
|
||||
$expected = '!^<p><a href="[^"]*" title="Foo">Foo</a>\n</p>$!';
|
||||
yield [ false, false, $expected ];
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ class ApiUserrightsTest extends ApiTestCase {
|
|||
$this->doSuccessfulRightsChange( $expectedGroups, $params, $user );
|
||||
}
|
||||
|
||||
public function addAndRemoveGroupsProvider() {
|
||||
public static function addAndRemoveGroupsProvider() {
|
||||
return [
|
||||
'Simple add' => [
|
||||
[ [ 'sysop' ], [] ],
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ class ApiParamValidatorTest extends ApiTestCase {
|
|||
$this->assertEquals( $expect, $validator->checkSettings( $module, $params, $name, [] ) );
|
||||
}
|
||||
|
||||
public function provideCheckSettings() {
|
||||
public static function provideCheckSettings() {
|
||||
$keys = [
|
||||
'Y', ApiBase::PARAM_RANGE_ENFORCE, ApiBase::PARAM_HELP_MSG, ApiBase::PARAM_HELP_MSG_APPEND,
|
||||
ApiBase::PARAM_HELP_MSG_INFO, ApiBase::PARAM_HELP_MSG_PER_VALUE, ApiBase::PARAM_TEMPLATE_VARS,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class ApiQueryPrefixSearchTest extends ApiTestCase {
|
|||
MockCompletionSearchEngine::addMockResults( self::TEST_QUERY, $results );
|
||||
}
|
||||
|
||||
public function offsetContinueProvider() {
|
||||
public static function offsetContinueProvider() {
|
||||
return [
|
||||
'no offset' => [ 2, 2, 0, 2 ],
|
||||
'with offset' => [ 7, 2, 5, 2 ],
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ class ApiQuerySiteinfoTest extends ApiTestCase {
|
|||
$this->assertSame( $expected, $data );
|
||||
}
|
||||
|
||||
public function interwikiMapProvider() {
|
||||
public static function interwikiMapProvider() {
|
||||
return [ [ 'local' ], [ '!local' ], [ null ] ];
|
||||
}
|
||||
|
||||
|
|
@ -283,7 +283,7 @@ class ApiQuerySiteinfoTest extends ApiTestCase {
|
|||
$this->assertSame( $expected, $data );
|
||||
}
|
||||
|
||||
public function dbReplLagProvider() {
|
||||
public static function dbReplLagProvider() {
|
||||
return [
|
||||
'no hostnames, no showalldb' => [ false, false ],
|
||||
'no hostnames, showalldb' => [ false, true ],
|
||||
|
|
@ -407,7 +407,7 @@ class ApiQuerySiteinfoTest extends ApiTestCase {
|
|||
$this->assertSame( $expected, $this->doQuery( 'fileextensions' ) );
|
||||
}
|
||||
|
||||
public function groupsProvider() {
|
||||
public static function groupsProvider() {
|
||||
return [
|
||||
'numingroup' => [ true ],
|
||||
'nonumingroup' => [ false ],
|
||||
|
|
@ -536,7 +536,7 @@ class ApiQuerySiteinfoTest extends ApiTestCase {
|
|||
);
|
||||
}
|
||||
|
||||
public function rightsInfoProvider() {
|
||||
public static function rightsInfoProvider() {
|
||||
$licenseTitle = Title::makeTitle( 0, 'License' );
|
||||
$licenseUrl = 'http://license.example/';
|
||||
|
||||
|
|
@ -594,7 +594,7 @@ class ApiQuerySiteinfoTest extends ApiTestCase {
|
|||
$this->assertSame( $expected, $data );
|
||||
}
|
||||
|
||||
public function languagesProvider() {
|
||||
public static function languagesProvider() {
|
||||
return [ [ null ], [ 'fr' ] ];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ class ApiQueryWatchlistRawIntegrationTest extends ApiTestCase {
|
|||
);
|
||||
}
|
||||
|
||||
public function fromTitleToTitleContinueComboProvider() {
|
||||
public static function fromTitleToTitleContinueComboProvider() {
|
||||
return [
|
||||
[
|
||||
[
|
||||
|
|
@ -428,7 +428,7 @@ class ApiQueryWatchlistRawIntegrationTest extends ApiTestCase {
|
|||
$this->assertEquals( $expectedItems, $this->getItemsFromApiResponse( $result ) );
|
||||
}
|
||||
|
||||
public function fromTitleToTitleContinueSelfContradictoryComboProvider() {
|
||||
public static function fromTitleToTitleContinueSelfContradictoryComboProvider() {
|
||||
return [
|
||||
[
|
||||
[
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class ConfirmLinkAuthenticationRequestTest extends AuthenticationRequestTestCase
|
|||
return $reqs;
|
||||
}
|
||||
|
||||
public function provideLoadFromSubmission() {
|
||||
public static function provideLoadFromSubmission() {
|
||||
$reqs = self::getLinkRequests();
|
||||
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class OldChangesListTest extends MediaWikiLangTestCase {
|
|||
$this->assertMatchesRegularExpression( $expected, $line, $message );
|
||||
}
|
||||
|
||||
public function recentChangesLine_CssForLineNumberProvider() {
|
||||
public static function recentChangesLine_CssForLineNumberProvider() {
|
||||
return [
|
||||
[ '/mw-line-odd/', 1, 'odd line number' ],
|
||||
[ '/mw-line-even/', 2, 'even line number' ]
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ class CollationTest extends MediaWikiLangTestCase {
|
|||
$this->assertEquals( $firstLetter, $col->getFirstLetter( $string ) );
|
||||
}
|
||||
|
||||
public function firstLetterProvider() {
|
||||
public static function firstLetterProvider() {
|
||||
return [
|
||||
[ 'uppercase', 'Abc', 'A' ],
|
||||
[ 'uppercase', 'abc', 'A' ],
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use MediaWiki\Title\Title;
|
|||
|
||||
class ContentTransformerTest extends MediaWikiIntegrationTestCase {
|
||||
|
||||
public function preSaveTransformProvider() {
|
||||
public static function preSaveTransformProvider() {
|
||||
return [
|
||||
[
|
||||
new WikitextContent( 'Test ~~~' ),
|
||||
|
|
@ -31,7 +31,7 @@ class ContentTransformerTest extends MediaWikiIntegrationTestCase {
|
|||
$this->assertSame( $expectedContainText, $newContent->serialize() );
|
||||
}
|
||||
|
||||
public function preloadTransformProvider() {
|
||||
public static function preloadTransformProvider() {
|
||||
return [
|
||||
[
|
||||
new WikitextContent( '{{Foo}}<noinclude> censored</noinclude> information <!-- is very secret -->' ),
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class FileTest extends MediaWikiMediaTestCase {
|
|||
$data['message'] );
|
||||
}
|
||||
|
||||
public function getThumbnailBucketProvider() {
|
||||
public static function getThumbnailBucketProvider() {
|
||||
$defaultBuckets = [ 256, 512, 1024, 2048, 4096 ];
|
||||
|
||||
return [
|
||||
|
|
@ -203,7 +203,7 @@ class FileTest extends MediaWikiMediaTestCase {
|
|||
);
|
||||
}
|
||||
|
||||
public function getThumbnailSourceProvider() {
|
||||
public static function getThumbnailSourceProvider() {
|
||||
return [
|
||||
[ [
|
||||
'supportsBucketing' => true,
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ class LanguageConverterFactoryTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public function booleanProvider() {
|
||||
public static function booleanProvider() {
|
||||
return [
|
||||
[ false, false, false ],
|
||||
[ false, false, true ],
|
||||
|
|
@ -220,7 +220,7 @@ class LanguageConverterFactoryTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public function codeProvider() {
|
||||
public static function codeProvider() {
|
||||
$trivialWithNothingElseCodes = [
|
||||
'aa', 'ab', 'abs', 'ace', 'ady', 'ady-cyrl', 'aeb', 'aeb-arab', 'aeb-latn',
|
||||
'af', 'ak', 'aln', 'als', 'am', 'an', 'ang', 'anp', 'ar', 'arc', 'arn',
|
||||
|
|
|
|||
|
|
@ -1683,7 +1683,7 @@ class LanguageIntegrationTest extends LanguageClassesTestCase {
|
|||
$this->assertEquals( $number, $normalisedNum );
|
||||
}
|
||||
|
||||
public function parseFormattedNumberProvider() {
|
||||
public static function parseFormattedNumberProvider() {
|
||||
return [
|
||||
[ 'de', 377.01 ],
|
||||
[ 'fa', 334 ],
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ class PageDataRequestHandlerTest extends \MediaWikiLangTestCase {
|
|||
return $output;
|
||||
}
|
||||
|
||||
public function handleRequestProvider() {
|
||||
public static function handleRequestProvider() {
|
||||
$cases = [];
|
||||
|
||||
$cases[] = [ '', [], [], 'Invalid title', 400 ];
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class MailAddressTest extends MediaWikiIntegrationTestCase {
|
|||
$this->assertSame( $expected, $first->equals( $second ) );
|
||||
}
|
||||
|
||||
public function provideEquals(): Generator {
|
||||
public static function provideEquals(): Generator {
|
||||
$base = new MailAddress( 'a@b.c', 'name', 'realname' );
|
||||
|
||||
yield 'Different addresses' => [ $base, new MailAddress( 'xxx', 'name', 'realname' ), false ];
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class RangeChronologicalPagerTest extends MediaWikiIntegrationTestCase {
|
|||
/**
|
||||
* Data provider in [ input year, input month, input day, expected timestamp output ] format
|
||||
*/
|
||||
public function getDateCondProvider() {
|
||||
public static function getDateCondProvider() {
|
||||
return [
|
||||
[ 2016, 12, 5, '20161206000000' ],
|
||||
[ 2016, 12, 31, '20170101000000' ],
|
||||
|
|
@ -49,7 +49,7 @@ class RangeChronologicalPagerTest extends MediaWikiIntegrationTestCase {
|
|||
/**
|
||||
* Data provider in [ start, end, [ expected output has start condition, has end cond ] ] format
|
||||
*/
|
||||
public function getDateRangeCondProvider() {
|
||||
public static function getDateRangeCondProvider() {
|
||||
$db = wfGetDB( DB_PRIMARY );
|
||||
|
||||
return [
|
||||
|
|
@ -88,7 +88,7 @@ class RangeChronologicalPagerTest extends MediaWikiIntegrationTestCase {
|
|||
$this->assertNull( $pager->getDateRangeCond( $start, $end ) );
|
||||
}
|
||||
|
||||
public function getDateRangeCondInvalidProvider() {
|
||||
public static function getDateRangeCondInvalidProvider() {
|
||||
return [
|
||||
[ '-2016-12-01', '2017-12-01', ],
|
||||
[ '2016-12-01', '-2017-12-01', ],
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ class MagicVariableTest extends MediaWikiIntegrationTestCase {
|
|||
$this->assertUnPadded( 'revisionmonth1', $month );
|
||||
}
|
||||
|
||||
public function provideCurrentUnitTimestampWords() {
|
||||
public static function provideCurrentUnitTimestampWords() {
|
||||
return [
|
||||
// Afternoon
|
||||
[ 'currentmonth', '20200208153011', '02', 604800 ],
|
||||
|
|
@ -204,7 +204,7 @@ class MagicVariableTest extends MediaWikiIntegrationTestCase {
|
|||
$this->assertSame( $expTTL, $this->testParser->getOutput()->getCacheExpiry() );
|
||||
}
|
||||
|
||||
public function provideLocalUnitTimestampWords() {
|
||||
public static function provideLocalUnitTimestampWords() {
|
||||
// NOTE: Europe/Stockholm DST applies Sun, Mar 26, 2023 2:00 - Sun, Oct 29, 2023 3:00AM
|
||||
return [
|
||||
// Afternoon
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ class SearchEnginePrefixTest extends MediaWikiLangTestCase {
|
|||
);
|
||||
}
|
||||
|
||||
public function paginationProvider() {
|
||||
public static function paginationProvider() {
|
||||
$res = [ 'Example', 'Example Bar', 'Example Foo', 'Example Foo/Bar' ];
|
||||
return [
|
||||
'With less than requested results no pagination' => [
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class SearchHighlighterTest extends \MediaWikiIntegrationTestCase {
|
|||
$this->assertEquals( $expectedOutput, $actual );
|
||||
}
|
||||
|
||||
public function provideHighlightSimple() {
|
||||
public static function provideHighlightSimple() {
|
||||
return [
|
||||
'no match' => [
|
||||
'this is a very simple text.',
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class TitleMatcherTest extends MediaWikiIntegrationTestCase {
|
|||
$this->overrideConfigValue( MainConfigNames::UsePigLatinVariant, false );
|
||||
}
|
||||
|
||||
public function nearMatchProvider() {
|
||||
public static function nearMatchProvider() {
|
||||
return [
|
||||
'empty request returns nothing' => [ null, 'en', '', 'Near Match Test' ],
|
||||
'with a hash returns nothing' => [ null, 'en', '#near match test', 'Near Match Test' ],
|
||||
|
|
@ -114,7 +114,7 @@ class TitleMatcherTest extends MediaWikiIntegrationTestCase {
|
|||
$this->assertEquals( $expected, $title === null ? null : (string)$title );
|
||||
}
|
||||
|
||||
public function hooksProvider() {
|
||||
public static function hooksProvider() {
|
||||
return [
|
||||
'SearchGetNearMatchBefore' => [ 'SearchGetNearMatchBefore' ],
|
||||
'SearchAfterNoDirectMatch' => [ 'SearchAfterNoDirectMatch' ],
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class MediaWikiSiteTest extends SiteTest {
|
|||
$this->assertEquals( 'Foo', $site->normalizePageName( ' foo ' ) );
|
||||
}
|
||||
|
||||
public function fileUrlProvider() {
|
||||
public static function fileUrlProvider() {
|
||||
return [
|
||||
// url, filepath, path arg, expected
|
||||
[ 'https://en.wikipedia.org', '/w/$1', 'api.php', 'https://en.wikipedia.org/w/api.php' ],
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class SkinTemplateTest extends MediaWikiIntegrationTestCase {
|
|||
);
|
||||
}
|
||||
|
||||
public function makeListItemProvider() {
|
||||
public static function makeListItemProvider() {
|
||||
return [
|
||||
[
|
||||
'<li class="class mw-list-item" title="itemtitle"><a href="url" title="title">text</a></li>',
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ JSON;
|
|||
$result = $client->query( "TEST SPARQL 3" );
|
||||
}
|
||||
|
||||
public function optionsProvider() {
|
||||
public static function optionsProvider() {
|
||||
return [
|
||||
'defaults' => [
|
||||
'TEST тест SPARQL 4 ',
|
||||
|
|
|
|||
|
|
@ -956,7 +956,7 @@ class ChangesListSpecialPageTest extends AbstractChangesListSpecialPageTestCase
|
|||
];
|
||||
}
|
||||
|
||||
public function provideGetFilterConflicts() {
|
||||
public static function provideGetFilterConflicts() {
|
||||
return [
|
||||
[
|
||||
"parameters" => [],
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class SpecialPageTest extends MediaWikiIntegrationTestCase {
|
|||
$this->assertEquals( $expected, $title );
|
||||
}
|
||||
|
||||
public function getTitleForProvider() {
|
||||
public static function getTitleForProvider() {
|
||||
return [
|
||||
[ 'UserLogin', 'Userlogin' ]
|
||||
];
|
||||
|
|
@ -52,7 +52,7 @@ class SpecialPageTest extends MediaWikiIntegrationTestCase {
|
|||
$this->assertEquals( $expected, $title );
|
||||
}
|
||||
|
||||
public function getTitleForWithWarningProvider() {
|
||||
public static function getTitleForWithWarningProvider() {
|
||||
return [
|
||||
[ Title::makeTitle( NS_SPECIAL, 'UserLogin' ), 'UserLogin' ]
|
||||
];
|
||||
|
|
@ -76,7 +76,7 @@ class SpecialPageTest extends MediaWikiIntegrationTestCase {
|
|||
$specialPage->requireLogin( ...array_filter( [ $reason, $title ] ) );
|
||||
}
|
||||
|
||||
public function requireLoginAnonProvider() {
|
||||
public static function requireLoginAnonProvider() {
|
||||
$lang = 'en';
|
||||
|
||||
$expected1 = wfMessage( 'exception-nologin-text' )->inLanguage( $lang )->text();
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ class BlockListPagerTest extends MediaWikiIntegrationTestCase {
|
|||
/**
|
||||
* Test empty values.
|
||||
*/
|
||||
public function formatValueEmptyProvider() {
|
||||
public static function formatValueEmptyProvider() {
|
||||
return [
|
||||
[
|
||||
'test',
|
||||
|
|
@ -122,7 +122,7 @@ class BlockListPagerTest extends MediaWikiIntegrationTestCase {
|
|||
/**
|
||||
* Test the default row values.
|
||||
*/
|
||||
public function formatValueDefaultProvider() {
|
||||
public static function formatValueDefaultProvider() {
|
||||
$row = (object)[
|
||||
'ipb_user' => 0,
|
||||
'ipb_address' => '127.0.0.1',
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class NaiveImportTitleFactoryTest extends MediaWikiIntegrationTestCase {
|
|||
] );
|
||||
}
|
||||
|
||||
public function basicProvider() {
|
||||
public static function basicProvider() {
|
||||
return [
|
||||
[
|
||||
new ForeignTitle( 0, '', 'MainNamespaceArticle' ),
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class NamespaceImportTitleFactoryTest extends MediaWikiIntegrationTestCase {
|
|||
$this->setContentLang( 'en' );
|
||||
}
|
||||
|
||||
public function basicProvider() {
|
||||
public static function basicProvider() {
|
||||
return [
|
||||
[
|
||||
new ForeignTitle( 0, '', 'MainNamespaceArticle' ),
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class SubpageImportTitleFactoryTest extends MediaWikiIntegrationTestCase {
|
|||
);
|
||||
}
|
||||
|
||||
public function basicProvider() {
|
||||
public static function basicProvider() {
|
||||
return [
|
||||
[
|
||||
new ForeignTitle( 0, '', 'MainNamespaceArticle' ),
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ class WatchedItemQueryServiceIntegrationTest extends MediaWikiIntegrationTestCas
|
|||
$this->assertCount( $initialCount + 4, $result4 );
|
||||
}
|
||||
|
||||
public function invalidWatchlistTokenProvider() {
|
||||
public static function invalidWatchlistTokenProvider() {
|
||||
return [
|
||||
[ 'wrongToken' ],
|
||||
[ '' ],
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ class PageRedirectHandlerTest extends MediaWikiIntegrationTestCase {
|
|||
$this->assertUrlQueryParameters( $headerLocation, $queryParams );
|
||||
}
|
||||
|
||||
public function permanentRedirectProvider() {
|
||||
public static function permanentRedirectProvider() {
|
||||
yield [ 'source', '/page/{title}', [], [ 'flavor' => 'edit', 'dummy' => 'test' ] ];
|
||||
yield [ 'bare', '/page/{title}/bare' ];
|
||||
yield [ 'html', '/page/{title}/html' ];
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class ParsoidParserTest extends MediaWikiIntegrationTestCase {
|
|||
$this->assertStringContainsString( $expected, $html );
|
||||
}
|
||||
|
||||
public function provideParsoidParserHtml() {
|
||||
public static function provideParsoidParserHtml() {
|
||||
return [
|
||||
[ [ 'Hello, World' ], 'Hello, World' ],
|
||||
[ [ '__NOTOC__' ], '<meta property="mw:PageProp/notoc"' ],
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ class ActorStoreTest extends ActorStoreTestBase {
|
|||
$this->assertSameActors( $expected, $actor, $wikiId );
|
||||
}
|
||||
|
||||
public function provideNewActorFromRowFields_exception() {
|
||||
public static function provideNewActorFromRowFields_exception() {
|
||||
yield 'empty name' => [
|
||||
42, // $actorId
|
||||
'', // $name
|
||||
|
|
|
|||
|
|
@ -503,7 +503,7 @@ class TextPassDumperDatabaselessTest extends MediaWikiLangTestCase {
|
|||
*
|
||||
* @dataProvider bufferSizeProvider
|
||||
*/
|
||||
public function bufferSizeProvider() {
|
||||
public static function bufferSizeProvider() {
|
||||
// expected, bufferSize to initialize with, message
|
||||
return [
|
||||
[ 512 * 1024, 512 * 1024, "Setting 512 KiB is not effective" ],
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ class DeleteAutoPatrolLogsTest extends MaintenanceBaseTestCase {
|
|||
$dbw->insert( 'logging', $logs );
|
||||
}
|
||||
|
||||
public function runProvider() {
|
||||
public static function runProvider() {
|
||||
$allRows = [
|
||||
(object)[
|
||||
'log_type' => 'patrol',
|
||||
|
|
|
|||
|
|
@ -411,7 +411,7 @@ class UserDefTest extends TypeDefTestCase {
|
|||
$this->assertUserIdentity( $res, 0, "Unknown user" );
|
||||
}
|
||||
|
||||
public function provideMissingId() {
|
||||
public static function provideMissingId() {
|
||||
yield "0 no longer matches request ip" => [ 0 ];
|
||||
yield "Id with no user" => [ 6 ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -829,7 +829,7 @@ class RestrictionStoreTest extends MediaWikiUnitTestCase {
|
|||
$this->assertSame( $expected, $obj->listAllRestrictionTypes( ...$args ) );
|
||||
}
|
||||
|
||||
public function provideListAllRestrictionTypes() {
|
||||
public static function provideListAllRestrictionTypes() {
|
||||
$expandedRestrictions = array_merge( self::DEFAULT_RESTRICTION_TYPES, [ 'solidify' ] );
|
||||
return [
|
||||
'Exists' => [ [ 'edit', 'move', 'upload' ], [ true ] ],
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class MutableRevisionSlotsTest extends RevisionSlotsTest {
|
|||
return new MutableRevisionSlots( $slots );
|
||||
}
|
||||
|
||||
public function provideConstructorFailue() {
|
||||
public static function provideConstructorFailue() {
|
||||
yield 'array or the wrong thing' => [
|
||||
[ 1, 2, 3 ]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class RevisionSlotsTest extends MediaWikiUnitTestCase {
|
|||
return new RevisionSlots( $slots );
|
||||
}
|
||||
|
||||
public function provideConstructorFailue() {
|
||||
public static function provideConstructorFailue() {
|
||||
yield 'not an array or callable' => [
|
||||
'foo'
|
||||
];
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class ComposerVersionNormalizerTest extends MediaWikiUnitTestCase {
|
|||
$normalizer->normalizeSuffix( $nonString );
|
||||
}
|
||||
|
||||
public function nonStringProvider() {
|
||||
public static function nonStringProvider() {
|
||||
return [
|
||||
[ null ],
|
||||
[ 42 ],
|
||||
|
|
@ -69,7 +69,7 @@ class ComposerVersionNormalizerTest extends MediaWikiUnitTestCase {
|
|||
);
|
||||
}
|
||||
|
||||
public function complexVersionProvider() {
|
||||
public static function complexVersionProvider() {
|
||||
return [
|
||||
[ '1.22.0alpha', '1.22.0-alpha' ],
|
||||
[ '1.22.0RC', '1.22.0-RC' ],
|
||||
|
|
@ -102,7 +102,7 @@ class ComposerVersionNormalizerTest extends MediaWikiUnitTestCase {
|
|||
);
|
||||
}
|
||||
|
||||
public function fourLevelVersionsProvider() {
|
||||
public static function fourLevelVersionsProvider() {
|
||||
return [
|
||||
[ '1.22.0.0' ],
|
||||
[ '1.19.2.4' ],
|
||||
|
|
@ -128,7 +128,7 @@ class ComposerVersionNormalizerTest extends MediaWikiUnitTestCase {
|
|||
);
|
||||
}
|
||||
|
||||
public function levelNormalizationProvider() {
|
||||
public static function levelNormalizationProvider() {
|
||||
return [
|
||||
[ '1.22.0.0', '1.22' ],
|
||||
[ '1.22.0.0', '1.22.0' ],
|
||||
|
|
@ -146,7 +146,7 @@ class ComposerVersionNormalizerTest extends MediaWikiUnitTestCase {
|
|||
$this->assertRemainsUnchanged( $invalidVersion );
|
||||
}
|
||||
|
||||
public function invalidVersionProvider() {
|
||||
public static function invalidVersionProvider() {
|
||||
return [
|
||||
[ '1.221-a' ],
|
||||
[ '1.221-' ],
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ class WikitextContentHandlerTest extends MediaWikiUnitTestCase {
|
|||
$method->invokeArgs( $handler, [ $content, $cpoParams, &$parserOutput ] );
|
||||
}
|
||||
|
||||
public function provideFillParserOutput() {
|
||||
public static function provideFillParserOutput() {
|
||||
return [ [ false ], [ true ] ];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class MWLBFactoryTest extends MediaWikiUnitTestCase {
|
|||
);
|
||||
}
|
||||
|
||||
public function getLBFactoryClassProvider() {
|
||||
public static function getLBFactoryClassProvider() {
|
||||
yield 'undercore alias default' => [
|
||||
[ 'class' => 'LBFactory_Simple' ],
|
||||
Wikimedia\Rdbms\LBFactorySimple::class,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use Wikimedia\Tests\SerializationTestUtils;
|
|||
*/
|
||||
class GhostFieldAccessTraitTest extends MediaWikiUnitTestCase {
|
||||
|
||||
private function provideUnserializedInstances( string $testCaseName ) {
|
||||
private static function provideUnserializedInstances( string $testCaseName ) {
|
||||
// Not using the trait since we only need deserialization tests.
|
||||
$serializationTestUtils = new SerializationTestUtils(
|
||||
__DIR__ . '/../../../data/GhostFieldAccess',
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class TimestampDefTest extends TypeDefTestCase {
|
|||
$this->getInstance( new SimpleCallbacks( [] ), $options );
|
||||
}
|
||||
|
||||
public function provideConstructorOptions(): array {
|
||||
public static function provideConstructorOptions(): array {
|
||||
return [
|
||||
'Basic test' => [ [], true ],
|
||||
'Default format ConvertibleTimestamp' => [ [ 'defaultFormat' => 'ConvertibleTimestamp' ], true ],
|
||||
|
|
|
|||
|
|
@ -1403,7 +1403,7 @@ class WANObjectCacheTest extends MediaWikiUnitTestCase {
|
|||
$this->assertSame( 3, $calls, 'Callback was not used; used interim' );
|
||||
}
|
||||
|
||||
public function getBusyValues_Provider() {
|
||||
public static function getBusyValues_Provider() {
|
||||
$hash = new HashBagOStuff( [] );
|
||||
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class ChronologyProtectorTest extends PHPUnit\Framework\TestCase {
|
|||
$this->assertEquals( $expectedId, $cp->getClientId() );
|
||||
}
|
||||
|
||||
public function clientIdProvider() {
|
||||
public static function clientIdProvider() {
|
||||
return [
|
||||
[
|
||||
[
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class MemcachedBagOStuffTest extends \MediaWikiUnitTestCase {
|
|||
$this->assertSame( $key, $this->cache->validateKeyEncoding( $key ) );
|
||||
}
|
||||
|
||||
public function validKeyProvider() {
|
||||
public static function validKeyProvider() {
|
||||
return [
|
||||
'empty' => [ '' ],
|
||||
'digits' => [ '09' ],
|
||||
|
|
@ -90,7 +90,7 @@ class MemcachedBagOStuffTest extends \MediaWikiUnitTestCase {
|
|||
$this->cache->validateKeyEncoding( $key );
|
||||
}
|
||||
|
||||
public function invalidKeyProvider() {
|
||||
public static function invalidKeyProvider() {
|
||||
return [
|
||||
[ "\x00" ],
|
||||
[ ' ' ],
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class RedisBagOStuffTest extends MediaWikiUnitTestCase {
|
|||
$this->assertSame( $expected, $actual, $message );
|
||||
}
|
||||
|
||||
public function unserializeProvider() {
|
||||
public static function unserializeProvider() {
|
||||
return [
|
||||
[
|
||||
-1,
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ use Wikimedia\Assert\PreconditionException;
|
|||
*/
|
||||
class PageIdentityValueTest extends MediaWikiUnitTestCase {
|
||||
|
||||
public function goodConstructorProvider() {
|
||||
public static function goodConstructorProvider() {
|
||||
return [
|
||||
[ 0, NS_MAIN, 'Test', false ],
|
||||
[ 7, NS_MAIN, 'Test', false ],
|
||||
|
|
@ -76,7 +76,7 @@ class PageIdentityValueTest extends MediaWikiUnitTestCase {
|
|||
$pageIdentity->getId();
|
||||
}
|
||||
|
||||
public function badConstructorProvider() {
|
||||
public static function badConstructorProvider() {
|
||||
return [
|
||||
[ -1, NS_MAIN, 'Test', false ],
|
||||
[ 0, NS_MAIN, 'Test', 2.3 ],
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ use Wikimedia\Assert\ParameterAssertionException;
|
|||
*/
|
||||
class PageReferenceValueTest extends MediaWikiUnitTestCase {
|
||||
|
||||
public function goodConstructorProvider() {
|
||||
public static function goodConstructorProvider() {
|
||||
return [
|
||||
[ NS_MAIN, 'Test', false ],
|
||||
[ NS_MAIN, 'Test', false ],
|
||||
|
|
@ -51,7 +51,7 @@ class PageReferenceValueTest extends MediaWikiUnitTestCase {
|
|||
$this->assertSame( $dbKey, $pageReference->getDBkey() );
|
||||
}
|
||||
|
||||
public function badConstructorProvider() {
|
||||
public static function badConstructorProvider() {
|
||||
return [
|
||||
[ NS_MAIN, 'Test', 2.3 ],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ use Wikimedia\Assert\ParameterAssertionException;
|
|||
*/
|
||||
class PageStoreRecordTest extends MediaWikiUnitTestCase {
|
||||
|
||||
public function goodConstructorProvider() {
|
||||
public static function goodConstructorProvider() {
|
||||
return [
|
||||
'local' => [
|
||||
(object)[
|
||||
|
|
@ -106,7 +106,7 @@ class PageStoreRecordTest extends MediaWikiUnitTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public function badConstructorProvider() {
|
||||
public static function badConstructorProvider() {
|
||||
$row = [
|
||||
'page_id' => 1,
|
||||
'page_namespace' => NS_MAIN,
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class MediaWikiPageNameNormalizerTest extends MediaWikiUnitTestCase {
|
|||
);
|
||||
}
|
||||
|
||||
public function normalizePageTitleProvider() {
|
||||
public static function normalizePageTitleProvider() {
|
||||
// Response are taken from wikidata and kkwiki using the following API request
|
||||
// api.php?action=query&prop=info&redirects=1&converttitles=1&format=json&titles=…
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ class RemexDriverTest extends MediaWikiUnitTestCase {
|
|||
],
|
||||
];
|
||||
|
||||
public function provider() {
|
||||
public static function provider() {
|
||||
$testMathML = <<<'MathML'
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<mrow>
|
||||
|
|
@ -357,7 +357,7 @@ MathML;
|
|||
$this->assertEquals( $expected, $result, $desc );
|
||||
}
|
||||
|
||||
public function html5libProvider() {
|
||||
public static function html5libProvider() {
|
||||
$files = json_decode( file_get_contents( __DIR__ . '/html5lib-tests.json' ), true );
|
||||
$tests = [];
|
||||
foreach ( $files as $file => $fileTests ) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
*/
|
||||
class ForeignTitleTest extends \MediaWikiUnitTestCase {
|
||||
|
||||
public function basicProvider() {
|
||||
public static function basicProvider() {
|
||||
return [
|
||||
[
|
||||
new ForeignTitle( 20, 'Contributor', 'JohnDoe' ),
|
||||
|
|
@ -73,7 +73,7 @@ class ForeignTitleTest extends \MediaWikiUnitTestCase {
|
|||
$title->getNamespaceId();
|
||||
}
|
||||
|
||||
public function fullTextProvider() {
|
||||
public static function fullTextProvider() {
|
||||
return [
|
||||
[
|
||||
new ForeignTitle( 20, 'Contributor', 'JohnDoe' ),
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
*/
|
||||
class NaiveForeignTitleFactoryTest extends MediaWikiUnitTestCase {
|
||||
|
||||
public function basicProvider() {
|
||||
public static function basicProvider() {
|
||||
return [
|
||||
[
|
||||
'MainNamespaceArticle', 0,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
*/
|
||||
class NamespaceAwareForeignTitleFactoryTest extends \MediaWikiUnitTestCase {
|
||||
|
||||
public function basicProvider() {
|
||||
public static function basicProvider() {
|
||||
return [
|
||||
[
|
||||
'MainNamespaceArticle', 0,
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ use MediaWiki\Title\Title;
|
|||
*/
|
||||
class TitleValueTest extends \MediaWikiUnitTestCase {
|
||||
|
||||
public function goodConstructorProvider() {
|
||||
public static function goodConstructorProvider() {
|
||||
return [
|
||||
[ NS_MAIN, '', 'fragment', '', true, false ],
|
||||
[ NS_MAIN, '', '', 'interwiki', false, true ],
|
||||
|
|
@ -88,7 +88,7 @@ class TitleValueTest extends \MediaWikiUnitTestCase {
|
|||
$this->assertTrue( true ); // we are just checking that no exception is thrown
|
||||
}
|
||||
|
||||
public function badConstructorNamespaceTypeProvider() {
|
||||
public static function badConstructorNamespaceTypeProvider() {
|
||||
return [
|
||||
[ 'foo', 'title', 'fragment', '' ],
|
||||
[ null, 'title', 'fragment', '' ],
|
||||
|
|
@ -96,7 +96,7 @@ class TitleValueTest extends \MediaWikiUnitTestCase {
|
|||
];
|
||||
}
|
||||
|
||||
public function badConstructorProvider() {
|
||||
public static function badConstructorProvider() {
|
||||
return [
|
||||
[ NS_MAIN, 5, 'fragment', '' ],
|
||||
[ NS_MAIN, null, 'fragment', '' ],
|
||||
|
|
@ -148,7 +148,7 @@ class TitleValueTest extends \MediaWikiUnitTestCase {
|
|||
TitleValue::assertValidSpec( $ns, $text, $fragment, $interwiki );
|
||||
}
|
||||
|
||||
public function fragmentTitleProvider() {
|
||||
public static function fragmentTitleProvider() {
|
||||
return [
|
||||
[ new TitleValue( NS_MAIN, 'Test' ), 'foo' ],
|
||||
[ new TitleValue( NS_TALK, 'Test', 'foo' ), '' ],
|
||||
|
|
@ -220,7 +220,7 @@ class TitleValueTest extends \MediaWikiUnitTestCase {
|
|||
$this->assertNull( TitleValue::castPageToLinkTarget( null ) );
|
||||
}
|
||||
|
||||
public function getTextProvider() {
|
||||
public static function getTextProvider() {
|
||||
return [
|
||||
[ 'Foo', 'Foo' ],
|
||||
[ 'Foo_Bar', 'Foo Bar' ],
|
||||
|
|
|
|||
|
|
@ -451,7 +451,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiUnitTestCase {
|
|||
$this->assertEquals( [ '20160203123456', 42 ], $startFrom );
|
||||
}
|
||||
|
||||
public function getWatchedItemsWithRecentChangeInfoOptionsProvider() {
|
||||
public static function getWatchedItemsWithRecentChangeInfoOptionsProvider() {
|
||||
return [
|
||||
[
|
||||
[ 'includeFields' => [ WatchedItemQueryService::INCLUDE_FLAGS ] ],
|
||||
|
|
@ -857,7 +857,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiUnitTestCase {
|
|||
$this->assertNull( $startFrom );
|
||||
}
|
||||
|
||||
public function filterPatrolledOptionProvider() {
|
||||
public static function filterPatrolledOptionProvider() {
|
||||
return [
|
||||
'Patrolled' => [ WatchedItemQueryService::FILTER_PATROLLED ],
|
||||
'Not patrolled' => [ WatchedItemQueryService::FILTER_NOT_PATROLLED ],
|
||||
|
|
@ -894,7 +894,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiUnitTestCase {
|
|||
$this->assertSame( [], $items );
|
||||
}
|
||||
|
||||
public function mysqlIndexOptimizationProvider() {
|
||||
public static function mysqlIndexOptimizationProvider() {
|
||||
return [
|
||||
[
|
||||
'mysql',
|
||||
|
|
@ -953,7 +953,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiUnitTestCase {
|
|||
$this->assertSame( [], $items );
|
||||
}
|
||||
|
||||
public function userPermissionRelatedExtraChecksProvider() {
|
||||
public static function userPermissionRelatedExtraChecksProvider() {
|
||||
return [
|
||||
[
|
||||
[],
|
||||
|
|
@ -1555,7 +1555,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiUnitTestCase {
|
|||
$this->assertSame( [], $items );
|
||||
}
|
||||
|
||||
public function getWatchedItemsForUserInvalidOptionsProvider() {
|
||||
public static function getWatchedItemsForUserInvalidOptionsProvider() {
|
||||
return [
|
||||
[
|
||||
[ 'sort' => 'foo' ],
|
||||
|
|
|
|||
Loading…
Reference in a new issue