objectManager = Bootstrap::getObjectManager(); $this->inputMock = $this->getMockBuilder(InputInterface::class)->getMockForAbstractClass(); $this->outputMock = $this->getMockBuilder(OutputInterface::class)->getMockForAbstractClass(); $this->command = $this->objectManager->get(IndexerReindexCommand::class); } /** * @magentoDataFixture Magento/Store/_files/second_store_group_with_second_website.php * @return void */ public function testReindexAll(): void { $status = $this->command->run($this->inputMock, $this->outputMock); $this->assertEquals(Cli::RETURN_SUCCESS, $status, 'Index wasn\'t success'); } /** * Check that 'indexer:reindex' command return right code. * * @magentoDataFixture Magento/Indexer/_files/wrong_config_data.php * @return void */ public function testReindexAllWhenSomethingIsWrong(): void { $status = $this->command->run($this->inputMock, $this->outputMock); $this->assertEquals(Cli::RETURN_FAILURE, $status, 'Index didn\'t return failure code'); } }