Пример #1
0
 /**
  * Delete all states that are not in configuration
  *
  * @return void
  */
 protected function deleteNonexistentStates()
 {
     foreach ($this->stateCollection->getItems() as $state) {
         /** @var \Magento\Framework\Mview\View\StateInterface $state */
         if (!isset($this->_data[$state->getViewId()])) {
             $state->delete();
         }
     }
 }
Пример #2
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->views));
     $stateExistent = $this->getMock('Magento\\Framework\\Mview\\Indexer\\State', ['getViewId', '__wakeup', 'delete'], [], '', false);
     $stateExistent->expects($this->once())->method('getViewId')->will($this->returnValue('view1'));
     $stateExistent->expects($this->never())->method('delete');
     $stateNonexistent = $this->getMock('Magento\\Framework\\Mview\\Indexer\\State', ['getViewId', '__wakeup', 'delete'], [], '', false);
     $stateNonexistent->expects($this->once())->method('getViewId')->will($this->returnValue('view2'));
     $stateNonexistent->expects($this->once())->method('delete');
     $states = [$stateExistent, $stateNonexistent];
     $this->stateCollection->expects($this->once())->method('getItems')->will($this->returnValue($states));
     $this->model = new \Magento\Framework\Mview\Config\Data($this->reader, $this->cache, $this->stateCollection, $this->cacheId);
 }