32 $this->filesystem = $this->createPartialMock(\
Magento\Framework\Filesystem::class, [
'getDirectoryWrite']);
33 $this->processor = $this->createMock(\
Magento\Indexer\Model\Processor::class);
34 $this->_response = $this->createPartialMock(
35 \
Magento\Framework\
App\Console\Response::class,
36 [
'setCode',
'getCode']
39 $this->entryPoint = new \Magento\Indexer\App\Indexer(
54 $this->_response->expects($this->once())->method(
'setCode')->with(0);
55 $this->_response->expects($this->once())->method(
'getCode')->will($this->returnValue(0));
56 $dir = $this->createMock(\
Magento\Framework\Filesystem\Directory\Write::class);
57 $dir->expects($this->any())->method(
'getRelativePath')->will($this->returnArgument(0));
58 $dir->expects($this->once())->method(
'isExist')->will($this->returnValue($isExist));
59 $dir->expects($this->exactly($callCount))->method(
'delete')->will($this->returnValue(
true));
60 $this->filesystem->expects($this->once())->method(
'getDirectoryWrite')->will($this->returnValue($dir));
61 $this->processor->expects($this->once())->method(
'reindexAll');
62 $this->assertEquals(0, $this->entryPoint->launch()->getCode());
71 'set1' => [
'isExist' =>
true,
'expectsValue' => 1],
72 'set1' => [
'delete' =>
false,
'expectsValue' => 0]
79 $this->assertFalse($this->entryPoint->catchException(
$bootstrap,
new \Exception()));
testExecute($isExist, $callCount)
if(defined('TESTS_MAGENTO_INSTALLATION') &&TESTS_MAGENTO_INSTALLATION==='enabled') $bootstrap