Exemplo n.º 1
0
 /**
  * @dataProvider titleDataProvider
  */
 public function testProcess($setup, $expected)
 {
     $wikiPage = new WikiPage($setup['title']);
     $pageId = $wikiPage->getTitle()->getArticleID();
     ApplicationFactory::getInstance()->registerObject('Settings', Settings::newFromArray(array('smwgCacheType' => 'hash', 'smwgAutoRefreshOnPurge' => $setup['smwgAutoRefreshOnPurge'], 'smwgFactboxCacheRefreshOnPurge' => $setup['smwgFactboxCacheRefreshOnPurge'])));
     $instance = new ArticlePurge($wikiPage);
     $cache = ApplicationFactory::getInstance()->getCache();
     $id = FactboxCache::newCacheId($pageId);
     //	$cache->setKey( $id )->set( true );
     $this->assertEquals($expected['autorefreshPreProcess'], $cache->setKey($instance->newCacheId($pageId))->get(), 'Asserts the autorefresh cache status before processing');
     // Travis 210.5, 305.3
     $travis = $cache->setKey($id)->get();
     $travisText = json_encode($travis);
     $this->assertEquals($expected['factboxPreProcess'], $travis, "Asserts the factbox cache status before processing, {$travisText}");
     $this->assertFalse($cache->setKey($instance->newCacheId($pageId))->get(), 'Asserts that before processing ...');
     $result = $instance->process();
     // Post-process check
     $this->assertTrue($result, 'Asserts that process() always returns true');
     $this->assertEquals($expected['autorefreshPostProcess'], $cache->setKey($instance->newCacheId($pageId))->get(), 'Asserts the autorefresh cache status after processing');
     $this->assertEquals($expected['factboxPostProcess'], $cache->setCacheEnabled(true)->setKey($id)->get(), 'Asserts the factbox cache status after processing');
 }
Exemplo n.º 2
0
 public function testNewCacheId()
 {
     $this->assertInstanceOf('\\SMW\\CacheIdGenerator', FactboxCache::newCacheId(9001));
 }
Exemplo n.º 3
0
 private function updateStore(ParserOutput $parserOutput)
 {
     $cache = ApplicationFactory::getInstance()->getCache();
     $cache->setKey(FactboxCache::newCacheId($this->getTitle()->getArticleID()))->delete();
     // TODO
     // Rebuild the factbox
     $parserData = ApplicationFactory::getInstance()->newParserData($this->getTitle(), $parserOutput);
     // Set a different updateIndentifier to ensure that the updateJob
     // will force a comparison of old/new data during the store update
     $parserData->getSemanticData()->setUpdateIdentifier('update-job');
     $parserData->disableBackgroundUpdateJobs()->updateStore();
     return true;
 }