21 12303 =>
'TEST-JS_TALK',
26 'wgNamespaceContentModels',
32 MWNamespace::getCanonicalNamespaces(
true ); # reset
namespace cache
41 MWNamespace::getCanonicalNamespaces(
true ); # reset
namespace cache
47 [
'Main Page',
'Main Page',
true ],
48 [
'Main Page',
'Not The Main Page',
false ],
49 [
'Main Page',
'Project:Main Page',
false ],
50 [
'File:Example.png',
'Image:Example.png',
true ],
51 [
'Special:Version',
'Special:Version',
true ],
52 [
'Special:Version',
'Special:Recentchanges',
false ],
53 [
'Special:Version',
'Main Page',
false ],
61 public function testEquals( $titleA, $titleB, $expectedBool ) {
62 $titleA = Title::newFromText( $titleA );
63 $titleB = Title::newFromText( $titleB );
65 $this->assertEquals( $expectedBool, $titleA->equals( $titleB ) );
66 $this->assertEquals( $expectedBool, $titleB->equals( $titleA ) );
87 $title = Title::newFromText( $title );
88 $this->assertEquals( $expectedBool, $title->inNamespace( $ns ) );
95 $mainpage = Title::newFromText(
'Main Page' );
96 $this->assertTrue( $mainpage->inNamespaces(
NS_MAIN, NS_USER ) );
97 $this->assertTrue( $mainpage->inNamespaces( [
NS_MAIN, NS_USER ] ) );
98 $this->assertTrue( $mainpage->inNamespaces( [ NS_USER,
NS_MAIN ] ) );
120 $title = Title::newFromText( $title );
121 $this->assertEquals( $expectedBool, $title->hasSubjectNamespace( $ns ) );
154 $title = Title::newFromText( $title );
155 $this->assertEquals( $expectedModelId, $title->getContentModel() );
163 $title = Title::newFromText( $title );
164 $this->assertTrue( $title->hasContentModel( $expectedModelId ) );
169 [
'Help:Foo',
false ],
170 [
'Help:Foo.js',
false ],
171 [
'Help:Foo/bar.js',
false ],
172 [
'User:Foo',
false ],
173 [
'User:Foo.js',
false ],
174 [
'User:Foo/bar.js',
false ],
175 [
'User:Foo/bar.css',
false ],
176 [
'User talk:Foo/bar.css',
false ],
177 [
'User:Foo/bar.js.xxx',
false ],
178 [
'User:Foo/bar.xxx',
false ],
179 [
'MediaWiki:Foo.js',
true ],
180 [
'MediaWiki:Foo.css',
true ],
181 [
'MediaWiki:Foo.JS',
false ],
182 [
'MediaWiki:Foo.CSS',
false ],
183 [
'MediaWiki:Foo.css.xxx',
false ],
184 [
'TEST-JS:Foo',
false ],
185 [
'TEST-JS:Foo.js',
false ],
194 $title = Title::newFromText( $title );
195 $this->assertEquals( $expectedBool, $title->isCssOrJsPage() );
200 [
'Help:Foo',
false ],
201 [
'Help:Foo.js',
false ],
202 [
'Help:Foo/bar.js',
false ],
203 [
'User:Foo',
false ],
204 [
'User:Foo.js',
false ],
205 [
'User:Foo/bar.js',
true ],
206 [
'User:Foo/bar.css',
true ],
207 [
'User talk:Foo/bar.css',
false ],
208 [
'User:Foo/bar.js.xxx',
false ],
209 [
'User:Foo/bar.xxx',
false ],
210 [
'MediaWiki:Foo.js',
false ],
211 [
'User:Foo/bar.JS',
false ],
212 [
'User:Foo/bar.CSS',
false ],
213 [
'TEST-JS:Foo',
false ],
214 [
'TEST-JS:Foo.js',
false ],
223 $title = Title::newFromText( $title );
224 $this->assertEquals( $expectedBool, $title->isCssJsSubpage() );
229 [
'Help:Foo',
false ],
230 [
'Help:Foo.css',
false ],
231 [
'User:Foo',
false ],
232 [
'User:Foo.js',
false ],
233 [
'User:Foo.css',
false ],
234 [
'User:Foo/bar.js',
false ],
235 [
'User:Foo/bar.css',
true ],
244 $title = Title::newFromText( $title );
245 $this->assertEquals( $expectedBool, $title->isCssSubpage() );
250 [
'Help:Foo',
false ],
251 [
'Help:Foo.css',
false ],
252 [
'User:Foo',
false ],
253 [
'User:Foo.js',
false ],
254 [
'User:Foo.css',
false ],
255 [
'User:Foo/bar.js',
true ],
256 [
'User:Foo/bar.css',
false ],
265 $title = Title::newFromText( $title );
266 $this->assertEquals( $expectedBool, $title->isJsSubpage() );
271 [
'Help:Foo',
true ],
272 [
'Help:Foo.js',
true ],
273 [
'Help:Foo/bar.js',
true ],
274 [
'User:Foo',
true ],
275 [
'User:Foo.js',
true ],
276 [
'User:Foo/bar.js',
false ],
277 [
'User:Foo/bar.css',
false ],
278 [
'User talk:Foo/bar.css',
true ],
279 [
'User:Foo/bar.js.xxx',
true ],
280 [
'User:Foo/bar.xxx',
true ],
281 [
'MediaWiki:Foo.js',
false ],
282 [
'MediaWiki:Foo.css',
false ],
283 [
'MediaWiki:Foo/bar.css',
false ],
284 [
'User:Foo/bar.JS',
true ],
285 [
'User:Foo/bar.CSS',
true ],
286 [
'TEST-JS:Foo',
false ],
287 [
'TEST-JS:Foo.js',
false ],
288 [
'TEST-JS_TALK:Foo.js',
true ],
297 $title = Title::newFromText( $title );
298 $this->assertEquals( $expectedBool, $title->isWikitextPage() );
303 [
'Main Page',
'Talk:Main Page' ],
304 [
'Talk:Main Page',
'Main Page' ],
305 [
'Help:Main Page',
'Help talk:Main Page' ],
306 [
'Help talk:Main Page',
'Help:Main Page' ],
307 [
'Special:FooBar', null ],
308 [
'Media:File.jpg', null ],
320 if ( $expected ===
null ) {
321 $this->setExpectedException(
'MWException' );
324 $title = Title::newFromText( $text );
325 $this->assertEquals( $expected, $title->getOtherPage()->getPrefixedText() );
329 $linkCache = LinkCache::singleton();
331 $title1 = Title::newFromText(
'Foo' );
332 $linkCache->addGoodLinkObj( 23, $title1 );
334 Title::clearCaches();
336 $title2 = Title::newFromText(
'Foo' );
337 $this->assertNotSame( $title1, $title2,
'title cache should be empty' );
338 $this->assertEquals( 0, $linkCache->getGoodLinkID(
'Foo' ),
'link cache should be empty' );
we sometimes make exceptions for this Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally NO WARRANTY BECAUSE THE PROGRAM IS LICENSED FREE OF THERE IS NO WARRANTY FOR THE TO THE EXTENT PERMITTED BY APPLICABLE LAW EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND OR OTHER PARTIES PROVIDE THE PROGRAM AS IS WITHOUT WARRANTY OF ANY EITHER EXPRESSED OR BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU SHOULD THE PROGRAM PROVE YOU ASSUME THE COST OF ALL NECESSARY REPAIR OR CORRECTION IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT OR ANY OTHER PARTY WHO MAY MODIFY AND OR REDISTRIBUTE THE PROGRAM AS PERMITTED BE LIABLE TO YOU FOR INCLUDING ANY INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new and you want it to be of the greatest possible use to the public
testIsCssSubpage( $title, $expectedBool)
provideIsCssSubpage Title::isCssSubpage
testEquals( $titleA, $titleB, $expectedBool)
provideEquals Title::equals
testGetContentModel( $title, $expectedModelId)
dataGetContentModel Title::getContentModel
static provideInNamespace()
testIsJsSubpage( $title, $expectedBool)
provideIsJsSubpage Title::isJsSubpage
static provideIsCssOrJsPage()
static provideHasSubjectNamespace()
static provideIsCssSubpage()
testHasContentModel( $title, $expectedModelId)
dataGetContentModel Title::hasContentModel
testIsWikitextPage( $title, $expectedBool)
provideIsWikitextPage Title::isWikitextPage
testIsCssJsSubpage( $title, $expectedBool)
provideIsCssJsSubpage Title::isCssJsSubpage
static provideIsCssJsSubpage()
static provideIsWikitextPage()
static provideGetOtherPage()
testInNamespaces()
Title::inNamespaces.
testHasSubjectNamespace( $title, $ns, $expectedBool)
provideHasSubjectNamespace Title::hasSubjectNamespace
testGetOtherPage( $text, $expected)
provideGetOtherpage Title::getOtherPage
testIsCssOrJsPage( $title, $expectedBool)
provideIsCssOrJsPage Title::isCssOrJsPage
testInNamespace( $title, $ns, $expectedBool)
provideInNamespace Title::inNamespace
static provideIsJsSubpage()
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
when a variable name is used in a function
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
processing should stop and the error should be shown to the user * false
const CONTENT_MODEL_WIKITEXT
const CONTENT_MODEL_JAVASCRIPT
you have access to all of the normal MediaWiki so you can get a DB use the cache