X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Ftitle%2FNamespaceAwareForeignTitleFactoryTest.php;h=520108aac1aa0cfc3997e616148c9361c63aad48;hp=9cb195cc380b070750511c7d352c881885e5ed0a;hb=22806b0a4509e97b56fb52b387e17e3c80fb7eb2;hpb=c864eab8209c98b86c314041fde48bfb2d8ee533 diff --git a/tests/phpunit/includes/title/NamespaceAwareForeignTitleFactoryTest.php b/tests/phpunit/includes/title/NamespaceAwareForeignTitleFactoryTest.php index 9cb195cc38..520108aac1 100644 --- a/tests/phpunit/includes/title/NamespaceAwareForeignTitleFactoryTest.php +++ b/tests/phpunit/includes/title/NamespaceAwareForeignTitleFactoryTest.php @@ -27,36 +27,49 @@ class NamespaceAwareForeignTitleFactoryTest extends MediaWikiTestCase { public function basicProvider() { - return array( - array( + return [ + [ 'MainNamespaceArticle', 0, new ForeignTitle( 0, '', 'MainNamespaceArticle' ), - ), - array( + ], + [ 'MainNamespaceArticle', null, new ForeignTitle( 0, '', 'MainNamespaceArticle' ), - ), - array( + ], + [ + 'Magic:_The_Gathering', 0, + new ForeignTitle( 0, '', 'Magic:_The_Gathering' ), + ], + [ 'Talk:Nice_talk', 1, new ForeignTitle( 1, 'Talk', 'Nice_talk' ), - ), - array( + ], + [ + 'Talk:Magic:_The_Gathering', 1, + new ForeignTitle( 1, 'Talk', 'Magic:_The_Gathering' ), + ], + [ 'Bogus:Nice_talk', 0, new ForeignTitle( 0, '', 'Bogus:Nice_talk' ), - ), - array( + ], + [ 'Bogus:Nice_talk', null, new ForeignTitle( 9000, 'Bogus', 'Nice_talk' ), - ), - array( + ], + [ 'Bogus:Nice_talk', 4, new ForeignTitle( 4, 'Bogus', 'Nice_talk' ), - ), - array( + ], + [ 'Bogus:Nice_talk', 1, new ForeignTitle( 1, 'Talk', 'Nice_talk' ), - ), - ); + ], + // Misconfigured wiki with unregistered namespace (T114115) + [ + 'Nice_talk', 1234, + new ForeignTitle( 1234, 'Ns1234', 'Nice_talk' ), + ], + ]; } /** @@ -64,9 +77,9 @@ class NamespaceAwareForeignTitleFactoryTest extends MediaWikiTestCase { */ public function testBasic( $title, $ns, ForeignTitle $foreignTitle ) { - $foreignNamespaces = array( + $foreignNamespaces = [ 0 => '', 1 => 'Talk', 100 => 'Portal', 9000 => 'Bogus' - ); + ]; $factory = new NamespaceAwareForeignTitleFactory( $foreignNamespaces ); $testTitle = $factory->createForeignTitle( $title, $ns );