Merge "Fix 'Tags' padding to keep it farther from the edge and document the source...
[lhc/web/wiklou.git] / tests / phpunit / includes / PrefixSearchTest.php
index a6cf14a..3bde5de 100644 (file)
@@ -58,20 +58,23 @@ class PrefixSearchTest extends MediaWikiLangTestCase {
                        'wgCapitalLinkOverrides' => [ self::NS_NONCAP => false ],
                ] );
 
-               $this->originalHandlers = TestingAccessWrapper::newFromClass( 'Hooks' )->handlers;
-               TestingAccessWrapper::newFromClass( 'Hooks' )->handlers = [];
+               $this->originalHandlers = TestingAccessWrapper::newFromClass( Hooks::class )->handlers;
+               TestingAccessWrapper::newFromClass( Hooks::class )->handlers = [];
 
                // Clear caches so that our new namespace appears
-               MWNamespace::getCanonicalNamespaces( true );
+               MWNamespace::clearCaches();
                Language::factory( 'en' )->resetNamespaces();
 
                SpecialPageFactory::resetList();
        }
 
        public function tearDown() {
+               MWNamespace::clearCaches();
+               Language::factory( 'en' )->resetNamespaces();
+
                parent::tearDown();
 
-               TestingAccessWrapper::newFromClass( 'Hooks' )->handlers = $this->originalHandlers;
+               TestingAccessWrapper::newFromClass( Hooks::class )->handlers = $this->originalHandlers;
 
                SpecialPageFactory::resetList();
        }
@@ -208,7 +211,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 +235,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 );