public function testExecuteWithIndexer() { $ids = array(1, 2, 3); $this->indexerMock->expects($this->once())->method('load')->with(\Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID)->will($this->returnSelf()); $rowMock = $this->getMock('Magento\\CatalogSearch\\Model\\Indexer\\Fulltext\\Action\\Rows', array('reindex'), array(), '', false); $rowMock->expects($this->once())->method('reindex')->with($ids)->will($this->returnSelf()); $this->rowsMock->expects($this->once())->method('create')->will($this->returnValue($rowMock)); $this->model->execute($ids); }
public function testExecuteRow() { $id = 1; $stores = [0 => 'Store 1', 1 => 'Store 2']; $indexData = new \ArrayObject([]); $this->storeManager->expects($this->once())->method('getStores')->willReturn($stores); $this->saveHandler->expects($this->exactly(count($stores)))->method('deleteIndex'); $this->saveHandler->expects($this->exactly(count($stores)))->method('saveIndex'); $this->fullAction->expects($this->exactly(count($stores)))->method('rebuildStoreIndex')->willReturn($indexData); $this->model->executeRow($id); }