示例#1
0
 /**
  * @expectedException \Zend_Cache_Exception
  */
 public function testSetBackendException()
 {
     $mockBackend = $this->getMock('Zend_Cache_Backend_File');
     $config = array('backend_decorators' => array('test_decorator' => array('class' => 'Zend_Cache_Backend')));
     $core = new \Magento\Framework\Cache\Core($config);
     $core->setBackend($mockBackend);
 }
示例#2
0
 public function testGetIdsNotMatchingTags()
 {
     $tags = ['abc', '!def', '_ghi'];
     $prefix = 'prefix_';
     $prefixedTags = ['prefix_abc', 'prefix__def', 'prefix__ghi'];
     $ids = ['id', 'id2', 'id3'];
     $backendMock = $this->getMock('Magento\\Framework\\Cache\\CoreMock');
     $backendMock->expects($this->once())->method('getIdsNotMatchingTags')->with($prefixedTags)->will($this->returnValue($ids));
     $backendMock->expects($this->any())->method('getCapabilities')->will($this->returnValue(['tags' => true]));
     $frontend = new \Magento\Framework\Cache\Core(['caching' => true, 'cache_id_prefix' => $prefix]);
     $frontend->setBackend($backendMock);
     $result = $frontend->getIdsNotMatchingTags($tags);
     $this->assertEquals($ids, $result);
 }