コード例 #1
0
 public function testGetState()
 {
     $indexId = 'indexer_internal_name';
     $stateMock = $this->getMock('\\Magento\\Indexer\\Model\\Indexer\\State', ['loadByIndexer', 'getId', '__wakeup'], [], '', false);
     $stateMock->expects($this->once())->method('loadByIndexer')->with($indexId)->will($this->returnSelf());
     $this->stateFactoryMock->expects($this->once())->method('create')->will($this->returnValue($stateMock));
     $this->loadIndexer($indexId);
     $this->assertInstanceOf('\\Magento\\Indexer\\Model\\Indexer\\State', $this->model->getState());
 }
コード例 #2
0
 public function testSetState()
 {
     $stateMock = $this->getMock('\\Magento\\Indexer\\Model\\Indexer\\State', ['loadByIndexer', 'getId', '__wakeup'], [], '', false);
     $this->model->setState($stateMock);
     $this->assertInstanceOf('\\Magento\\Indexer\\Model\\Indexer\\State', $this->model->getState());
 }