Пример #1
0
 /**
  * @param Title|SMWWikiPageValue|DIWikiPage $concept
  *
  * @return DIConcept|null
  */
 public function getStatus($concept)
 {
     $db = $this->store->getConnection();
     $cid = $this->store->smwIds->getSMWPageID($concept->getDBkey(), $concept->getNamespace(), '', '', false);
     // TODO: catch db exception
     $row = $db->selectRow('smw_fpt_conc', array('concept_txt', 'concept_features', 'concept_size', 'concept_depth', 'cache_date', 'cache_count'), array('s_id' => $cid), __METHOD__);
     if ($row === false) {
         return null;
     }
     $dataItem = new DIConcept($concept, null, $row->concept_features, $row->concept_size, $row->concept_depth);
     if ($row->cache_date) {
         $dataItem->setCacheStatus('full');
         $dataItem->setCacheDate($row->cache_date);
         $dataItem->setCacheCount($row->cache_count);
     } else {
         $dataItem->setCacheStatus('empty');
     }
     return $dataItem;
 }
 /**
  * @dataProvider actionProvider
  */
 public function testRebuildSingleFullConceptOnMockStore($action)
 {
     $concept = new DIConcept('Foo', '', '', '', '');
     $concept->setCacheStatus('full');
     $concept->setCacheDate('1358515326');
     $concept->setCacheCount('1000');
     $instance = $this->acquireInstanceFor($concept);
     $instance->setParameters(array($action => true, 'old' => 10, 'concept' => 'Bar'));
     $this->assertTrue($instance->rebuild());
 }