X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles_versions%22%2C%22id_article=%24id_article%22%29%20.%20%22?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FPrefixSearchTest.php;h=98ec7e027c4bb964de7934af63d721708d849601;hb=63d7f2ad1345453dc16f16493fc7e5524219cfb8;hp=a6cf14a3adce8f308187b078007d91519101f514;hpb=89539f2aa1b158fdcc703ad053e2580cb97a6385;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/PrefixSearchTest.php b/tests/phpunit/includes/PrefixSearchTest.php index a6cf14a3ad..98ec7e027c 100644 --- a/tests/phpunit/includes/PrefixSearchTest.php +++ b/tests/phpunit/includes/PrefixSearchTest.php @@ -50,7 +50,7 @@ class PrefixSearchTest extends MediaWikiLangTestCase { $this->markTestSkipped( 'Main namespace does not support wikitext.' ); } - // Avoid special pages from extensions interferring with the tests + // Avoid special pages from extensions interfering with the tests $this->setMwGlobals( [ 'wgSpecialPages' => [], 'wgHooks' => [], @@ -58,12 +58,8 @@ class PrefixSearchTest extends MediaWikiLangTestCase { 'wgCapitalLinkOverrides' => [ self::NS_NONCAP => false ], ] ); - $this->originalHandlers = TestingAccessWrapper::newFromClass( 'Hooks' )->handlers; - TestingAccessWrapper::newFromClass( 'Hooks' )->handlers = []; - - // Clear caches so that our new namespace appears - MWNamespace::getCanonicalNamespaces( true ); - Language::factory( 'en' )->resetNamespaces(); + $this->originalHandlers = TestingAccessWrapper::newFromClass( Hooks::class )->handlers; + TestingAccessWrapper::newFromClass( Hooks::class )->handlers = []; SpecialPageFactory::resetList(); } @@ -71,7 +67,7 @@ class PrefixSearchTest extends MediaWikiLangTestCase { public function tearDown() { parent::tearDown(); - TestingAccessWrapper::newFromClass( 'Hooks' )->handlers = $this->originalHandlers; + TestingAccessWrapper::newFromClass( Hooks::class )->handlers = $this->originalHandlers; SpecialPageFactory::resetList(); } @@ -208,7 +204,7 @@ class PrefixSearchTest extends MediaWikiLangTestCase { public function testSearch( array $case ) { $this->searchProvision( null ); - $namespaces = isset( $case['namespaces'] ) ? $case['namespaces'] : []; + $namespaces = $case['namespaces'] ?? []; if ( wfGetDB( DB_REPLICA )->getType() === 'postgres' ) { // Postgres will sort lexicographically on utf8 code units (" " before "/") @@ -232,7 +228,7 @@ class PrefixSearchTest extends MediaWikiLangTestCase { public function testSearchWithOffset( array $case ) { $this->searchProvision( null ); - $namespaces = isset( $case['namespaces'] ) ? $case['namespaces'] : []; + $namespaces = $case['namespaces'] ?? []; $searcher = new StringPrefixSearch; $results = $searcher->search( $case['query'], 3, $namespaces, 1 );