* @group Database
*/
class PrefixSearchTest extends MediaWikiLangTestCase {
+ private $originalHandlers;
public function addDBDataOnce() {
if ( !$this->isWikitextNS( NS_MAIN ) ) {
}
// Avoid special pages from extensions interferring with the tests
- $this->setMwGlobals( 'wgSpecialPages', [] );
+ $this->setMwGlobals( [
+ 'wgSpecialPages' => [],
+ 'wgHooks' => [],
+ ] );
+
+ $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 ) {
* @group Database
*/
class SearchEnginePrefixTest extends MediaWikiLangTestCase {
+ private $originalHandlers;
/**
* @var SearchEngine
}
// Avoid special pages from extensions interferring with the tests
- $this->setMwGlobals( 'wgSpecialPages', [] );
+ $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 ) {