dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Title: Refactor JS/CSS page handling to be more sane"
[lhc/web/wiklou.git]
/
tests
/
phpunit
/
includes
/
TitleMethodsTest.php
diff --git
a/tests/phpunit/includes/TitleMethodsTest.php
b/tests/phpunit/includes/TitleMethodsTest.php
index
d9c01cb
..
9ae84d9
100644
(file)
--- a/
tests/phpunit/includes/TitleMethodsTest.php
+++ b/
tests/phpunit/includes/TitleMethodsTest.php
@@
-29,7
+29,7
@@
class TitleMethodsTest extends MediaWikiLangTestCase {
]
);
]
);
- MWNamespace::
getCanonicalNamespaces( true ); # reset namespace cache
+ MWNamespace::
clearCaches();
$wgContLang->resetNamespaces(); # reset namespace cache
}
$wgContLang->resetNamespaces(); # reset namespace cache
}
@@
-38,7
+38,7
@@
class TitleMethodsTest extends MediaWikiLangTestCase {
parent::tearDown();
parent::tearDown();
- MWNamespace::
getCanonicalNamespaces( true ); # reset namespace cache
+ MWNamespace::
clearCaches();
$wgContLang->resetNamespaces(); # reset namespace cache
}
$wgContLang->resetNamespaces(); # reset namespace cache
}
@@
-164,7
+164,7
@@
class TitleMethodsTest extends MediaWikiLangTestCase {
$this->assertTrue( $title->hasContentModel( $expectedModelId ) );
}
$this->assertTrue( $title->hasContentModel( $expectedModelId ) );
}
- public static function provideIs
CssOrJs
Page() {
+ public static function provideIs
SiteConfig
Page() {
return [
[ 'Help:Foo', false ],
[ 'Help:Foo.js', false ],
return [
[ 'Help:Foo', false ],
[ 'Help:Foo.js', false ],
@@
-173,6
+173,8
@@
class TitleMethodsTest extends MediaWikiLangTestCase {
[ 'User:Foo.js', false ],
[ 'User:Foo/bar.js', false ],
[ 'User:Foo/bar.css', false ],
[ 'User:Foo.js', false ],
[ 'User:Foo/bar.js', false ],
[ 'User:Foo/bar.css', false ],
+ [ 'User:Foo/bar.JS', false ],
+ [ 'User:Foo/bar.CSS', false ],
[ 'User talk:Foo/bar.css', false ],
[ 'User:Foo/bar.js.xxx', false ],
[ 'User:Foo/bar.xxx', false ],
[ 'User talk:Foo/bar.css', false ],
[ 'User:Foo/bar.js.xxx', false ],
[ 'User:Foo/bar.xxx', false ],
@@
-180,6
+182,7
@@
class TitleMethodsTest extends MediaWikiLangTestCase {
[ 'MediaWiki:Foo.css', true ],
[ 'MediaWiki:Foo.JS', false ],
[ 'MediaWiki:Foo.CSS', false ],
[ 'MediaWiki:Foo.css', true ],
[ 'MediaWiki:Foo.JS', false ],
[ 'MediaWiki:Foo.CSS', false ],
+ [ 'MediaWiki:Foo/bar.css', true ],
[ 'MediaWiki:Foo.css.xxx', false ],
[ 'TEST-JS:Foo', false ],
[ 'TEST-JS:Foo.js', false ],
[ 'MediaWiki:Foo.css.xxx', false ],
[ 'TEST-JS:Foo', false ],
[ 'TEST-JS:Foo.js', false ],
@@
-187,15
+190,15
@@
class TitleMethodsTest extends MediaWikiLangTestCase {
}
/**
}
/**
- * @dataProvider provideIs
CssOrJs
Page
- * @covers Title::is
CssOrJs
Page
+ * @dataProvider provideIs
SiteConfig
Page
+ * @covers Title::is
SiteConfig
Page
*/
*/
- public function test
IsCssOrJs
Page( $title, $expectedBool ) {
+ public function test
SiteConfig
Page( $title, $expectedBool ) {
$title = Title::newFromText( $title );
$title = Title::newFromText( $title );
- $this->assertEquals( $expectedBool, $title->is
CssOrJs
Page() );
+ $this->assertEquals( $expectedBool, $title->is
SiteConfig
Page() );
}
}
- public static function provideIs
CssJsSubp
age() {
+ public static function provideIs
UserConfigP
age() {
return [
[ 'Help:Foo', false ],
[ 'Help:Foo.js', false ],
return [
[ 'Help:Foo', false ],
[ 'Help:Foo.js', false ],
@@
-203,28
+206,32
@@
class TitleMethodsTest extends MediaWikiLangTestCase {
[ 'User:Foo', false ],
[ 'User:Foo.js', false ],
[ 'User:Foo/bar.js', true ],
[ 'User:Foo', false ],
[ 'User:Foo.js', false ],
[ 'User:Foo/bar.js', true ],
+ [ 'User:Foo/bar.JS', false ],
[ 'User:Foo/bar.css', true ],
[ 'User:Foo/bar.css', true ],
+ [ 'User:Foo/bar.CSS', false ],
[ 'User talk:Foo/bar.css', false ],
[ 'User:Foo/bar.js.xxx', false ],
[ 'User:Foo/bar.xxx', false ],
[ 'MediaWiki:Foo.js', false ],
[ 'User talk:Foo/bar.css', false ],
[ 'User:Foo/bar.js.xxx', false ],
[ 'User:Foo/bar.xxx', false ],
[ 'MediaWiki:Foo.js', false ],
- [ 'User:Foo/bar.JS', false ],
- [ 'User:Foo/bar.CSS', false ],
+ [ 'MediaWiki:Foo.css', false ],
+ [ 'MediaWiki:Foo.JS', false ],
+ [ 'MediaWiki:Foo.CSS', false ],
+ [ 'MediaWiki:Foo.css.xxx', false ],
[ 'TEST-JS:Foo', false ],
[ 'TEST-JS:Foo.js', false ],
];
}
/**
[ 'TEST-JS:Foo', false ],
[ 'TEST-JS:Foo.js', false ],
];
}
/**
- * @dataProvider provideIs
CssJsSubp
age
- * @covers Title::is
CssJsSubp
age
+ * @dataProvider provideIs
UserConfigP
age
+ * @covers Title::is
UserConfigP
age
*/
*/
- public function testIs
CssJsSubp
age( $title, $expectedBool ) {
+ public function testIs
UserConfigP
age( $title, $expectedBool ) {
$title = Title::newFromText( $title );
$title = Title::newFromText( $title );
- $this->assertEquals( $expectedBool, $title->is
CssJsSubp
age() );
+ $this->assertEquals( $expectedBool, $title->is
UserConfigP
age() );
}
}
- public static function provideIs
CssSubp
age() {
+ public static function provideIs
UserCssConfigP
age() {
return [
[ 'Help:Foo', false ],
[ 'Help:Foo.css', false ],
return [
[ 'Help:Foo', false ],
[ 'Help:Foo.css', false ],
@@
-237,33
+244,35
@@
class TitleMethodsTest extends MediaWikiLangTestCase {
}
/**
}
/**
- * @dataProvider provideIs
CssSubp
age
- * @covers Title::is
CssSubp
age
+ * @dataProvider provideIs
UserCssConfigP
age
+ * @covers Title::is
UserCssConfigP
age
*/
*/
- public function testIs
CssSubp
age( $title, $expectedBool ) {
+ public function testIs
UserCssConfigP
age( $title, $expectedBool ) {
$title = Title::newFromText( $title );
$title = Title::newFromText( $title );
- $this->assertEquals( $expectedBool, $title->is
CssSubp
age() );
+ $this->assertEquals( $expectedBool, $title->is
UserCssConfigP
age() );
}
}
- public static function provideIs
JsSubp
age() {
+ public static function provideIs
UserJsConfigP
age() {
return [
[ 'Help:Foo', false ],
[ 'Help:Foo.css', false ],
[ 'User:Foo', false ],
[ 'User:Foo.js', false ],
return [
[ 'Help:Foo', false ],
[ 'Help:Foo.css', false ],
[ 'User:Foo', false ],
[ 'User:Foo.js', false ],
+ [ 'User:Foo.json', false ],
[ 'User:Foo.css', false ],
[ 'User:Foo/bar.js', true ],
[ 'User:Foo.css', false ],
[ 'User:Foo/bar.js', true ],
+ [ 'User:Foo/bar.json', false ],
[ 'User:Foo/bar.css', false ],
];
}
/**
[ 'User:Foo/bar.css', false ],
];
}
/**
- * @dataProvider provideIs
JsSubp
age
- * @covers Title::is
JsSubp
age
+ * @dataProvider provideIs
UserJsConfigP
age
+ * @covers Title::is
UserJsConfigP
age
*/
*/
- public function testIs
JsSubp
age( $title, $expectedBool ) {
+ public function testIs
UserJsConfigP
age( $title, $expectedBool ) {
$title = Title::newFromText( $title );
$title = Title::newFromText( $title );
- $this->assertEquals( $expectedBool, $title->is
JsSubp
age() );
+ $this->assertEquals( $expectedBool, $title->is
UserJsConfigP
age() );
}
public static function provideIsWikitextPage() {
}
public static function provideIsWikitextPage() {
@@
-279,13
+288,14
@@
class TitleMethodsTest extends MediaWikiLangTestCase {
[ 'User:Foo/bar.js.xxx', true ],
[ 'User:Foo/bar.xxx', true ],
[ 'MediaWiki:Foo.js', false ],
[ 'User:Foo/bar.js.xxx', true ],
[ 'User:Foo/bar.xxx', true ],
[ 'MediaWiki:Foo.js', false ],
- [ 'MediaWiki:Foo.css', false ],
- [ 'MediaWiki:Foo/bar.css', false ],
[ 'User:Foo/bar.JS', true ],
[ 'User:Foo/bar.CSS', true ],
[ 'User:Foo/bar.JS', true ],
[ 'User:Foo/bar.CSS', true ],
+ [ 'MediaWiki:Foo.css', false ],
+ [ 'MediaWiki:Foo.JS', true ],
+ [ 'MediaWiki:Foo.CSS', true ],
+ [ 'MediaWiki:Foo.css.xxx', true ],
[ 'TEST-JS:Foo', false ],
[ 'TEST-JS:Foo.js', false ],
[ 'TEST-JS:Foo', false ],
[ 'TEST-JS:Foo.js', false ],
- [ 'TEST-JS_TALK:Foo.js', true ],
];
}
];
}
@@
-318,13
+328,16
@@
class TitleMethodsTest extends MediaWikiLangTestCase {
*/
public function testGetOtherPage( $text, $expected ) {
if ( $expected === null ) {
*/
public function testGetOtherPage( $text, $expected ) {
if ( $expected === null ) {
- $this->setExpectedException(
'MWException'
);
+ $this->setExpectedException(
MWException::class
);
}
$title = Title::newFromText( $text );
$this->assertEquals( $expected, $title->getOtherPage()->getPrefixedText() );
}
}
$title = Title::newFromText( $text );
$this->assertEquals( $expected, $title->getOtherPage()->getPrefixedText() );
}
+ /**
+ * @covers Title::clearCaches
+ */
public function testClearCaches() {
$linkCache = LinkCache::singleton();
public function testClearCaches() {
$linkCache = LinkCache::singleton();