public function testSaveDeleteFromCaceh()
 {
     $connection = $this->getMockBuilder('\\SMW\\MediaWiki\\Database')->disableOriginalConstructor()->getMock();
     $connection->expects($this->once())->method('selectRow')->will($this->returnValue(false));
     $instance = new DataItemByIdFinder($connection, 'foo');
     $instance->saveToCache(42, 'Foo#14##');
     $instance->getDataItemForId(42);
     $instance->deleteFromCache(42);
     $instance->getDataItemForId(42);
 }
 /**
  * Remove any cache entry for the given data. The key consists of the
  * parameters $title, $namespace, $interwiki, and $subobject. The
  * cached data is $id and $sortkey.
  *
  * @since 1.8
  * @param string $title
  * @param integer $namespace
  * @param string $interwiki
  * @param string $subobject
  */
 public function deleteCache($title, $namespace, $interwiki, $subobject)
 {
     if ($namespace == SMW_NS_PROPERTY && $interwiki === '' && $subobject === '') {
         $id = isset($this->prop_ids[$title]) ? $this->prop_ids[$title] : 0;
         unset($this->prop_ids[$title]);
         unset($this->prop_sortkeys[$title]);
     } else {
         $hashKey = HashBuilder::createHashIdFromSegments($title, $namespace, $interwiki, $subobject);
         $id = isset($this->regular_ids[$hashKey]) ? $this->regular_ids[$hashKey] : 0;
         unset($this->regular_ids[$hashKey]);
         unset($this->regular_sortkeys[$hashKey]);
     }
     $this->dataItemByIdFinder->deleteFromCache($id);
 }