2011-11-22 13:34:55 +00:00
|
|
|
<?php
|
|
|
|
|
|
2012-05-13 22:02:29 +00:00
|
|
|
/**
|
|
|
|
|
* @group ContentHandler
|
2012-12-09 09:27:56 +00:00
|
|
|
* @group Database
|
2012-09-19 18:07:56 +00:00
|
|
|
*
|
2014-07-24 09:30:25 +00:00
|
|
|
* @note We don't make assumptions about the main namespace.
|
|
|
|
|
* But we do expect the Help namespace to contain Wikitext.
|
2012-05-13 22:02:29 +00:00
|
|
|
*/
|
2014-12-30 09:22:56 +00:00
|
|
|
class TitleMethodsTest extends MediaWikiLangTestCase {
|
2011-11-22 13:34:55 +00:00
|
|
|
|
2013-11-24 00:46:49 +00:00
|
|
|
protected function setUp() {
|
2012-11-26 21:15:11 +00:00
|
|
|
global $wgContLang;
|
2012-04-19 10:55:46 +00:00
|
|
|
|
2012-10-23 17:02:36 +00:00
|
|
|
parent::setUp();
|
|
|
|
|
|
2012-10-09 09:34:24 +00:00
|
|
|
$this->mergeMwGlobalArrayValue(
|
|
|
|
|
'wgExtraNamespaces',
|
2016-02-17 09:09:32 +00:00
|
|
|
[
|
2012-10-09 09:34:24 +00:00
|
|
|
12302 => 'TEST-JS',
|
|
|
|
|
12303 => 'TEST-JS_TALK',
|
2016-02-17 09:09:32 +00:00
|
|
|
]
|
2012-10-09 09:34:24 +00:00
|
|
|
);
|
2012-04-19 10:55:46 +00:00
|
|
|
|
2012-10-09 09:34:24 +00:00
|
|
|
$this->mergeMwGlobalArrayValue(
|
|
|
|
|
'wgNamespaceContentModels',
|
2016-02-17 09:09:32 +00:00
|
|
|
[
|
2012-10-09 09:34:24 +00:00
|
|
|
12302 => CONTENT_MODEL_JAVASCRIPT,
|
2016-02-17 09:09:32 +00:00
|
|
|
]
|
2012-10-09 09:34:24 +00:00
|
|
|
);
|
2012-04-26 10:11:01 +00:00
|
|
|
|
2012-04-26 10:11:34 +00:00
|
|
|
MWNamespace::getCanonicalNamespaces( true ); # reset namespace cache
|
|
|
|
|
$wgContLang->resetNamespaces(); # reset namespace cache
|
|
|
|
|
}
|
2012-04-19 10:55:46 +00:00
|
|
|
|
2013-11-24 00:46:49 +00:00
|
|
|
protected function tearDown() {
|
2012-10-09 09:34:24 +00:00
|
|
|
global $wgContLang;
|
2012-04-26 10:11:01 +00:00
|
|
|
|
2012-10-23 17:02:36 +00:00
|
|
|
parent::tearDown();
|
|
|
|
|
|
2012-04-26 10:11:34 +00:00
|
|
|
MWNamespace::getCanonicalNamespaces( true ); # reset namespace cache
|
|
|
|
|
$wgContLang->resetNamespaces(); # reset namespace cache
|
|
|
|
|
}
|
2012-04-19 10:55:46 +00:00
|
|
|
|
2012-10-08 10:56:20 +00:00
|
|
|
public static function provideEquals() {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [
|
|
|
|
|
[ 'Main Page', 'Main Page', true ],
|
|
|
|
|
[ 'Main Page', 'Not The Main Page', false ],
|
|
|
|
|
[ 'Main Page', 'Project:Main Page', false ],
|
|
|
|
|
[ 'File:Example.png', 'Image:Example.png', true ],
|
|
|
|
|
[ 'Special:Version', 'Special:Version', true ],
|
|
|
|
|
[ 'Special:Version', 'Special:Recentchanges', false ],
|
|
|
|
|
[ 'Special:Version', 'Main Page', false ],
|
|
|
|
|
];
|
2011-11-22 13:34:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2012-10-08 10:56:20 +00:00
|
|
|
* @dataProvider provideEquals
|
2013-10-21 21:09:13 +00:00
|
|
|
* @covers Title::equals
|
2011-11-22 13:34:55 +00:00
|
|
|
*/
|
|
|
|
|
public function testEquals( $titleA, $titleB, $expectedBool ) {
|
|
|
|
|
$titleA = Title::newFromText( $titleA );
|
|
|
|
|
$titleB = Title::newFromText( $titleB );
|
|
|
|
|
|
assertEquals is $expected, $actual, not $actual, $expected
Fix Title related tests that are the wrong way round (noticed by Daniel Kinzler
when creating more tests, and wondering why phpunit was making error messages
that didn't make any sense!)
public static function assertEquals($expected, $actual, $message = '',
$delta = 0, $maxDepth = 10, $canonicalize = FALSE, $ignoreCase = FALSE)
Change-Id: I09aeb7cb7edb8e486ccf2f54673f91cd9704cd3b
2012-04-18 12:50:39 +00:00
|
|
|
$this->assertEquals( $expectedBool, $titleA->equals( $titleB ) );
|
|
|
|
|
$this->assertEquals( $expectedBool, $titleB->equals( $titleA ) );
|
2011-11-22 13:34:55 +00:00
|
|
|
}
|
|
|
|
|
|
2012-10-08 10:56:20 +00:00
|
|
|
public static function provideInNamespace() {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [
|
|
|
|
|
[ 'Main Page', NS_MAIN, true ],
|
|
|
|
|
[ 'Main Page', NS_TALK, false ],
|
|
|
|
|
[ 'Main Page', NS_USER, false ],
|
|
|
|
|
[ 'User:Foo', NS_USER, true ],
|
|
|
|
|
[ 'User:Foo', NS_USER_TALK, false ],
|
|
|
|
|
[ 'User:Foo', NS_TEMPLATE, false ],
|
|
|
|
|
[ 'User_talk:Foo', NS_USER_TALK, true ],
|
|
|
|
|
[ 'User_talk:Foo', NS_USER, false ],
|
|
|
|
|
];
|
2011-11-22 13:34:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2012-10-08 10:56:20 +00:00
|
|
|
* @dataProvider provideInNamespace
|
2013-10-21 21:09:13 +00:00
|
|
|
* @covers Title::inNamespace
|
2011-11-22 13:34:55 +00:00
|
|
|
*/
|
|
|
|
|
public function testInNamespace( $title, $ns, $expectedBool ) {
|
|
|
|
|
$title = Title::newFromText( $title );
|
2012-05-02 17:30:09 +00:00
|
|
|
$this->assertEquals( $expectedBool, $title->inNamespace( $ns ) );
|
2011-11-22 13:34:55 +00:00
|
|
|
}
|
|
|
|
|
|
2013-10-21 21:09:13 +00:00
|
|
|
/**
|
|
|
|
|
* @covers Title::inNamespaces
|
|
|
|
|
*/
|
2011-11-22 13:34:55 +00:00
|
|
|
public function testInNamespaces() {
|
|
|
|
|
$mainpage = Title::newFromText( 'Main Page' );
|
|
|
|
|
$this->assertTrue( $mainpage->inNamespaces( NS_MAIN, NS_USER ) );
|
2016-02-17 09:09:32 +00:00
|
|
|
$this->assertTrue( $mainpage->inNamespaces( [ NS_MAIN, NS_USER ] ) );
|
|
|
|
|
$this->assertTrue( $mainpage->inNamespaces( [ NS_USER, NS_MAIN ] ) );
|
|
|
|
|
$this->assertFalse( $mainpage->inNamespaces( [ NS_PROJECT, NS_TEMPLATE ] ) );
|
2011-11-22 13:34:55 +00:00
|
|
|
}
|
|
|
|
|
|
2012-10-08 10:56:20 +00:00
|
|
|
public static function provideHasSubjectNamespace() {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [
|
|
|
|
|
[ 'Main Page', NS_MAIN, true ],
|
|
|
|
|
[ 'Main Page', NS_TALK, true ],
|
|
|
|
|
[ 'Main Page', NS_USER, false ],
|
|
|
|
|
[ 'User:Foo', NS_USER, true ],
|
|
|
|
|
[ 'User:Foo', NS_USER_TALK, true ],
|
|
|
|
|
[ 'User:Foo', NS_TEMPLATE, false ],
|
|
|
|
|
[ 'User_talk:Foo', NS_USER_TALK, true ],
|
|
|
|
|
[ 'User_talk:Foo', NS_USER, true ],
|
|
|
|
|
];
|
2011-11-22 13:34:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2012-10-08 10:56:20 +00:00
|
|
|
* @dataProvider provideHasSubjectNamespace
|
2013-10-21 21:09:13 +00:00
|
|
|
* @covers Title::hasSubjectNamespace
|
2011-11-22 13:34:55 +00:00
|
|
|
*/
|
|
|
|
|
public function testHasSubjectNamespace( $title, $ns, $expectedBool ) {
|
|
|
|
|
$title = Title::newFromText( $title );
|
assertEquals is $expected, $actual, not $actual, $expected
Fix Title related tests that are the wrong way round (noticed by Daniel Kinzler
when creating more tests, and wondering why phpunit was making error messages
that didn't make any sense!)
public static function assertEquals($expected, $actual, $message = '',
$delta = 0, $maxDepth = 10, $canonicalize = FALSE, $ignoreCase = FALSE)
Change-Id: I09aeb7cb7edb8e486ccf2f54673f91cd9704cd3b
2012-04-18 12:50:39 +00:00
|
|
|
$this->assertEquals( $expectedBool, $title->hasSubjectNamespace( $ns ) );
|
2011-11-22 13:34:55 +00:00
|
|
|
}
|
|
|
|
|
|
2012-05-13 22:02:29 +00:00
|
|
|
public function dataGetContentModel() {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [
|
|
|
|
|
[ 'Help:Foo', CONTENT_MODEL_WIKITEXT ],
|
|
|
|
|
[ 'Help:Foo.js', CONTENT_MODEL_WIKITEXT ],
|
|
|
|
|
[ 'Help:Foo/bar.js', CONTENT_MODEL_WIKITEXT ],
|
|
|
|
|
[ 'User:Foo', CONTENT_MODEL_WIKITEXT ],
|
|
|
|
|
[ 'User:Foo.js', CONTENT_MODEL_WIKITEXT ],
|
|
|
|
|
[ 'User:Foo/bar.js', CONTENT_MODEL_JAVASCRIPT ],
|
|
|
|
|
[ 'User:Foo/bar.css', CONTENT_MODEL_CSS ],
|
|
|
|
|
[ 'User talk:Foo/bar.css', CONTENT_MODEL_WIKITEXT ],
|
|
|
|
|
[ 'User:Foo/bar.js.xxx', CONTENT_MODEL_WIKITEXT ],
|
|
|
|
|
[ 'User:Foo/bar.xxx', CONTENT_MODEL_WIKITEXT ],
|
|
|
|
|
[ 'MediaWiki:Foo.js', CONTENT_MODEL_JAVASCRIPT ],
|
|
|
|
|
[ 'MediaWiki:Foo.css', CONTENT_MODEL_CSS ],
|
|
|
|
|
[ 'MediaWiki:Foo/bar.css', CONTENT_MODEL_CSS ],
|
|
|
|
|
[ 'MediaWiki:Foo.JS', CONTENT_MODEL_WIKITEXT ],
|
|
|
|
|
[ 'MediaWiki:Foo.CSS', CONTENT_MODEL_WIKITEXT ],
|
|
|
|
|
[ 'MediaWiki:Foo.css.xxx', CONTENT_MODEL_WIKITEXT ],
|
|
|
|
|
[ 'TEST-JS:Foo', CONTENT_MODEL_JAVASCRIPT ],
|
|
|
|
|
[ 'TEST-JS:Foo.js', CONTENT_MODEL_JAVASCRIPT ],
|
|
|
|
|
[ 'TEST-JS:Foo/bar.js', CONTENT_MODEL_JAVASCRIPT ],
|
|
|
|
|
[ 'TEST-JS_TALK:Foo.js', CONTENT_MODEL_WIKITEXT ],
|
|
|
|
|
];
|
2012-04-26 10:11:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2012-05-13 22:02:29 +00:00
|
|
|
* @dataProvider dataGetContentModel
|
2013-10-21 21:09:13 +00:00
|
|
|
* @covers Title::getContentModel
|
2012-04-26 10:11:34 +00:00
|
|
|
*/
|
2012-05-13 22:02:29 +00:00
|
|
|
public function testGetContentModel( $title, $expectedModelId ) {
|
2012-04-26 10:11:34 +00:00
|
|
|
$title = Title::newFromText( $title );
|
2012-05-13 22:02:29 +00:00
|
|
|
$this->assertEquals( $expectedModelId, $title->getContentModel() );
|
2012-04-26 10:11:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2012-05-13 22:02:29 +00:00
|
|
|
* @dataProvider dataGetContentModel
|
2013-10-21 21:09:13 +00:00
|
|
|
* @covers Title::hasContentModel
|
2012-04-26 10:11:34 +00:00
|
|
|
*/
|
2012-05-13 22:02:29 +00:00
|
|
|
public function testHasContentModel( $title, $expectedModelId ) {
|
2012-04-26 10:11:34 +00:00
|
|
|
$title = Title::newFromText( $title );
|
2012-05-13 22:02:29 +00:00
|
|
|
$this->assertTrue( $title->hasContentModel( $expectedModelId ) );
|
2012-04-26 10:11:34 +00:00
|
|
|
}
|
|
|
|
|
|
2012-10-08 10:56:20 +00:00
|
|
|
public static function provideIsCssOrJsPage() {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [
|
|
|
|
|
[ 'Help:Foo', false ],
|
|
|
|
|
[ 'Help:Foo.js', false ],
|
|
|
|
|
[ 'Help:Foo/bar.js', false ],
|
|
|
|
|
[ 'User:Foo', false ],
|
|
|
|
|
[ 'User:Foo.js', 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 ],
|
|
|
|
|
[ 'MediaWiki:Foo.js', true ],
|
|
|
|
|
[ 'MediaWiki:Foo.css', true ],
|
|
|
|
|
[ 'MediaWiki:Foo.JS', false ],
|
|
|
|
|
[ 'MediaWiki:Foo.CSS', false ],
|
|
|
|
|
[ 'MediaWiki:Foo.css.xxx', false ],
|
|
|
|
|
[ 'TEST-JS:Foo', false ],
|
|
|
|
|
[ 'TEST-JS:Foo.js', false ],
|
|
|
|
|
];
|
2012-05-02 17:30:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2012-10-08 10:56:20 +00:00
|
|
|
* @dataProvider provideIsCssOrJsPage
|
2013-10-21 21:09:13 +00:00
|
|
|
* @covers Title::isCssOrJsPage
|
2012-05-02 17:30:09 +00:00
|
|
|
*/
|
|
|
|
|
public function testIsCssOrJsPage( $title, $expectedBool ) {
|
|
|
|
|
$title = Title::newFromText( $title );
|
|
|
|
|
$this->assertEquals( $expectedBool, $title->isCssOrJsPage() );
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-08 10:56:20 +00:00
|
|
|
public static function provideIsCssJsSubpage() {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [
|
|
|
|
|
[ 'Help:Foo', false ],
|
|
|
|
|
[ 'Help:Foo.js', false ],
|
|
|
|
|
[ 'Help:Foo/bar.js', false ],
|
|
|
|
|
[ 'User:Foo', false ],
|
|
|
|
|
[ 'User:Foo.js', false ],
|
|
|
|
|
[ 'User:Foo/bar.js', true ],
|
|
|
|
|
[ 'User:Foo/bar.css', true ],
|
|
|
|
|
[ '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 ],
|
|
|
|
|
[ 'TEST-JS:Foo', false ],
|
|
|
|
|
[ 'TEST-JS:Foo.js', false ],
|
|
|
|
|
];
|
2012-05-02 17:30:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2012-10-08 10:56:20 +00:00
|
|
|
* @dataProvider provideIsCssJsSubpage
|
2013-10-21 21:09:13 +00:00
|
|
|
* @covers Title::isCssJsSubpage
|
2012-05-02 17:30:09 +00:00
|
|
|
*/
|
|
|
|
|
public function testIsCssJsSubpage( $title, $expectedBool ) {
|
|
|
|
|
$title = Title::newFromText( $title );
|
|
|
|
|
$this->assertEquals( $expectedBool, $title->isCssJsSubpage() );
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-08 10:56:20 +00:00
|
|
|
public static function provideIsCssSubpage() {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [
|
|
|
|
|
[ 'Help:Foo', false ],
|
|
|
|
|
[ 'Help:Foo.css', false ],
|
|
|
|
|
[ 'User:Foo', false ],
|
|
|
|
|
[ 'User:Foo.js', false ],
|
|
|
|
|
[ 'User:Foo.css', false ],
|
|
|
|
|
[ 'User:Foo/bar.js', false ],
|
|
|
|
|
[ 'User:Foo/bar.css', true ],
|
|
|
|
|
];
|
2012-05-02 17:30:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2012-10-08 10:56:20 +00:00
|
|
|
* @dataProvider provideIsCssSubpage
|
2013-10-21 21:09:13 +00:00
|
|
|
* @covers Title::isCssSubpage
|
2012-05-02 17:30:09 +00:00
|
|
|
*/
|
|
|
|
|
public function testIsCssSubpage( $title, $expectedBool ) {
|
|
|
|
|
$title = Title::newFromText( $title );
|
|
|
|
|
$this->assertEquals( $expectedBool, $title->isCssSubpage() );
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-08 10:56:20 +00:00
|
|
|
public static function provideIsJsSubpage() {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [
|
|
|
|
|
[ 'Help:Foo', false ],
|
|
|
|
|
[ 'Help:Foo.css', false ],
|
|
|
|
|
[ 'User:Foo', false ],
|
|
|
|
|
[ 'User:Foo.js', false ],
|
|
|
|
|
[ 'User:Foo.css', false ],
|
|
|
|
|
[ 'User:Foo/bar.js', true ],
|
|
|
|
|
[ 'User:Foo/bar.css', false ],
|
|
|
|
|
];
|
2012-05-02 17:30:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2012-10-08 10:56:20 +00:00
|
|
|
* @dataProvider provideIsJsSubpage
|
2013-10-21 21:09:13 +00:00
|
|
|
* @covers Title::isJsSubpage
|
2012-05-02 17:30:09 +00:00
|
|
|
*/
|
|
|
|
|
public function testIsJsSubpage( $title, $expectedBool ) {
|
|
|
|
|
$title = Title::newFromText( $title );
|
|
|
|
|
$this->assertEquals( $expectedBool, $title->isJsSubpage() );
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-08 10:56:20 +00:00
|
|
|
public static function provideIsWikitextPage() {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [
|
|
|
|
|
[ 'Help:Foo', true ],
|
|
|
|
|
[ 'Help:Foo.js', true ],
|
|
|
|
|
[ 'Help:Foo/bar.js', true ],
|
|
|
|
|
[ 'User:Foo', true ],
|
|
|
|
|
[ 'User:Foo.js', true ],
|
|
|
|
|
[ 'User:Foo/bar.js', false ],
|
|
|
|
|
[ 'User:Foo/bar.css', false ],
|
|
|
|
|
[ 'User talk:Foo/bar.css', true ],
|
|
|
|
|
[ '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 ],
|
|
|
|
|
[ 'TEST-JS:Foo', false ],
|
|
|
|
|
[ 'TEST-JS:Foo.js', false ],
|
|
|
|
|
[ 'TEST-JS_TALK:Foo.js', true ],
|
|
|
|
|
];
|
2012-05-02 17:30:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2012-10-08 10:56:20 +00:00
|
|
|
* @dataProvider provideIsWikitextPage
|
2013-10-21 21:09:13 +00:00
|
|
|
* @covers Title::isWikitextPage
|
2012-05-02 17:30:09 +00:00
|
|
|
*/
|
|
|
|
|
public function testIsWikitextPage( $title, $expectedBool ) {
|
|
|
|
|
$title = Title::newFromText( $title );
|
|
|
|
|
$this->assertEquals( $expectedBool, $title->isWikitextPage() );
|
|
|
|
|
}
|
2014-12-05 01:45:05 +00:00
|
|
|
|
|
|
|
|
public static function provideGetOtherPage() {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [
|
|
|
|
|
[ 'Main Page', 'Talk:Main Page' ],
|
|
|
|
|
[ 'Talk:Main Page', 'Main Page' ],
|
|
|
|
|
[ 'Help:Main Page', 'Help talk:Main Page' ],
|
|
|
|
|
[ 'Help talk:Main Page', 'Help:Main Page' ],
|
|
|
|
|
[ 'Special:FooBar', null ],
|
|
|
|
|
];
|
2014-12-05 01:45:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @dataProvider provideGetOtherpage
|
|
|
|
|
* @covers Title::getOtherPage
|
|
|
|
|
*
|
|
|
|
|
* @param string $text
|
|
|
|
|
* @param string|null $expected
|
|
|
|
|
*/
|
|
|
|
|
public function testGetOtherPage( $text, $expected ) {
|
|
|
|
|
if ( $expected === null ) {
|
|
|
|
|
$this->setExpectedException( 'MWException' );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$title = Title::newFromText( $text );
|
|
|
|
|
$this->assertEquals( $expected, $title->getOtherPage()->getPrefixedText() );
|
|
|
|
|
}
|
2015-05-24 15:50:24 +00:00
|
|
|
|
|
|
|
|
public function testClearCaches() {
|
|
|
|
|
$linkCache = LinkCache::singleton();
|
|
|
|
|
|
|
|
|
|
$title1 = Title::newFromText( 'Foo' );
|
|
|
|
|
$linkCache->addGoodLinkObj( 23, $title1 );
|
|
|
|
|
|
|
|
|
|
Title::clearCaches();
|
|
|
|
|
|
|
|
|
|
$title2 = Title::newFromText( 'Foo' );
|
|
|
|
|
$this->assertNotSame( $title1, $title2, 'title cache should be empty' );
|
|
|
|
|
$this->assertEquals( 0, $linkCache->getGoodLinkID( 'Foo' ), 'link cache should be empty' );
|
|
|
|
|
}
|
2011-11-22 13:34:55 +00:00
|
|
|
}
|