Go to the documentation of this file.
119 $this->assertEquals(
'foobar', $site->
getGlobalId() );
128 $this->assertInternalType(
'string', $site->
getType() );
148 $this->assertInternalType(
'array', $site->
getAllPaths() );
160 $site->
setPath(
'spam',
'http://www.wikidata.org/$1' );
161 $site->
setPath(
'spam',
'http://www.wikidata.org/foo/$1' );
162 $site->
setPath(
'foobar',
'http://www.wikidata.org/bar/$1' );
166 $this->assertInternalType(
'string', $site->
getPath(
'foobar' ) );
167 $this->assertEquals(
'http://www.wikidata.org/foo/$1', $site->
getPath(
'spam' ) );
174 $this->assertNull( $site->
getPath(
'foobar' ) );
175 $this->assertNull( $site->
getPath(
'spam' ) );
183 $path =
"TestPath/$1";
185 $site->setLinkPath(
$path );
186 $this->assertEquals(
$path, $site->getLinkPath() );
195 $path =
'TestPath/$1';
196 $site->setLinkPath(
$path );
197 $this->assertEquals(
$path, $site->getPath( $site->getLinkPathType() ) );
199 $path =
'AnotherPath/$1';
200 $site->setPath( $site->getLinkPathType(),
$path );
201 $this->assertEquals(
$path, $site->getLinkPath() );
210 $path =
'TestPath/$1';
211 $site->setPath(
'foo',
$path );
213 $this->assertEquals(
$path, $site->getPath(
'foo' ) );
223 $type = $site->getLinkPathType();
224 $path =
'//acme.com/';
227 $this->assertEquals(
'', $site->getProtocol() );
238 'http://acme.test/TestPath/$1',
243 'http://acme.test/TestScript?x=$1&y=bla',
245 'TestScript?x=Foo&y=bla',
248 'http://acme.test/TestPath/$1',
249 'foo & bar/xyzzy (quux-shmoox?)',
250 '/TestPath/foo%20%26%20bar%2Fxyzzy%20%28quux-shmoox%3F%29',
265 $site->setLinkPath(
$path );
266 $this->assertContains(
$path, $site->getPageUrl() );
268 $this->assertContains( $expected, $site->getPageUrl( $page ) );
273 $this->assertTrue(
true );
291 $this->assertInstanceOf(
Site::class, $newInstance );
293 $this->assertEquals( $serialization,
serialize( $newInstance ) );
testGetLinkPathType()
Site::getLinkPathType.
testSetLanguageCode(Site $site)
instanceProvider
getInterwikiIds()
Returns the interwiki link identifiers that can be used for this site.
testSetGlobalId(Site $site)
instanceProvider
testAddInterwikiId(Site $site)
instanceProvider
getType()
Returns the type of the site (ie mediawiki).
assertTypeOrFalse( $type, $value)
getPath( $pathType)
Returns the path of the provided type or false if there is no such path.
testGetInterwikiIds(Site $site)
instanceProvider
getLanguageCode()
Returns language code of the sites primary language.
testGetPageUrl( $path, $page, $expected)
provideGetPageUrl Site::getPageUrl
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
static provideGetPageUrl()
testAddNavigationId(Site $site)
instanceProvider
testSetPath()
Site::setPath.
testGetAllPaths(Site $site)
instanceProvider
testSetLinkPath()
Site::setLinkPath.
getGlobalId()
Returns the global site identifier (ie enwiktionary).
testGetNavigationIds(Site $site)
instanceProvider
testNormalizePageName(Site $site)
instanceProvider
setLanguageCode( $languageCode)
Sets language code of the sites primary language.
testGetType(Site $site)
instanceProvider
testGetPath(Site $site)
instanceProvider
addInterwikiId( $identifier)
Adds an interwiki id to the site.
testSerialization(Site $site)
instanceProvider
addNavigationId( $identifier)
Adds a navigation id to the site.
setPath( $pathType, $fullUrl)
Sets the path used to construct links with.
getNavigationIds()
Returns the equivalent link identifiers that can be used to make the site show up in interfaces such ...
getAllPaths()
Returns the paths as associative array.
removePath( $pathType)
Removes the path of the provided type if it's set.
unserialize( $serialized)
testGetGlobalId(Site $site)
instanceProvider
testGetLanguageCode(Site $site)
instanceProvider
setGlobalId( $globalId)
Sets the global site identifier (ie enwiktionary).
normalizePageName( $pageName)
Attempt to normalize the page name in some fashion.
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
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
testProtocolRelativePath()
Site::setPath Site::getProtocol.
testSetAndRemovePath(Site $site)
instanceProvider