8 use MediaWikiCoversValidator;
12 'http' => [
'foo.bar',
'http://foo.bar' ],
13 'https' => [
'foo.bar',
'http://foo.bar' ],
16 'invalid' => [
'purple kittens',
'purple kittens' ],
24 $reference =
new WikiReference( $canonicalServer,
'/wiki/$1' );
25 $this->assertEquals( $expected, $reference->getDisplayName() );
29 $reference =
new WikiReference(
'https://acme.com',
'/wiki/$1',
'//acme.com' );
30 $this->assertEquals(
'https://acme.com', $reference->getCanonicalServer() );
36 'https://acme.com/wiki/Foo',
44 'https://acme.com/wiki/Foo',
52 'https://acme.com/wiki/Foo#Bar',
59 'double fragment' => [
60 'https://acme.com/wiki/Foo#Bar%23Xus',
67 'escaped fragment' => [
68 'https://acme.com/wiki/Foo%23Bar',
76 'https://acme.com/Foo',
90 $expected, $canonicalServer, $server, $path, $page, $fragmentId
92 $reference =
new WikiReference( $canonicalServer, $path, $server );
93 $this->assertEquals( $expected, $reference->getCanonicalUrl( $page, $fragmentId ) );
100 public function testGetUrl( $expected, $canonicalServer, $server, $path, $page, $fragmentId ) {
101 $reference =
new WikiReference( $canonicalServer, $path, $server );
102 $this->assertEquals( $expected, $reference->getUrl( $page, $fragmentId ) );
108 '//acme.com/wiki/Foo',
115 'empty fragment' => [
116 '//acme.com/wiki/Foo',
124 '//acme.com/wiki/Foo#Bar',
131 'double fragment' => [
132 '//acme.com/wiki/Foo#Bar%23Xus',
139 'escaped fragment' => [
140 '//acme.com/wiki/Foo%23Bar',
161 public function testGetFullUrl( $expected, $canonicalServer, $server, $path, $page, $fragmentId ) {
162 $reference =
new WikiReference( $canonicalServer, $path, $server );
163 $this->assertEquals( $expected, $reference->getFullUrl( $page, $fragmentId ) );
testGetUrl( $expected, $canonicalServer, $server, $path, $page, $fragmentId)
provideGetCanonicalUrl
testGetFullUrl( $expected, $canonicalServer, $server, $path, $page, $fragmentId)
provideGetFullUrl
testGetCanonicalUrl( $expected, $canonicalServer, $server, $path, $page, $fragmentId)
provideGetCanonicalUrl
testGetDisplayName( $expected, $canonicalServer)
provideGetDisplayName
Reference to a locally-hosted wiki.