/** * @dataProvider textDataProvider */ public function testTextParseForDisabledCapitalLinks($parameters, $expected) { $wgCapitalLinks = $GLOBALS['wgCapitalLinks']; $GLOBALS['wgCapitalLinks'] = false; $instance = new ContentParser($parameters['title'], ParserFactory::newFromTitle($parameters['title'])); $instance->parse($parameters['text']); $this->assertInstanceAfterParse($instance); $this->assertSemanticDataAfterParse($instance, $expected); $GLOBALS['wgCapitalLinks'] = $wgCapitalLinks; }
/** * @dataProvider textToParseProvider */ public function testParseWithParserFunctionDisabled($parserName, $text) { $expectedNullOutputFor = array('concept', 'declare', 'ask', 'show'); $title = Title::newFromText(__METHOD__); $parser = $this->parserFactory->newFromTitle($title); $this->testEnvironment->addConfiguration('smwgQEnabled', false); $instance = new ContentParser($title, $parser); $instance->parse($text); if (in_array($parserName, $expectedNullOutputFor)) { return $this->assertNull($this->findSemanticataFromOutput($instance->getOutput())); } $this->assertInstanceOf('\\SMW\\SemanticData', $this->findSemanticataFromOutput($instance->getOutput())); }
/** * @since 2.0 * * @param mixed $title * * @return PageRefresher */ public function doRefresh($title) { if ($title instanceof WikiPage || $title instanceof DIWikiPage) { $title = $title->getTitle(); } if (!$title instanceof Title) { throw new RuntimeException('Expected a title instance'); } $contentParser = new ContentParser($title); $contentParser->forceToUseParser(); $parserData = ApplicationFactory::getInstance()->newParserData($title, $contentParser->parse()->getOutput()); $parserData->updateStore(); return $this; }
protected function retrieveAndLoadData($revId = null) { $revision = $revId ? Revision::newFromId($revId) : null; $contentParser = new ContentParser($this->title); $parserOutput = $contentParser->setRevision($revision)->parse()->getOutput(); if ($parserOutput instanceof ParserOutput) { return new ParserData($this->title, $parserOutput); } throw new UnexpectedValueException('ParserOutput is missing'); }