applicationFactory = ApplicationFactory::getInstance(); $this->mwHooksHandler = UtilityFactory::getInstance()->newMwHooksHandler(); $this->mwHooksHandler->deregisterListedHooks(); $this->mwHooksHandler->register( 'ParserAfterTidy', $this->mwHooksHandler->getHookRegistry()->getHandlerFor( 'ParserAfterTidy' ) ); } protected function tearDown(): void { $this->mwHooksHandler->restoreListedHooks(); $this->applicationFactory->clear(); parent::tearDown(); } public function testNonParseForInvokedMessageParse() { $parserData = $this->getMockBuilder( '\SMW\ParserData' ) ->disableOriginalConstructor() ->getMock(); $parserData->expects( $this->never() ) ->method( 'getSemanticData' ); $this->applicationFactory->registerObject( 'ParserData', $parserData ); wfMessage( 'properties' )->parse(); } }