11 'http' => [
'foo.bar',
'http://foo.bar' ],
12 'https' => [
'foo.bar',
'http://foo.bar' ],
15 'invalid' => [
'purple kittens',
'purple kittens' ],
23 $reference =
new WikiReference( $canonicalServer,
'/wiki/$1' );
24 $this->assertEquals( $expected, $reference->getDisplayName() );
28 $reference =
new WikiReference(
'https://acme.com',
'/wiki/$1',
'//acme.com' );
29 $this->assertEquals(
'https://acme.com', $reference->getCanonicalServer() );
35 'https://acme.com/wiki/Foo',
43 'https://acme.com/wiki/Foo',
51 'https://acme.com/wiki/Foo#Bar',
58 'double fragment' => [
59 'https://acme.com/wiki/Foo#Bar%23Xus',
66 'escaped fragment' => [
67 'https://acme.com/wiki/Foo%23Bar',
75 'https://acme.com/Foo',
89 $expected, $canonicalServer, $server,
$path, $page, $fragmentId
92 $this->assertEquals( $expected, $reference->getCanonicalUrl( $page, $fragmentId ) );
99 public function testGetUrl( $expected, $canonicalServer, $server,
$path, $page, $fragmentId ) {
101 $this->assertEquals( $expected, $reference->getUrl( $page, $fragmentId ) );
107 '//acme.com/wiki/Foo',
114 'empty fragment' => [
115 '//acme.com/wiki/Foo',
123 '//acme.com/wiki/Foo#Bar',
130 'double fragment' => [
131 '//acme.com/wiki/Foo#Bar%23Xus',
138 'escaped fragment' => [
139 '//acme.com/wiki/Foo%23Bar',
162 $this->assertEquals( $expected, $reference->getFullUrl( $page, $fragmentId ) );