configMock = $this->createMock(\Magento\Indexer\Model\Config\Data::class); $this->model = new \Magento\Indexer\Model\Config( $this->configMock ); } public function testGetIndexers() { $this->configMock->expects($this->once())->method('get')->with()->willReturnSelf(); $this->model->getIndexers(); } public function testGetIndexer() { $indexerId = 1; $this->configMock->expects($this->once())->method('get')->with($indexerId)->willReturnSelf(); $this->model->getIndexer($indexerId); } public function testGetNotExistingIndexer() { $indexerId = 1; $this->configMock ->expects($this->once()) ->method('get') ->with($indexerId); $this->assertEquals([], $this->model->getIndexer($indexerId)); } }