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()); }
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()); }