public function testCreate() { $actionInterfaceMock = $this->getMockForAbstractClass('Magento\\Framework\\Indexer\\ActionInterface', [], '', false); $this->objectManagerMock->expects($this->once())->method('create')->with('Magento\\Framework\\Indexer\\ActionInterface', [])->willReturn($actionInterfaceMock); $this->model->create('Magento\\Framework\\Indexer\\ActionInterface'); $this->assertInstanceOf('Magento\\Framework\\Indexer\\ActionInterface', $actionInterfaceMock); }
public function testReindexList() { $ids = [1]; $stateMock = $this->getMock('\\Magento\\Indexer\\Model\\Indexer\\State', ['load', 'save'], [], '', false); $actionMock = $this->getMock('Magento\\Framework\\Indexer\\ActionInterface', ['executeFull', 'executeList', 'executeRow'], [], '', false); $this->actionFactoryMock->expects($this->once())->method('create')->will($this->returnValue($actionMock)); $this->stateFactoryMock->expects($this->once())->method('create')->will($this->returnValue($stateMock)); $stateMock->expects($this->once())->method('save')->will($this->returnSelf()); $actionMock->expects($this->once())->method('executeList')->with($ids)->will($this->returnSelf()); $this->model->reindexList($ids); }
/** * Return indexer action instance * * @return ActionInterface */ protected function getActionInstance() { return $this->actionFactory->create($this->getActionClass(), ['indexStructure' => $this->getStructureInstance(), 'data' => $this->getData()]); }