22 12303 =>
'TEST-JS_TALK',
27 'wgNamespaceContentModels',
53 $this->assertEquals( $expectedBool,
$title->inNamespace( $ns ) );
60 $mainpage = Title::newFromText(
'Main Page' );
62 $this->assertTrue( $mainpage->inNamespaces( [
NS_MAIN,
NS_USER ] ) );
63 $this->assertTrue( $mainpage->inNamespaces( [
NS_USER,
NS_MAIN ] ) );
86 $this->assertEquals( $expectedBool,
$title->hasSubjectNamespace( $ns ) );
120 $this->assertEquals( $expectedModelId,
$title->getContentModel() );
129 $this->assertTrue(
$title->hasContentModel( $expectedModelId ) );
134 [
'Help:Foo',
false ],
135 [
'Help:Foo.js',
false ],
136 [
'Help:Foo/bar.js',
false ],
137 [
'User:Foo',
false ],
138 [
'User:Foo.js',
false ],
139 [
'User:Foo/bar.js',
false ],
140 [
'User:Foo/bar.json',
false ],
141 [
'User:Foo/bar.css',
false ],
142 [
'User:Foo/bar.JS',
false ],
143 [
'User:Foo/bar.JSON',
false ],
144 [
'User:Foo/bar.CSS',
false ],
145 [
'User talk:Foo/bar.css',
false ],
146 [
'User:Foo/bar.js.xxx',
false ],
147 [
'User:Foo/bar.xxx',
false ],
148 [
'MediaWiki:Foo.js',
true ],
149 [
'MediaWiki:Foo.json',
true ],
150 [
'MediaWiki:Foo.css',
true ],
151 [
'MediaWiki:Foo.JS',
false ],
152 [
'MediaWiki:Foo.JSON',
false ],
153 [
'MediaWiki:Foo.CSS',
false ],
154 [
'MediaWiki:Foo/bar.css',
true ],
155 [
'MediaWiki:Foo.css.xxx',
false ],
156 [
'TEST-JS:Foo',
false ],
157 [
'TEST-JS:Foo.js',
false ],
167 $this->assertEquals( $expectedBool,
$title->isSiteConfigPage() );
172 [
'Help:Foo',
false ],
173 [
'Help:Foo.js',
false ],
174 [
'Help:Foo/bar.js',
false ],
175 [
'User:Foo',
false ],
176 [
'User:Foo.js',
false ],
177 [
'User:Foo/bar.js',
true ],
178 [
'User:Foo/bar.JS',
false ],
179 [
'User:Foo/bar.json',
true ],
180 [
'User:Foo/bar.JSON',
false ],
181 [
'User:Foo/bar.css',
true ],
182 [
'User:Foo/bar.CSS',
false ],
183 [
'User talk:Foo/bar.css',
false ],
184 [
'User:Foo/bar.js.xxx',
false ],
185 [
'User:Foo/bar.xxx',
false ],
186 [
'MediaWiki:Foo.js',
false ],
187 [
'MediaWiki:Foo.json',
false ],
188 [
'MediaWiki:Foo.css',
false ],
189 [
'MediaWiki:Foo.JS',
false ],
190 [
'MediaWiki:Foo.JSON',
false ],
191 [
'MediaWiki:Foo.CSS',
false ],
192 [
'MediaWiki:Foo.css.xxx',
false ],
193 [
'TEST-JS:Foo',
false ],
194 [
'TEST-JS:Foo.js',
false ],
204 $this->assertEquals( $expectedBool,
$title->isUserConfigPage() );
209 [
'Help:Foo',
false ],
210 [
'Help:Foo.css',
false ],
211 [
'User:Foo',
false ],
212 [
'User:Foo.js',
false ],
213 [
'User:Foo.json',
false ],
214 [
'User:Foo.css',
false ],
215 [
'User:Foo/bar.js',
false ],
216 [
'User:Foo/bar.json',
false ],
217 [
'User:Foo/bar.css',
true ],
227 $this->assertEquals( $expectedBool,
$title->isUserCssConfigPage() );
232 [
'Help:Foo',
false ],
233 [
'Help:Foo.css',
false ],
234 [
'User:Foo',
false ],
235 [
'User:Foo.js',
false ],
236 [
'User:Foo.json',
false ],
237 [
'User:Foo.css',
false ],
238 [
'User:Foo/bar.js',
true ],
239 [
'User:Foo/bar.json',
false ],
240 [
'User:Foo/bar.css',
false ],
250 $this->assertEquals( $expectedBool,
$title->isUserJsConfigPage() );
255 [
'Help:Foo',
true ],
256 [
'Help:Foo.js',
true ],
257 [
'Help:Foo/bar.js',
true ],
258 [
'User:Foo',
true ],
259 [
'User:Foo.js',
true ],
260 [
'User:Foo/bar.js',
false ],
261 [
'User:Foo/bar.json',
false ],
262 [
'User:Foo/bar.css',
false ],
263 [
'User talk:Foo/bar.css',
true ],
264 [
'User:Foo/bar.js.xxx',
true ],
265 [
'User:Foo/bar.xxx',
true ],
266 [
'MediaWiki:Foo.js',
false ],
267 [
'User:Foo/bar.JS',
true ],
268 [
'User:Foo/bar.JSON',
true ],
269 [
'User:Foo/bar.CSS',
true ],
270 [
'MediaWiki:Foo.json',
false ],
271 [
'MediaWiki:Foo.css',
false ],
272 [
'MediaWiki:Foo.JS',
true ],
273 [
'MediaWiki:Foo.JSON',
true ],
274 [
'MediaWiki:Foo.CSS',
true ],
275 [
'MediaWiki:Foo.css.xxx',
true ],
276 [
'TEST-JS:Foo',
false ],
277 [
'TEST-JS:Foo.js',
false ],
287 $this->assertEquals( $expectedBool,
$title->isWikitextPage() );
292 [
'Main Page',
'Talk:Main Page' ],
293 [
'Talk:Main Page',
'Main Page' ],
294 [
'Help:Main Page',
'Help talk:Main Page' ],
295 [
'Help talk:Main Page',
'Help:Main Page' ],
296 [
'Special:FooBar',
null ],
297 [
'Media:File.jpg',
null ],
309 if ( $expected ===
null ) {
310 $this->setExpectedException( MWException::class );
313 $title = Title::newFromText( $text );
314 $this->assertEquals( $expected,
$title->getOtherPage()->getPrefixedText() );
321 $linkCache = MediaWikiServices::getInstance()->getLinkCache();
323 $title1 = Title::newFromText(
'Foo' );
324 $linkCache->addGoodLinkObj( 23, $title1 );
326 Title::clearCaches();
328 $title2 = Title::newFromText(
'Foo' );
329 $this->assertNotSame( $title1, $title2,
'title cache should be empty' );
330 $this->assertEquals( 0, $linkCache->getGoodLinkID(
'Foo' ),
'link cache should be empty' );
340 yield
'Fragment' => [
341 '/wiki/Goats#Goatificatiön',
347 yield
'Unknown interwiki with fragment' => [
348 'https://xx.wiki.test/wiki/xyzzy:Goats#Goatificatiön',
355 yield
'Interwiki with fragment' => [
356 'https://acme.test/Goats#Goatificati.C3.B6n',
363 yield
'Interwiki with query' => [
364 'https://acme.test/Goats?a=1&b=blank+blank#Goatificati.C3.B6n',
375 yield
'Local interwiki with fragment' => [
376 'https://yy.wiki.test/wiki/Goats#Goatificatiön',
403 'wgServer' =>
'https://xx.wiki.test',
404 'wgArticlePath' =>
'/wiki/$1',
405 'wgExternalInterwikiFragmentMode' =>
'legacy',
406 'wgFragmentMode' => [
'html5',
'legacy' ]
409 $interwikiLookup = $this->getMock( InterwikiLookup::class );
411 $interwikiLookup->method(
'fetch' )
412 ->willReturnCallback(
function ( $interwiki ) {
413 switch ( $interwiki ) {
419 'https://acme.test/$1'
424 'https://yy.wiki.test/wiki/$1',
434 $this->
setService(
'InterwikiLookup', $interwikiLookup );
436 $title = Title::makeTitle( $ns,
$title, $fragment, $interwiki );
437 $this->assertSame( $expected,
$title->getLinkURL(
$query, $query2, $proto ) );
441 Title::clearCaches();
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
Value object for representing interwiki records.
testGetContentModel( $title, $expectedModelId)
dataGetContentModel Title::getContentModel
static provideIsUserJsConfigPage()
static provideInNamespace()
static provideHasSubjectNamespace()
testIsUserJsConfigPage( $title, $expectedBool)
provideIsUserJsConfigPage Title::isUserJsConfigPage
testGetLinkURL( $expected, $ns, $title, $fragment='', $interwiki='', $query='', $query2=false, $proto=false)
provideGetLinkURL
testHasContentModel( $title, $expectedModelId)
dataGetContentModel Title::hasContentModel
static provideIsSiteConfigPage()
testIsWikitextPage( $title, $expectedBool)
provideIsWikitextPage Title::isWikitextPage
testSiteConfigPage( $title, $expectedBool)
provideIsSiteConfigPage Title::isSiteConfigPage
testClearCaches()
Title::clearCaches.
static provideIsUserCssConfigPage()
testIsUserConfigPage( $title, $expectedBool)
provideIsUserConfigPage Title::isUserConfigPage
static provideIsWikitextPage()
static provideGetOtherPage()
testIsUserCssConfigPage( $title, $expectedBool)
provideIsUserCssConfigPage Title::isUserCssConfigPage
testInNamespaces()
Title::inNamespaces.
static provideIsUserConfigPage()
testHasSubjectNamespace( $title, $ns, $expectedBool)
provideHasSubjectNamespace Title::hasSubjectNamespace
testGetOtherPage( $text, $expected)
provideGetOtherpage Title::getOtherPage
testInNamespace( $title, $ns, $expectedBool)
provideInNamespace Title::inNamespace
const CONTENT_MODEL_WIKITEXT
const CONTENT_MODEL_JAVASCRIPT
namespace and then decline to actually register it file or subcat img or subcat $title
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
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
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
processing should stop and the error should be shown to the user * false
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php