public function testGetPropertySubjectsFromCacheForAvailableHash()
 {
     $expected = array(new DIWikiPage('Bar', NS_MAIN));
     $dataItem = new DIWikiPage('Foo', NS_MAIN);
     $circularReferenceGuard = $this->getMockBuilder('\\SMW\\CircularReferenceGuard')->disableOriginalConstructor()->getMock();
     $store = $this->getMockBuilder('\\SMW\\SQLStore\\SQLStore')->disableOriginalConstructor()->getMock();
     $store->expects($this->never())->method('getRedirectTarget');
     $container = $this->getMockBuilder('\\Onoi\\BlobStore\\Container')->disableOriginalConstructor()->getMock();
     $container->expects($this->once())->method('has')->will($this->returnValue(true));
     $container->expects($this->once())->method('get')->with($this->stringContains('ps:'))->will($this->returnValue($expected));
     $blobStore = $this->getMockBuilder('\\Onoi\\BlobStore\\BlobStore')->disableOriginalConstructor()->getMock();
     $blobStore->expects($this->once())->method('canUse')->will($this->returnValue(true));
     $blobStore->expects($this->once())->method('read')->will($this->returnValue($container));
     $instance = new CachedValueLookupStore($store, $blobStore);
     $instance->setCircularReferenceGuard($circularReferenceGuard);
     $instance->setValueLookupFeatures(SMW_VL_PS);
     $this->assertEquals($expected, $instance->getPropertySubjects(new DIProperty('Foobar'), $dataItem));
 }
 /**
  * @since 2.3
  *
  * @return CachedValueLookupStore
  */
 public function newCachedValueLookupStore()
 {
     $circularReferenceGuard = new CircularReferenceGuard('vl:store');
     $circularReferenceGuard->setMaxRecursionDepth(2);
     $cacheFactory = ApplicationFactory::getInstance()->newCacheFactory();
     $blobStore = new BlobStore('smw:vl:store', $cacheFactory->newMediaWikiCompositeCache($GLOBALS['smwgValueLookupCacheType']));
     // If CACHE_NONE is selected, disable the usage
     $blobStore->setUsageState($GLOBALS['smwgValueLookupCacheType'] !== CACHE_NONE);
     $blobStore->setExpiryInSeconds($GLOBALS['smwgValueLookupCacheLifetime']);
     $blobStore->setNamespacePrefix($cacheFactory->getCachePrefix());
     $cachedValueLookupStore = new CachedValueLookupStore($this->store, $blobStore);
     $cachedValueLookupStore->setValueLookupFeatures($GLOBALS['smwgValueLookupFeatures']);
     $cachedValueLookupStore->setCircularReferenceGuard($circularReferenceGuard);
     return $cachedValueLookupStore;
 }