From 96771e3a655bad2d3a9440fababaf2dcf5a62bc5 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Wed, 17 Sep 2014 18:28:26 -0700 Subject: [PATCH] test: Clean up data providers that should be static Follows-up b36d883. By far most data providers are static (and PHPUnit expects them to be static and calls them that way). Most of these classes already had their data providers static but additional commits sloppily introduced non-static ones. * ResourceLoaderWikiModuleTest, 8968d8787f. * TitleTest, 545f1d3a73. Odd unused method 'dataTestIsValidMoveOperation' was introduced in 550b878e63. * GlobalVarConfigTest, a3e18c3670. Change-Id: I5da99f7cd3da68c550ae507ffe1f725d31e7666f --- tests/phpunit/includes/EditPageTest.php | 2 +- tests/phpunit/includes/MWTimestampTest.php | 2 +- tests/phpunit/includes/MessageTest.php | 4 ++-- tests/phpunit/includes/SampleTest.php | 2 +- .../includes/TitleArrayFromResultTest.php | 2 +- tests/phpunit/includes/TitleTest.php | 24 ++++++------------- .../includes/UserArrayFromResultTest.php | 2 +- tests/phpunit/includes/UserTest.php | 2 +- tests/phpunit/includes/XmlJsTest.php | 2 +- .../includes/config/GlobalVarConfigTest.php | 2 +- .../includes/content/JsonContentTest.php | 7 +++--- .../includes/exception/MWExceptionTest.php | 8 +++---- tests/phpunit/includes/libs/IPSetTest.php | 4 ++-- .../includes/libs/MWMessagePackTest.php | 4 ++-- tests/phpunit/includes/media/GIFTest.php | 2 +- tests/phpunit/includes/media/PNGTest.php | 2 +- tests/phpunit/includes/media/SVGTest.php | 2 +- tests/phpunit/includes/normal/CleanUpTest.php | 2 +- tests/phpunit/includes/parser/TidyTest.php | 2 +- .../includes/password/BcryptPasswordTest.php | 2 +- .../LayeredParameterizedPasswordTest.php | 2 +- .../includes/password/PasswordTestCase.php | 2 +- .../includes/password/Pbkdf2PasswordTest.php | 2 +- .../ResourceLoaderWikiModuleTest.php | 2 +- .../specials/SpecialMyLanguageTest.php | 2 +- .../title/MediaWikiPageLinkRendererTest.php | 6 ++--- .../title/MediaWikiTitleCodecTest.php | 14 +++++------ .../includes/upload/UploadStashTest.php | 4 ++-- 28 files changed, 51 insertions(+), 62 deletions(-) diff --git a/tests/phpunit/includes/EditPageTest.php b/tests/phpunit/includes/EditPageTest.php index 185ffa4db5..702fce4c81 100644 --- a/tests/phpunit/includes/EditPageTest.php +++ b/tests/phpunit/includes/EditPageTest.php @@ -180,7 +180,7 @@ class EditPageTest extends MediaWikiLangTestCase { return $page; } - public function provideCreatePages() { + public static function provideCreatePages() { return array( array( 'expected article being created', 'EditPageTest_testCreatePage', diff --git a/tests/phpunit/includes/MWTimestampTest.php b/tests/phpunit/includes/MWTimestampTest.php index c82dc4275b..dcb985633c 100644 --- a/tests/phpunit/includes/MWTimestampTest.php +++ b/tests/phpunit/includes/MWTimestampTest.php @@ -29,7 +29,7 @@ class MWTimestampTest extends MediaWikiLangTestCase { $this->assertEquals( '1406833268', $timestamp->__toString() ); } - public function provideValidTimestampDifferences() { + public static function provideValidTimestampDifferences() { return array( array( '1406833268', '1406833269', '00 00 00 01' ), array( '1406833268', '1406833329', '00 00 01 01' ), diff --git a/tests/phpunit/includes/MessageTest.php b/tests/phpunit/includes/MessageTest.php index c2acec0396..f3d2a84a01 100644 --- a/tests/phpunit/includes/MessageTest.php +++ b/tests/phpunit/includes/MessageTest.php @@ -34,7 +34,7 @@ class MessageTest extends MediaWikiLangTestCase { $this->assertEquals( $expectedLang, $langProperty->getValue( $message ) ); } - public function provideConstructor() { + public static function provideConstructor() { $langDe = Language::factory( 'de' ); $langEn = Language::factory( 'en' ); @@ -45,7 +45,7 @@ class MessageTest extends MediaWikiLangTestCase { ); } - public function provideTestParams() { + public static function provideTestParams() { return array( array( array() ), array( array( 'foo' ), 'foo' ), diff --git a/tests/phpunit/includes/SampleTest.php b/tests/phpunit/includes/SampleTest.php index 86e8e8b89e..258581102e 100644 --- a/tests/phpunit/includes/SampleTest.php +++ b/tests/phpunit/includes/SampleTest.php @@ -47,7 +47,7 @@ class TestSample extends MediaWikiLangTestCase { * If you want to run a the same test with a variety of data, use a data provider. * see: http://www.phpunit.de/manual/3.4/en/writing-tests-for-phpunit.html */ - public function provideTitles() { + public static function provideTitles() { return array( array( 'Text', NS_MEDIA, 'Media:Text' ), array( 'Text', null, 'Text' ), diff --git a/tests/phpunit/includes/TitleArrayFromResultTest.php b/tests/phpunit/includes/TitleArrayFromResultTest.php index e4c7623c80..0f7069aed0 100644 --- a/tests/phpunit/includes/TitleArrayFromResultTest.php +++ b/tests/phpunit/includes/TitleArrayFromResultTest.php @@ -64,7 +64,7 @@ class TitleArrayFromResultTest extends MediaWikiTestCase { $this->assertEquals( $title, $object->current->mTextform ); } - public function provideNumberOfRows() { + public static function provideNumberOfRows() { return array( array( 0 ), array( 1 ), diff --git a/tests/phpunit/includes/TitleTest.php b/tests/phpunit/includes/TitleTest.php index 97f61466fb..53c22b4cf2 100644 --- a/tests/phpunit/includes/TitleTest.php +++ b/tests/phpunit/includes/TitleTest.php @@ -39,7 +39,7 @@ class TitleTest extends MediaWikiTestCase { } } - public function provideValidSecureAndSplit() { + public static function provideValidSecureAndSplit() { return array( array( 'Sandbox' ), array( 'A "B"' ), @@ -76,7 +76,7 @@ class TitleTest extends MediaWikiTestCase { ); } - public function provideInvalidSecureAndSplit() { + public static function provideInvalidSecureAndSplit() { return array( array( '' ), array( ':' ), @@ -288,10 +288,7 @@ class TitleTest extends MediaWikiTestCase { } } - /** - * Provides test parameter values for testIsValidMoveOperation() - */ - public function dataTestIsValidMoveOperation() { + public static function provideTestIsValidMoveOperation() { return array( array( 'Test', 'Test', 'selfmove' ), array( 'File:Test.jpg', 'Page', 'imagenocrossnamespace' ) @@ -415,13 +412,6 @@ class TitleTest extends MediaWikiTestCase { return $result; } - public static function provideTestIsValidMoveOperation() { - return array( - array( 'Test', 'Test', 'selfmove' ), - array( 'File:Test.jpg', 'Page', 'imagenocrossnamespace' ) - ); - } - /** * @dataProvider provideGetPageViewLanguage * @covers Title::getPageViewLanguage @@ -548,7 +538,7 @@ class TitleTest extends MediaWikiTestCase { ); } - public function provideNewFromTitleValue() { + public static function provideNewFromTitleValue() { return array( array( new TitleValue( NS_MAIN, 'Foo' ) ), array( new TitleValue( NS_MAIN, 'Foo', 'bar' ) ), @@ -568,7 +558,7 @@ class TitleTest extends MediaWikiTestCase { $this->assertEquals( $value->getFragment(), $title->getFragment() ); } - public function provideGetTitleValue() { + public static function provideGetTitleValue() { return array( array( 'Foo' ), array( 'Foo#bar' ), @@ -589,7 +579,7 @@ class TitleTest extends MediaWikiTestCase { $this->assertEquals( $title->getFragment(), $value->getFragment() ); } - public function provideGetFragment() { + public static function provideGetFragment() { return array( array( 'Foo', '' ), array( 'Foo#bar', 'bar' ), @@ -629,7 +619,7 @@ class TitleTest extends MediaWikiTestCase { $this->assertEquals( $isKnown, $title->isAlwaysKnown() ); } - public function provideIsAlwaysKnown() { + public static function provideIsAlwaysKnown() { return array( array( 'Some nonexistent page', false ), array( 'UTPage', false ), diff --git a/tests/phpunit/includes/UserArrayFromResultTest.php b/tests/phpunit/includes/UserArrayFromResultTest.php index ea44f360f5..62989faad0 100644 --- a/tests/phpunit/includes/UserArrayFromResultTest.php +++ b/tests/phpunit/includes/UserArrayFromResultTest.php @@ -61,7 +61,7 @@ class UserArrayFromResultTest extends MediaWikiTestCase { $this->assertEquals( $username, $object->current->mName ); } - public function provideNumberOfRows() { + public static function provideNumberOfRows() { return array( array( 0 ), array( 1 ), diff --git a/tests/phpunit/includes/UserTest.php b/tests/phpunit/includes/UserTest.php index cabbf10fc0..933fed08d0 100644 --- a/tests/phpunit/includes/UserTest.php +++ b/tests/phpunit/includes/UserTest.php @@ -338,7 +338,7 @@ class UserTest extends MediaWikiTestCase { } } - public function provideGetCanonicalName() { + public static function provideGetCanonicalName() { return array( array( ' trailing space ', array( 'creatable' => 'Trailing space' ), 'Trailing spaces' ), // @todo FIXME: Maybe the createable name should be 'Talk:Username' or false to reject? diff --git a/tests/phpunit/includes/XmlJsTest.php b/tests/phpunit/includes/XmlJsTest.php index 907ce79f93..0dbb01090c 100644 --- a/tests/phpunit/includes/XmlJsTest.php +++ b/tests/phpunit/includes/XmlJsTest.php @@ -14,7 +14,7 @@ class XmlJs extends MediaWikiTestCase { $this->assertEquals( $value, $obj->value ); } - public function provideConstruction() { + public static function provideConstruction() { return array( array( null ), array( '' ), diff --git a/tests/phpunit/includes/config/GlobalVarConfigTest.php b/tests/phpunit/includes/config/GlobalVarConfigTest.php index 275019615e..70b9e6845c 100644 --- a/tests/phpunit/includes/config/GlobalVarConfigTest.php +++ b/tests/phpunit/includes/config/GlobalVarConfigTest.php @@ -50,7 +50,7 @@ class GlobalVarConfigTest extends MediaWikiTestCase { $this->assertFalse( $config->has( 'GlobalVarConfigTestNotHas' ) ); } - public function provideGet() { + public static function provideGet() { $set = array( 'wgSomething' => 'default1', 'wgFoo' => 'default2', diff --git a/tests/phpunit/includes/content/JsonContentTest.php b/tests/phpunit/includes/content/JsonContentTest.php index 6c77d1aaf0..77b542f4b3 100644 --- a/tests/phpunit/includes/content/JsonContentTest.php +++ b/tests/phpunit/includes/content/JsonContentTest.php @@ -15,7 +15,7 @@ class JsonContentTest extends MediaWikiLangTestCase { $this->assertEquals( $expected, $obj->getJsonData() ); } - public function provideValidConstruction() { + public static function provideValidConstruction() { return array( array( 'foo', CONTENT_MODEL_JSON, false, null ), array( FormatJson::encode( array() ), CONTENT_MODEL_JSON, true, array() ), @@ -31,7 +31,7 @@ class JsonContentTest extends MediaWikiLangTestCase { $this->assertEquals( FormatJson::encode( $data, true ), $obj->beautifyJSON() ); } - public function provideDataToEncode() { + public static function provideDataToEncode() { return array( array( array() ), array( array( 'foo' ) ), @@ -74,11 +74,10 @@ class JsonContentTest extends MediaWikiLangTestCase { $obj = new JsonContent( FormatJson::encode( $data ) ); $parserOutput = $obj->getParserOutput( $this->getMockTitle(), null, null, true ); $this->assertInstanceOf( 'ParserOutput', $parserOutput ); -// var_dump( $parserOutput->getText(), "\n" ); $this->assertEquals( $expected, $parserOutput->getText() ); } - public function provideDataAndParserText() { + public static function provideDataAndParserText() { return array( array( array(), diff --git a/tests/phpunit/includes/exception/MWExceptionTest.php b/tests/phpunit/includes/exception/MWExceptionTest.php index c45de3667b..ef0f2a9e2c 100644 --- a/tests/phpunit/includes/exception/MWExceptionTest.php +++ b/tests/phpunit/includes/exception/MWExceptionTest.php @@ -87,7 +87,7 @@ class MWExceptionTest extends MediaWikiTestCase { $this->assertEquals( $expectedReturn, $e->runHooks( $name, $args ) ); } - public function provideRunHooks() { + public static function provideRunHooks() { return array( array( null, null, null, null ), array( array(), 'name', array(), null ), @@ -134,7 +134,7 @@ class MWExceptionTest extends MediaWikiTestCase { $this->assertEquals( $expected, $e->isCommandLine() ); } - public function provideIsCommandLine() { + public static function provideIsCommandLine() { return array( array( false, null ), array( true, true ), @@ -155,7 +155,7 @@ class MWExceptionTest extends MediaWikiTestCase { "The $exception_class exception should be JSON serializable, got false." ); } - public function provideExceptionClasses() { + public static function provideExceptionClasses() { return array( array( 'Exception' ), array( 'MWException' ), @@ -192,7 +192,7 @@ class MWExceptionTest extends MediaWikiTestCase { /** * Returns test cases: exception class, key name, gettype() */ - public function provideJsonSerializedKeys() { + public static function provideJsonSerializedKeys() { $testCases = array(); foreach ( array( 'Exception', 'MWException' ) as $exClass ) { $exTests = array( diff --git a/tests/phpunit/includes/libs/IPSetTest.php b/tests/phpunit/includes/libs/IPSetTest.php index aaee51211d..d4e5214a39 100644 --- a/tests/phpunit/includes/libs/IPSetTest.php +++ b/tests/phpunit/includes/libs/IPSetTest.php @@ -12,7 +12,7 @@ class IPSetTest extends MediaWikiTestCase { * config is an array constructor argument for IPSet, and the tests are * an array of IP => expected (boolean) result against the config dataset. */ - public function provider() { + public static function provideIPSets() { return array( array( 'old_list_subset', @@ -240,7 +240,7 @@ class IPSetTest extends MediaWikiTestCase { * Validates IPSet loading and matching code * * @covers IPSet - * @dataProvider provider + * @dataProvider provideIPSets */ public function testIPSet( $desc, array $cfg, array $tests ) { $ipset = new IPSet( $cfg ); diff --git a/tests/phpunit/includes/libs/MWMessagePackTest.php b/tests/phpunit/includes/libs/MWMessagePackTest.php index 334d5b51d0..f80f78df22 100644 --- a/tests/phpunit/includes/libs/MWMessagePackTest.php +++ b/tests/phpunit/includes/libs/MWMessagePackTest.php @@ -13,7 +13,7 @@ class MWMessagePackTest extends MediaWikiTestCase { * using , which includes a * serialization function. */ - public function provider() { + public static function providePacks() { $tests = array( array( 'nil', null, 'c0' ), array( 'bool', true, 'c3' ), @@ -66,7 +66,7 @@ class MWMessagePackTest extends MediaWikiTestCase { /** * Verify that values are serialized correctly. * @covers MWMessagePack::pack - * @dataProvider provider + * @dataProvider providePacks */ public function testPack( $type, $value, $expected ) { $actual = bin2hex( MWMessagePack::pack( $value ) ); diff --git a/tests/phpunit/includes/media/GIFTest.php b/tests/phpunit/includes/media/GIFTest.php index 52a51cc6dc..87ffd995e9 100644 --- a/tests/phpunit/includes/media/GIFTest.php +++ b/tests/phpunit/includes/media/GIFTest.php @@ -116,7 +116,7 @@ class GIFHandlerTest extends MediaWikiMediaTestCase { $this->assertEquals( $expected, $actual ); } - public function provideGetIndependentMetaArray() { + public static function provideGetIndependentMetaArray() { return array( array( 'nonanimated.gif', array( 'GIFFileComment' => array( diff --git a/tests/phpunit/includes/media/PNGTest.php b/tests/phpunit/includes/media/PNGTest.php index 092be89eff..36872a75d2 100644 --- a/tests/phpunit/includes/media/PNGTest.php +++ b/tests/phpunit/includes/media/PNGTest.php @@ -118,7 +118,7 @@ class PNGHandlerTest extends MediaWikiMediaTestCase { $this->assertEquals( $expected, $actual ); } - public function provideGetIndependentMetaArray() { + public static function provideGetIndependentMetaArray() { return array( array( 'rgb-na-png.png', array() ), array( 'xmp.png', diff --git a/tests/phpunit/includes/media/SVGTest.php b/tests/phpunit/includes/media/SVGTest.php index 1361a92f25..8f7a0d695a 100644 --- a/tests/phpunit/includes/media/SVGTest.php +++ b/tests/phpunit/includes/media/SVGTest.php @@ -28,7 +28,7 @@ class SvgTest extends MediaWikiMediaTestCase { $this->assertEquals( $res, $expected ); } - public function providerGetIndependentMetaArray() { + public static function providerGetIndependentMetaArray() { return array( array( 'Tux.svg', array( 'ObjectName' => 'Tux', diff --git a/tests/phpunit/includes/normal/CleanUpTest.php b/tests/phpunit/includes/normal/CleanUpTest.php index 97b76fe992..f4b469b8a5 100644 --- a/tests/phpunit/includes/normal/CleanUpTest.php +++ b/tests/phpunit/includes/normal/CleanUpTest.php @@ -110,7 +110,7 @@ class CleanUpTest extends MediaWikiTestCase { } /** @todo document */ - public function provideAllBytes() { + public static function provideAllBytes() { return array( array( '', '' ), array( 'x', '' ), diff --git a/tests/phpunit/includes/parser/TidyTest.php b/tests/phpunit/includes/parser/TidyTest.php index c869258d0e..f656a74dbf 100644 --- a/tests/phpunit/includes/parser/TidyTest.php +++ b/tests/phpunit/includes/parser/TidyTest.php @@ -25,7 +25,7 @@ class TidyTest extends MediaWikiTestCase { $this->assertEquals( $expected, $text, $msg ); } - public function provideTestWrapping() { + public static function provideTestWrapping() { $testMathML = <<<'MathML' diff --git a/tests/phpunit/includes/password/BcryptPasswordTest.php b/tests/phpunit/includes/password/BcryptPasswordTest.php index 4d5c78ac58..8ac419ffce 100644 --- a/tests/phpunit/includes/password/BcryptPasswordTest.php +++ b/tests/phpunit/includes/password/BcryptPasswordTest.php @@ -11,7 +11,7 @@ class BcryptPasswordTestCase extends PasswordTestCase { ) ); } - public function providePasswordTests() { + public static function providePasswordTests() { /** @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong */ return array( // Tests from glibc bcrypt implementation diff --git a/tests/phpunit/includes/password/LayeredParameterizedPasswordTest.php b/tests/phpunit/includes/password/LayeredParameterizedPasswordTest.php index 03a742bb81..86e8270a32 100644 --- a/tests/phpunit/includes/password/LayeredParameterizedPasswordTest.php +++ b/tests/phpunit/includes/password/LayeredParameterizedPasswordTest.php @@ -26,7 +26,7 @@ class LayeredParameterizedPasswordTest extends PasswordTestCase { ); } - public function providePasswordTests() { + public static function providePasswordTests() { /** @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong */ return array( array( true, ':testLargeLayeredTop:sha512:1024:512!sha512:1024:512!sha512:1024:512!sha512:1024:512!5!vnRy+2SrSA0fHt3dwhTP5g==!AVnwfZsAQjn+gULv7FSGjA==!xvHUX3WcpkeSn1lvjWcvBg==!It+OC/N9tu+d3ByHhuB0BQ==!Tb.gqUOiD.aWktVwHM.Q/O!7CcyMfXUPky5ptyATJsR2nq3vUqtnBC', 'testPassword123' ), diff --git a/tests/phpunit/includes/password/PasswordTestCase.php b/tests/phpunit/includes/password/PasswordTestCase.php index 7820d535ff..ef16f1c48d 100644 --- a/tests/phpunit/includes/password/PasswordTestCase.php +++ b/tests/phpunit/includes/password/PasswordTestCase.php @@ -52,7 +52,7 @@ abstract class PasswordTestCase extends MediaWikiTestCase { * * @return array */ - abstract public function providePasswordTests(); + abstract public static function providePasswordTests(); /** * @dataProvider providePasswordTests diff --git a/tests/phpunit/includes/password/Pbkdf2PasswordTest.php b/tests/phpunit/includes/password/Pbkdf2PasswordTest.php index ae471207a5..091853e18a 100644 --- a/tests/phpunit/includes/password/Pbkdf2PasswordTest.php +++ b/tests/phpunit/includes/password/Pbkdf2PasswordTest.php @@ -13,7 +13,7 @@ class Pbkdf2PasswordTest extends PasswordTestCase { ) ); } - public function providePasswordTests() { + public static function providePasswordTests() { return array( array( true, ":pbkdf2:sha1:1:20:c2FsdA==:DGDID5YfDnHzqbUkr2ASBi/gN6Y=", 'password' ), array( true, ":pbkdf2:sha1:2:20:c2FsdA==:6mwBTcctb4zNHtkqzh1B8NjeiVc=", 'password' ), diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php index 50f88c825f..9dc180506f 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php @@ -22,7 +22,7 @@ class ResourceLoaderWikiModuleTest extends ResourceLoaderTestCase { $this->assertEquals( $expected, $module->isKnownEmpty( $context ) ); } - public function provideIsKnownEmpty() { + public static function provideIsKnownEmpty() { return array( // No valid pages array( array(), 'test1', true ), diff --git a/tests/phpunit/includes/specials/SpecialMyLanguageTest.php b/tests/phpunit/includes/specials/SpecialMyLanguageTest.php index fd090431d5..4dbfc412c9 100644 --- a/tests/phpunit/includes/specials/SpecialMyLanguageTest.php +++ b/tests/phpunit/includes/specials/SpecialMyLanguageTest.php @@ -53,7 +53,7 @@ class SpecialMyLanguageTest extends MediaWikiTestCase { $this->assertEquals( $expected, $title ); } - public function provideFindTitle() { + public static function provideFindTitle() { return array( array( null, '::Fail', 'en', 'en' ), array( 'Page/Another', 'Page/Another/en', 'en', 'en' ), diff --git a/tests/phpunit/includes/title/MediaWikiPageLinkRendererTest.php b/tests/phpunit/includes/title/MediaWikiPageLinkRendererTest.php index 38395c17a9..4171c10ee8 100644 --- a/tests/phpunit/includes/title/MediaWikiPageLinkRendererTest.php +++ b/tests/phpunit/includes/title/MediaWikiPageLinkRendererTest.php @@ -53,7 +53,7 @@ class MediaWikiPageLinkRendererTest extends MediaWikiTestCase { return $genderCache; } - public function provideGetPageUrl() { + public static function provideGetPageUrl() { return array( array( new TitleValue( NS_MAIN, 'Foo_Bar' ), @@ -86,7 +86,7 @@ class MediaWikiPageLinkRendererTest extends MediaWikiTestCase { $this->assertEquals( $url, $actual ); } - public function provideRenderHtmlLink() { + public static function provideRenderHtmlLink() { return array( array( new TitleValue( NS_MAIN, 'Foo_Bar' ), @@ -128,7 +128,7 @@ class MediaWikiPageLinkRendererTest extends MediaWikiTestCase { $this->assertRegExp( $pattern, $actual ); } - public function provideRenderWikitextLink() { + public static function provideRenderWikitextLink() { return array( array( new TitleValue( NS_MAIN, 'Foo_Bar' ), diff --git a/tests/phpunit/includes/title/MediaWikiTitleCodecTest.php b/tests/phpunit/includes/title/MediaWikiTitleCodecTest.php index bf06e3b4e1..f95b305000 100644 --- a/tests/phpunit/includes/title/MediaWikiTitleCodecTest.php +++ b/tests/phpunit/includes/title/MediaWikiTitleCodecTest.php @@ -85,7 +85,7 @@ class MediaWikiTitleCodecTest extends MediaWikiTestCase { return new MediaWikiTitleCodec( $lang, $gender ); } - public function provideFormat() { + public static function provideFormat() { return array( array( NS_MAIN, 'Foo_Bar', '', 'en', 'Foo Bar' ), array( NS_USER, 'Hansi_Maier', 'stuff_and_so_on', 'en', 'User:Hansi Maier#stuff and so on' ), @@ -129,7 +129,7 @@ class MediaWikiTitleCodecTest extends MediaWikiTestCase { $this->assertEquals( $normalized, $actual2, 'normalized after round trip' ); } - public function provideGetText() { + public static function provideGetText() { return array( array( NS_MAIN, 'Foo_Bar', '', 'en', 'Foo Bar' ), array( NS_USER, 'Hansi_Maier', 'stuff_and_so_on', 'en', 'Hansi Maier' ), @@ -148,7 +148,7 @@ class MediaWikiTitleCodecTest extends MediaWikiTestCase { $this->assertEquals( $expected, $actual ); } - public function provideGetPrefixedText() { + public static function provideGetPrefixedText() { return array( array( NS_MAIN, 'Foo_Bar', '', 'en', 'Foo Bar' ), array( NS_USER, 'Hansi_Maier', 'stuff_and_so_on', 'en', 'User:Hansi Maier' ), @@ -174,7 +174,7 @@ class MediaWikiTitleCodecTest extends MediaWikiTestCase { $this->assertEquals( $expected, $actual ); } - public function provideGetFullText() { + public static function provideGetFullText() { return array( array( NS_MAIN, 'Foo_Bar', '', 'en', 'Foo Bar' ), array( NS_USER, 'Hansi_Maier', 'stuff_and_so_on', 'en', 'User:Hansi Maier#stuff and so on' ), @@ -196,7 +196,7 @@ class MediaWikiTitleCodecTest extends MediaWikiTestCase { $this->assertEquals( $expected, $actual ); } - public function provideParseTitle() { + public static function provideParseTitle() { //TODO: test capitalization and trimming //TODO: test unicode normalization @@ -281,7 +281,7 @@ class MediaWikiTitleCodecTest extends MediaWikiTestCase { $this->assertEquals( $title, $actual ); } - public function provideParseTitle_invalid() { + public static function provideParseTitle_invalid() { //TODO: test unicode errors return array( @@ -353,7 +353,7 @@ class MediaWikiTitleCodecTest extends MediaWikiTestCase { $codec->parseTitle( $text, NS_MAIN ); } - public function provideGetNamespaceName() { + public static function provideGetNamespaceName() { return array( array( NS_MAIN, 'Foo', 'en', '' ), array( NS_USER, 'Foo', 'en', 'User' ), diff --git a/tests/phpunit/includes/upload/UploadStashTest.php b/tests/phpunit/includes/upload/UploadStashTest.php index fdd40b2a84..d5d1188e7d 100644 --- a/tests/phpunit/includes/upload/UploadStashTest.php +++ b/tests/phpunit/includes/upload/UploadStashTest.php @@ -68,7 +68,7 @@ class UploadStashTest extends MediaWikiTestCase { $stash->removeFile( $file->getFileKey() ); } - public function provideInvalidRequests() { + public static function provideInvalidRequests() { return array( 'Check failure on bad wpFileKey' => array( new FauxRequest( array( 'wpFileKey' => 'foo' ) ) ), @@ -84,7 +84,7 @@ class UploadStashTest extends MediaWikiTestCase { $this->assertFalse( UploadFromStash::isValidRequest( $request ) ); } - public function provideValidRequests() { + public static function provideValidRequests() { return array( 'Check good wpFileKey' => array( new FauxRequest( array( 'wpFileKey' => 'testkey-test.test' ) ) ), -- 2.20.1