Ejemplo n.º 1
0
 public function testConstructorWithoutCache()
 {
     $this->cache->expects($this->once())->method('test')->with($this->cacheId)->will($this->returnValue(false));
     $this->cache->expects($this->once())->method('load')->with($this->cacheId)->will($this->returnValue(false));
     $this->reader->expects($this->once())->method('read')->will($this->returnValue($this->indexers));
     $stateExistent = $this->getMock('Magento\\Indexer\\Model\\Indexer\\State', ['getIndexerId', '__wakeup', 'delete'], [], '', false);
     $stateExistent->expects($this->once())->method('getIndexerId')->will($this->returnValue('indexer1'));
     $stateExistent->expects($this->never())->method('delete');
     $stateNonexistent = $this->getMock('Magento\\Indexer\\Model\\Indexer\\State', ['getIndexerId', '__wakeup', 'delete'], [], '', false);
     $stateNonexistent->expects($this->once())->method('getIndexerId')->will($this->returnValue('indexer2'));
     $stateNonexistent->expects($this->once())->method('delete');
     $states = [$stateExistent, $stateNonexistent];
     $this->stateCollection->expects($this->once())->method('getItems')->will($this->returnValue($states));
     $this->model = new \Magento\Indexer\Model\Config\Data($this->reader, $this->cache, $this->stateCollection, $this->cacheId);
 }