return $page;
}
- public function provideCreatePages() {
+ public static function provideCreatePages() {
return array(
array( 'expected article being created',
'EditPageTest_testCreatePage',
$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' ),
$this->assertEquals( $expectedLang, $langProperty->getValue( $message ) );
}
- public function provideConstructor() {
+ public static function provideConstructor() {
$langDe = Language::factory( 'de' );
$langEn = Language::factory( 'en' );
);
}
- public function provideTestParams() {
+ public static function provideTestParams() {
return array(
array( array() ),
array( array( 'foo' ), 'foo' ),
* 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' ),
$this->assertEquals( $title, $object->current->mTextform );
}
- public function provideNumberOfRows() {
+ public static function provideNumberOfRows() {
return array(
array( 0 ),
array( 1 ),
}
}
- public function provideValidSecureAndSplit() {
+ public static function provideValidSecureAndSplit() {
return array(
array( 'Sandbox' ),
array( 'A "B"' ),
);
}
- public function provideInvalidSecureAndSplit() {
+ public static function provideInvalidSecureAndSplit() {
return array(
array( '' ),
array( ':' ),
}
}
- /**
- * 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' )
return $result;
}
- public static function provideTestIsValidMoveOperation() {
- return array(
- array( 'Test', 'Test', 'selfmove' ),
- array( 'File:Test.jpg', 'Page', 'imagenocrossnamespace' )
- );
- }
-
/**
* @dataProvider provideGetPageViewLanguage
* @covers Title::getPageViewLanguage
);
}
- public function provideNewFromTitleValue() {
+ public static function provideNewFromTitleValue() {
return array(
array( new TitleValue( NS_MAIN, 'Foo' ) ),
array( new TitleValue( NS_MAIN, 'Foo', 'bar' ) ),
$this->assertEquals( $value->getFragment(), $title->getFragment() );
}
- public function provideGetTitleValue() {
+ public static function provideGetTitleValue() {
return array(
array( 'Foo' ),
array( 'Foo#bar' ),
$this->assertEquals( $title->getFragment(), $value->getFragment() );
}
- public function provideGetFragment() {
+ public static function provideGetFragment() {
return array(
array( 'Foo', '' ),
array( 'Foo#bar', 'bar' ),
$this->assertEquals( $isKnown, $title->isAlwaysKnown() );
}
- public function provideIsAlwaysKnown() {
+ public static function provideIsAlwaysKnown() {
return array(
array( 'Some nonexistent page', false ),
array( 'UTPage', false ),
$this->assertEquals( $username, $object->current->mName );
}
- public function provideNumberOfRows() {
+ public static function provideNumberOfRows() {
return array(
array( 0 ),
array( 1 ),
}
}
- 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?
$this->assertEquals( $value, $obj->value );
}
- public function provideConstruction() {
+ public static function provideConstruction() {
return array(
array( null ),
array( '' ),
$this->assertFalse( $config->has( 'GlobalVarConfigTestNotHas' ) );
}
- public function provideGet() {
+ public static function provideGet() {
$set = array(
'wgSomething' => 'default1',
'wgFoo' => 'default2',
$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() ),
$this->assertEquals( FormatJson::encode( $data, true ), $obj->beautifyJSON() );
}
- public function provideDataToEncode() {
+ public static function provideDataToEncode() {
return array(
array( array() ),
array( array( 'foo' ) ),
$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(),
$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 ),
$this->assertEquals( $expected, $e->isCommandLine() );
}
- public function provideIsCommandLine() {
+ public static function provideIsCommandLine() {
return array(
array( false, null ),
array( true, true ),
"The $exception_class exception should be JSON serializable, got false." );
}
- public function provideExceptionClasses() {
+ public static function provideExceptionClasses() {
return array(
array( 'Exception' ),
array( 'MWException' ),
/**
* 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(
* 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',
* Validates IPSet loading and matching code
*
* @covers IPSet
- * @dataProvider provider
+ * @dataProvider provideIPSets
*/
public function testIPSet( $desc, array $cfg, array $tests ) {
$ipset = new IPSet( $cfg );
* using <https://github.com/msgpack/msgpack-php>, which includes a
* serialization function.
*/
- public function provider() {
+ public static function providePacks() {
$tests = array(
array( 'nil', null, 'c0' ),
array( 'bool', true, 'c3' ),
/**
* Verify that values are serialized correctly.
* @covers MWMessagePack::pack
- * @dataProvider provider
+ * @dataProvider providePacks
*/
public function testPack( $type, $value, $expected ) {
$actual = bin2hex( MWMessagePack::pack( $value ) );
$this->assertEquals( $expected, $actual );
}
- public function provideGetIndependentMetaArray() {
+ public static function provideGetIndependentMetaArray() {
return array(
array( 'nonanimated.gif', array(
'GIFFileComment' => array(
$this->assertEquals( $expected, $actual );
}
- public function provideGetIndependentMetaArray() {
+ public static function provideGetIndependentMetaArray() {
return array(
array( 'rgb-na-png.png', array() ),
array( 'xmp.png',
$this->assertEquals( $res, $expected );
}
- public function providerGetIndependentMetaArray() {
+ public static function providerGetIndependentMetaArray() {
return array(
array( 'Tux.svg', array(
'ObjectName' => 'Tux',
}
/** @todo document */
- public function provideAllBytes() {
+ public static function provideAllBytes() {
return array(
array( '', '' ),
array( 'x', '' ),
$this->assertEquals( $expected, $text, $msg );
}
- public function provideTestWrapping() {
+ public static function provideTestWrapping() {
$testMathML = <<<'MathML'
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>
) );
}
- public function providePasswordTests() {
+ public static function providePasswordTests() {
/** @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong */
return array(
// Tests from glibc bcrypt implementation
);
}
- 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' ),
*
* @return array
*/
- abstract public function providePasswordTests();
+ abstract public static function providePasswordTests();
/**
* @dataProvider providePasswordTests
) );
}
- 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' ),
$this->assertEquals( $expected, $module->isKnownEmpty( $context ) );
}
- public function provideIsKnownEmpty() {
+ public static function provideIsKnownEmpty() {
return array(
// No valid pages
array( array(), 'test1', true ),
$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' ),
return $genderCache;
}
- public function provideGetPageUrl() {
+ public static function provideGetPageUrl() {
return array(
array(
new TitleValue( NS_MAIN, 'Foo_Bar' ),
$this->assertEquals( $url, $actual );
}
- public function provideRenderHtmlLink() {
+ public static function provideRenderHtmlLink() {
return array(
array(
new TitleValue( NS_MAIN, 'Foo_Bar' ),
$this->assertRegExp( $pattern, $actual );
}
- public function provideRenderWikitextLink() {
+ public static function provideRenderWikitextLink() {
return array(
array(
new TitleValue( NS_MAIN, 'Foo_Bar' ),
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' ),
$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' ),
$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' ),
$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' ),
$this->assertEquals( $expected, $actual );
}
- public function provideParseTitle() {
+ public static function provideParseTitle() {
//TODO: test capitalization and trimming
//TODO: test unicode normalization
$this->assertEquals( $title, $actual );
}
- public function provideParseTitle_invalid() {
+ public static function provideParseTitle_invalid() {
//TODO: test unicode errors
return array(
$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' ),
$stash->removeFile( $file->getFileKey() );
}
- public function provideInvalidRequests() {
+ public static function provideInvalidRequests() {
return array(
'Check failure on bad wpFileKey' =>
array( new FauxRequest( array( 'wpFileKey' => 'foo' ) ) ),
$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' ) ) ),