43 $this->assertInternalType(
'array', $site->getInterwikiIds() );
52 $this->assertInternalType(
'array', $site->getNavigationIds() );
61 $site->addNavigationId(
'foobar' );
62 $this->assertTrue( in_array(
'foobar', $site->getNavigationIds(),
true ) );
71 $site->addInterwikiId(
'foobar' );
72 $this->assertTrue( in_array(
'foobar', $site->getInterwikiIds(),
true ) );
90 $site->setLanguageCode(
'en' );
91 $this->assertEquals(
'en', $site->getLanguageCode() );
100 $this->assertInternalType(
'string', $site->normalizePageName(
'Foobar' ) );
118 $site->setGlobalId(
'foobar' );
119 $this->assertEquals(
'foobar', $site->getGlobalId() );
128 $this->assertInternalType(
'string', $site->getType() );
148 $this->assertInternalType(
'array', $site->getAllPaths() );
158 $count = count( $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' );
164 $this->assertEquals( $count + 2, count( $site->getAllPaths() ) );
166 $this->assertInternalType(
'string', $site->getPath(
'foobar' ) );
167 $this->assertEquals(
'http://www.wikidata.org/foo/$1', $site->getPath(
'spam' ) );
169 $site->removePath(
'spam' );
170 $site->removePath(
'foobar' );
172 $this->assertEquals( $count, count( $site->getAllPaths() ) );
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/';
225 $site->setPath(
$type, $path );
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 );
286 $this->assertInstanceOf(
'Serializable', $site );
291 $this->assertInstanceOf(
'Site', $newInstance );
293 $this->assertEquals( $serialization,
serialize( $newInstance ) );
unserialize( $serialized)
testGetGlobalId(Site $site)
instanceProvider
assertTypeOrFalse( $type, $value)
testGetLanguageCode(Site $site)
instanceProvider
testProtocolRelativePath()
Site::setPath Site::getProtocol.
testNormalizePageName(Site $site)
instanceProvider
testSetLanguageCode(Site $site)
instanceProvider
testGetAllPaths(Site $site)
instanceProvider
testAddInterwikiId(Site $site)
instanceProvider
testGetPageUrl( $path, $page, $expected)
provideGetPageUrl Site::getPageUrl
testGetNavigationIds(Site $site)
instanceProvider
testGetLinkPathType()
Site::getLinkPathType.
testSetLinkPath()
Site::setLinkPath.
static provideGetPageUrl()
testGetType(Site $site)
instanceProvider
testSetAndRemovePath(Site $site)
instanceProvider
testSetPath()
Site::setPath.
testGetInterwikiIds(Site $site)
instanceProvider
testGetPath(Site $site)
instanceProvider
testSerialization(Site $site)
instanceProvider
testSetGlobalId(Site $site)
instanceProvider
testAddNavigationId(Site $site)
instanceProvider
getPath( $pathType)
Returns the path of the provided type or false if there is no such path.
getGlobalId()
Returns the global site identifier (ie enwiktionary).
getLanguageCode()
Returns language code of the sites primary language.