* ^--- needed for language cache stuff
*/
class TitleTest extends MediaWikiTestCase {
-
protected function setUp() {
parent::setUp();
array( 'Special:Version/param', 'param' ),
);
}
-
+
/**
* Auth-less test of Title::isValidMoveOperation
- *
+ *
* @group Database
* @param string $source
* @param string $target
}
}
}
-
+
/**
* Provides test parameter values for testIsValidMoveOperation()
*/
* @covers Title::checkReadPermission
* @dataProvider dataWgWhitelistReadRegexp
*/
- function testWgWhitelistReadRegexp($whitelistRegexp, $source, $action, $expected) {
-
+ function testWgWhitelistReadRegexp( $whitelistRegexp, $source, $action, $expected ) {
// $wgWhitelistReadRegexp must be an array. Since the provided test cases
// usually have only one regex, it is more concise to write the lonely regex
// as a string. Thus we cast to an array() to honor $wgWhitelistReadRegexp
// type requisite.
- if( is_string( $whitelistRegexp ) ) {
+ if ( is_string( $whitelistRegexp ) ) {
$whitelistRegexp = array( $whitelistRegexp );
}
$wgWhitelistRead = array( 'some random non sense title' );
global $wgWhitelistReadRegexp;
- $oldWhitelistRegexp = $wgWhitelistReadRegexp;
- $wgWhitelistReadRegexp = $whitelistRegexp ;
+ $oldWhitelistRegexp = $wgWhitelistReadRegexp;
+ $wgWhitelistReadRegexp = $whitelistRegexp;
// Just use $wgUser which in test is a user object for '127.0.0.1'
global $wgUser;
$wgWhitelistRead = $oldWhitelist;
$wgWhitelistReadRegexp = $oldWhitelistRegexp;
- if( is_bool( $expected ) ) {
+ if ( is_bool( $expected ) ) {
# Forge the assertion message depending on the assertion expectation
$allowableness = $expected
? " should be allowed"
- : " should NOT be allowed"
- ;
+ : " should NOT be allowed";
$this->assertEquals( $expected, $errors, "User action '$action' on [[$source]] $allowableness." );
} else {
$errors = $this->flattenErrorsArray( $errors );
* Provides test parameter values for testWgWhitelistReadRegexp()
*/
function dataWgWhitelistReadRegexp() {
- $ALLOWED = true;
+ $ALLOWED = true;
$DISALLOWED = false;
return array(
}
return $result;
}
-
+
public static function provideTestIsValidMoveOperation() {
- return array(
+ return array(
array( 'Test', 'Test', 'selfmove' ),
array( 'File:Test.jpg', 'Page', 'imagenocrossnamespace' )
);
array( 'es', 'Help:I_need_somebody', 'es', 'zh-tw', false ),
array( 'zh', 'Help:I_need_somebody', 'zh', 'zh-tw', false ),
- array( 'es', 'Help:I_need_somebody', 'es', 'zh-tw', 'zh-cn' ),
- array( 'es', 'MediaWiki:About', 'es', 'zh-tw', 'zh-cn' ),
- array( 'es', 'MediaWiki:About/', 'es', 'zh-tw', 'zh-cn' ),
- array( 'de', 'MediaWiki:About/de', 'es', 'zh-tw', 'zh-cn' ),
- array( 'en', 'MediaWiki:Common.js', 'es', 'zh-tw', 'zh-cn' ),
- array( 'en', 'MediaWiki:Common.css', 'es', 'zh-tw', 'zh-cn' ),
- array( 'en', 'User:JohnDoe/Common.js', 'es', 'zh-tw', 'zh-cn' ),
- array( 'en', 'User:JohnDoe/Monobook.css', 'es', 'zh-tw', 'zh-cn' ),
-
- array( 'zh-cn', 'Help:I_need_somebody', 'zh', 'zh-tw', 'zh-cn' ),
- array( 'zh', 'MediaWiki:About', 'zh', 'zh-tw', 'zh-cn' ),
- array( 'zh', 'MediaWiki:About/', 'zh', 'zh-tw', 'zh-cn' ),
- array( 'de', 'MediaWiki:About/de', 'zh', 'zh-tw', 'zh-cn' ),
- array( 'zh-cn', 'MediaWiki:About/zh-cn', 'zh', 'zh-tw', 'zh-cn' ),
- array( 'zh-tw', 'MediaWiki:About/zh-tw', 'zh', 'zh-tw', 'zh-cn' ),
- array( 'en', 'MediaWiki:Common.js', 'zh', 'zh-tw', 'zh-cn' ),
- array( 'en', 'MediaWiki:Common.css', 'zh', 'zh-tw', 'zh-cn' ),
- array( 'en', 'User:JohnDoe/Common.js', 'zh', 'zh-tw', 'zh-cn' ),
- array( 'en', 'User:JohnDoe/Monobook.css', 'zh', 'zh-tw', 'zh-cn' ),
-
- array( 'zh-tw', 'Special:NewPages', 'es', 'zh-tw', 'zh-cn' ),
- array( 'zh-tw', 'Special:NewPages', 'zh', 'zh-tw', 'zh-cn' ),
+ array( 'es', 'Help:I_need_somebody', 'es', 'zh-tw', 'zh-cn' ),
+ array( 'es', 'MediaWiki:About', 'es', 'zh-tw', 'zh-cn' ),
+ array( 'es', 'MediaWiki:About/', 'es', 'zh-tw', 'zh-cn' ),
+ array( 'de', 'MediaWiki:About/de', 'es', 'zh-tw', 'zh-cn' ),
+ array( 'en', 'MediaWiki:Common.js', 'es', 'zh-tw', 'zh-cn' ),
+ array( 'en', 'MediaWiki:Common.css', 'es', 'zh-tw', 'zh-cn' ),
+ array( 'en', 'User:JohnDoe/Common.js', 'es', 'zh-tw', 'zh-cn' ),
+ array( 'en', 'User:JohnDoe/Monobook.css', 'es', 'zh-tw', 'zh-cn' ),
+
+ array( 'zh-cn', 'Help:I_need_somebody', 'zh', 'zh-tw', 'zh-cn' ),
+ array( 'zh', 'MediaWiki:About', 'zh', 'zh-tw', 'zh-cn' ),
+ array( 'zh', 'MediaWiki:About/', 'zh', 'zh-tw', 'zh-cn' ),
+ array( 'de', 'MediaWiki:About/de', 'zh', 'zh-tw', 'zh-cn' ),
+ array( 'zh-cn', 'MediaWiki:About/zh-cn', 'zh', 'zh-tw', 'zh-cn' ),
+ array( 'zh-tw', 'MediaWiki:About/zh-tw', 'zh', 'zh-tw', 'zh-cn' ),
+ array( 'en', 'MediaWiki:Common.js', 'zh', 'zh-tw', 'zh-cn' ),
+ array( 'en', 'MediaWiki:Common.css', 'zh', 'zh-tw', 'zh-cn' ),
+ array( 'en', 'User:JohnDoe/Common.js', 'zh', 'zh-tw', 'zh-cn' ),
+ array( 'en', 'User:JohnDoe/Monobook.css', 'zh', 'zh-tw', 'zh-cn' ),
+
+ array( 'zh-tw', 'Special:NewPages', 'es', 'zh-tw', 'zh-cn' ),
+ array( 'zh-tw', 'Special:NewPages', 'zh', 'zh-tw', 'zh-cn' ),
);
}
/**
* @dataProvider provideBaseTitleCases
*/
- function testExtractingBaseTextFromTitle( $title, $expected, $msg='' ) {
+ function testExtractingBaseTextFromTitle( $title, $expected, $msg = '' ) {
$title = Title::newFromText( $title );
$this->assertEquals( $expected,
$title->getBaseText(),
function provideBaseTitleCases() {
return array(
# Title, expected base, optional message
- array('User:John_Doe/subOne/subTwo', 'John Doe/subOne' ),
- array('User:Foo/Bar/Baz', 'Foo/Bar' ),
+ array( 'User:John_Doe/subOne/subTwo', 'John Doe/subOne' ),
+ array( 'User:Foo/Bar/Baz', 'Foo/Bar' ),
);
}
/**
* @dataProvider provideRootTitleCases
*/
- function testExtractingRootTextFromTitle( $title, $expected, $msg='' ) {
+ function testExtractingRootTextFromTitle( $title, $expected, $msg = '' ) {
$title = Title::newFromText( $title );
$this->assertEquals( $expected,
$title->getRootText(),
public static function provideRootTitleCases() {
return array(
# Title, expected base, optional message
- array('User:John_Doe/subOne/subTwo', 'John Doe' ),
- array('User:Foo/Bar/Baz', 'Foo' ),
+ array( 'User:John_Doe/subOne/subTwo', 'John Doe' ),
+ array( 'User:Foo/Bar/Baz', 'Foo' ),
);
}
* @todo Handle $wgNamespacesWithSubpages cases
* @dataProvider provideSubpageTitleCases
*/
- function testExtractingSubpageTextFromTitle( $title, $expected, $msg='' ) {
+ function testExtractingSubpageTextFromTitle( $title, $expected, $msg = '' ) {
$title = Title::newFromText( $title );
$this->assertEquals( $expected,
$title->getSubpageText(),
function provideSubpageTitleCases() {
return array(
# Title, expected base, optional message
- array('User:John_Doe/subOne/subTwo', 'subTwo' ),
- array('User:John_Doe/subOne', 'subOne' ),
+ array( 'User:John_Doe/subOne/subTwo', 'subTwo' ),
+ array( 'User:John_Doe/subOne', 'subOne' ),
);
}
-
}