X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fsearch%2FSearchEnginePrefixTest.php;h=e0de58866f377fe9245d1f0e3fe3e9b6f82ee1f9;hb=f43fa6f4f0e2cb60b8543daad661b48a3e0653a9;hp=2a3a5fe9cffe58834a8ac7542378fc0ddb81fc21;hpb=f9d7d3b8561dab3ddfd8798a77a5b72e03ac8c2b;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/search/SearchEnginePrefixTest.php b/tests/phpunit/includes/search/SearchEnginePrefixTest.php index 2a3a5fe9cf..e0de58866f 100644 --- a/tests/phpunit/includes/search/SearchEnginePrefixTest.php +++ b/tests/phpunit/includes/search/SearchEnginePrefixTest.php @@ -1,16 +1,19 @@ isWikitextNS( NS_MAIN ) ) { // tests are skipped if NS_MAIN is not wikitext return; @@ -45,9 +48,26 @@ class SearchEnginePrefixTest extends MediaWikiLangTestCase { } // Avoid special pages from extensions interferring with the tests - $this->setMwGlobals( 'wgSpecialPages', [] ); - $this->search = SearchEngine::create(); + $this->setMwGlobals( [ + 'wgSpecialPages' => [], + 'wgHooks' => [], + ] ); + + $this->search = MediaWikiServices::getInstance()->newSearchEngine(); $this->search->setNamespaces( [] ); + + $this->originalHandlers = TestingAccessWrapper::newFromClass( 'Hooks' )->handlers; + TestingAccessWrapper::newFromClass( 'Hooks' )->handlers = []; + + SpecialPageFactory::resetList(); + } + + public function tearDown() { + parent::tearDown(); + + TestingAccessWrapper::newFromClass( 'Hooks' )->handlers = $this->originalHandlers; + + SpecialPageFactory::resetList(); } protected function searchProvision( array $results = null ) {