X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FWikiMapTest.php;h=12878b37ed26257021a8ce284897adc11d2ec13b;hb=b5875a1fbca83f32cb5a160685ab6474d5a552a7;hp=e86559e7d89fe8d438c15a1637dddd7b827a7f16;hpb=557c331645173b60171e1cbcc9b921e39de9710b;p=lhc%2Fweb%2Fwiklou.git
diff --git a/tests/phpunit/includes/WikiMapTest.php b/tests/phpunit/includes/WikiMapTest.php
index e86559e7d8..12878b37ed 100644
--- a/tests/phpunit/includes/WikiMapTest.php
+++ b/tests/phpunit/includes/WikiMapTest.php
@@ -11,20 +11,21 @@ class WikiMapTest extends MediaWikiLangTestCase {
parent::setUp();
$conf = new SiteConfiguration();
- $conf->settings = array(
- 'wgServer' => array(
+ $conf->settings = [
+ 'wgServer' => [
'enwiki' => 'http://en.example.org',
'ruwiki' => '//ru.example.org',
- ),
- 'wgArticlePath' => array(
+ 'nopathwiki' => '//nopath.example.org',
+ ],
+ 'wgArticlePath' => [
'enwiki' => '/w/$1',
'ruwiki' => '/wiki/$1',
- ),
- );
- $conf->suffixes = array( 'wiki' );
- $this->setMwGlobals( array(
+ ],
+ ];
+ $conf->suffixes = [ 'wiki' ];
+ $this->setMwGlobals( [
'wgConf' => $conf,
- ) );
+ ] );
TestSites::insertIntoDb();
}
@@ -39,14 +40,16 @@ class WikiMapTest extends MediaWikiLangTestCase {
// enwiktionary doesn't have an interwiki id, thus this falls back to minor = lang code
$enwiktionary = new WikiReference( 'https://en.wiktionary.org', '/wiki/$1' );
- return array(
- 'unknown' => array( null, 'xyzzy' ),
- 'enwiki (wgConf)' => array( $enwiki, 'enwiki' ),
- 'ruwiki (wgConf)' => array( $ruwiki, 'ruwiki' ),
- 'nlwiki (sites)' => array( $nlwiki, 'nlwiki', false ),
- 'enwiktionary (sites)' => array( $enwiktionary, 'enwiktionary', false ),
- 'non MediaWiki site' => array( null, 'spam', false ),
- );
+ return [
+ 'unknown' => [ null, 'xyzzy' ],
+ 'enwiki (wgConf)' => [ $enwiki, 'enwiki' ],
+ 'ruwiki (wgConf)' => [ $ruwiki, 'ruwiki' ],
+ 'nlwiki (sites)' => [ $nlwiki, 'nlwiki', false ],
+ 'enwiktionary (sites)' => [ $enwiktionary, 'enwiktionary', false ],
+ 'non MediaWiki site' => [ null, 'spam', false ],
+ 'boguswiki' => [ null, 'boguswiki' ],
+ 'nopathwiki' => [ null, 'nopathwiki' ],
+ ];
}
/**
@@ -54,21 +57,21 @@ class WikiMapTest extends MediaWikiLangTestCase {
*/
public function testGetWiki( $expected, $wikiId, $useWgConf = true ) {
if ( !$useWgConf ) {
- $this->setMwGlobals( array(
+ $this->setMwGlobals( [
'wgConf' => new SiteConfiguration(),
- ) );
+ ] );
}
$this->assertEquals( $expected, WikiMap::getWiki( $wikiId ) );
}
public function provideGetWikiName() {
- return array(
- 'unknown' => array( 'xyzzy', 'xyzzy' ),
- 'enwiki' => array( 'en.example.org', 'enwiki' ),
- 'ruwiki' => array( 'ru.example.org', 'ruwiki' ),
- 'enwiktionary (sites)' => array( 'en.wiktionary.org', 'enwiktionary' ),
- );
+ return [
+ 'unknown' => [ 'xyzzy', 'xyzzy' ],
+ 'enwiki' => [ 'en.example.org', 'enwiki' ],
+ 'ruwiki' => [ 'ru.example.org', 'ruwiki' ],
+ 'enwiktionary (sites)' => [ 'en.wiktionary.org', 'enwiktionary' ],
+ ];
}
/**
@@ -79,29 +82,29 @@ class WikiMapTest extends MediaWikiLangTestCase {
}
public function provideMakeForeignLink() {
- return array(
- 'unknown' => array( false, 'xyzzy', 'Foo' ),
- 'enwiki' => array(
+ return [
+ 'unknown' => [ false, 'xyzzy', 'Foo' ],
+ 'enwiki' => [
'Foo',
'enwiki',
'Foo'
- ),
- 'ruwiki' => array(
+ ],
+ 'ruwiki' => [
'ваÑ',
'ruwiki',
'ФÑ',
'ваÑ'
- ),
- 'enwiktionary (sites)' => array(
+ ],
+ 'enwiktionary (sites)' => [
'Kittens!',
'enwiktionary',
'Kitten',
'Kittens!'
- ),
- );
+ ],
+ ];
}
/**
@@ -115,29 +118,29 @@ class WikiMapTest extends MediaWikiLangTestCase {
}
public function provideForeignUserLink() {
- return array(
- 'unknown' => array( false, 'xyzzy', 'Foo' ),
- 'enwiki' => array(
+ return [
+ 'unknown' => [ false, 'xyzzy', 'Foo' ],
+ 'enwiki' => [
'User:Foo',
'enwiki',
'Foo'
- ),
- 'ruwiki' => array(
+ ],
+ 'ruwiki' => [
'ваÑ',
'ruwiki',
'ФÑ',
'ваÑ'
- ),
- 'enwiktionary (sites)' => array(
+ ],
+ 'enwiktionary (sites)' => [
'Whatever',
'enwiktionary',
'Dummy',
'Whatever'
- ),
- );
+ ],
+ ];
}
/**
@@ -148,21 +151,21 @@ class WikiMapTest extends MediaWikiLangTestCase {
}
public function provideGetForeignURL() {
- return array(
- 'unknown' => array( false, 'xyzzy', 'Foo' ),
- 'enwiki' => array( 'http://en.example.org/w/Foo', 'enwiki', 'Foo' ),
- 'enwiktionary (sites)' => array(
+ return [
+ 'unknown' => [ false, 'xyzzy', 'Foo' ],
+ 'enwiki' => [ 'http://en.example.org/w/Foo', 'enwiki', 'Foo' ],
+ 'enwiktionary (sites)' => [
'https://en.wiktionary.org/wiki/Testme',
'enwiktionary',
'Testme'
- ),
- 'ruwiki with fragment' => array(
+ ],
+ 'ruwiki with fragment' => [
'//ru.example.org/wiki/%D0%A4%D1%83#%D0%B2%D0%B0%D1%80',
'ruwiki',
'ФÑ',
'ваÑ'
- ),
- );
+ ],
+ ];
}
/**