35 'wgCapitalLinks' =>
true,
39 $site->setGlobalId(
'enwiki' );
44 $this->assertEquals(
'Foo', $site->normalizePageName(
' foo ' ) );
50 [
'https://en.wikipedia.org',
'/w/$1',
'api.php',
'https://en.wikipedia.org/w/api.php' ],
51 [
'https://en.wikipedia.org',
'/w/',
'api.php',
'https://en.wikipedia.org/w/' ],
53 'https://en.wikipedia.org',
54 '/foo/page.php?name=$1',
56 'https://en.wikipedia.org/foo/page.php?name=api.php'
59 'https://en.wikipedia.org',
62 'https://en.wikipedia.org/w/'
65 'https://en.wikipedia.org',
68 'https://en.wikipedia.org/w/foo/bar/api.php'
77 public function testGetFileUrl( $url, $filePath, $pathArgument, $expected ) {
79 $site->setFilePath( $url . $filePath );
81 $this->assertEquals( $expected, $site->getFileUrl( $pathArgument ) );
87 [
'http://acme.test/wiki/$1',
'Berlin',
'/wiki/Berlin' ],
88 [
'http://acme.test/wiki/',
'Berlin',
'/wiki/' ],
89 [
'http://acme.test/w/index.php?title=$1',
'Berlin',
'/w/index.php?title=Berlin' ],
90 [
'http://acme.test/wiki/$1',
'',
'/wiki/' ],
91 [
'http://acme.test/wiki/$1',
'Berlin/sub page',
'/wiki/Berlin/sub_page' ],
92 [
'http://acme.test/wiki/$1',
'Cork (city) ',
'/Cork_(city)' ],
93 [
'http://acme.test/wiki/$1',
'M&M',
'/wiki/M%26M' ],
103 $site->setLinkPath( $path );
105 $this->assertContains( $path, $site->getPageUrl() );
106 $this->assertContains( $expected, $site->getPageUrl( $page ) );