17
17
* Tests for \Magento\Indexer\Console\Command\IndexerReindexCommand.
18
18
*
19
19
* @magentoDbIsolation disabled
20
+ * @magentoAppIsolation enabled
20
21
*/
21
22
class IndexerReindexCommandTest extends \PHPUnit \Framework \TestCase
22
23
{
@@ -35,27 +36,34 @@ class IndexerReindexCommandTest extends \PHPUnit\Framework\TestCase
35
36
*/
36
37
private $ outputMock ;
37
38
39
+ /**
40
+ * @var IndexerReindexCommand
41
+ */
42
+ private $ command ;
43
+
38
44
/**
39
45
* @inheritdoc
40
46
*/
41
47
protected function setUp ()
42
48
{
43
- Bootstrap::getInstance ()->reinitialize ();
44
49
$ this ->objectManager = Bootstrap::getObjectManager ();
45
50
46
- $ this ->inputMock = $ this ->getMockBuilder (InputInterface::class)
47
- ->getMockForAbstractClass ();
48
- $ this -> outputMock = $ this -> getMockBuilder (OutputInterface::class)
49
- -> getMockForAbstractClass ( );
51
+ $ this ->inputMock = $ this ->getMockBuilder (InputInterface::class)-> getMockForAbstractClass ();
52
+ $ this -> outputMock = $ this -> getMockBuilder (OutputInterface::class) ->getMockForAbstractClass ();
53
+
54
+ $ this -> command = $ this -> objectManager -> get (IndexerReindexCommand::class );
50
55
}
51
56
52
57
/**
53
58
* @magentoDataFixture Magento/Store/_files/second_store_group_with_second_website.php
54
59
*/
55
60
public function testReindexAll ()
56
61
{
57
- $ command = $ this ->objectManager ->create (IndexerReindexCommand::class);
58
- $ status = $ command ->run ($ this ->inputMock , $ this ->outputMock );
59
- $ this ->assertEquals (0 , $ status , 'Index wasn \'t success ' );
62
+ $ status = $ this ->command ->run ($ this ->inputMock , $ this ->outputMock );
63
+ $ this ->assertEquals (
64
+ \Magento \Framework \Console \Cli::RETURN_SUCCESS ,
65
+ $ status ,
66
+ 'Index wasn \'t success '
67
+ );
60
68
}
61
69
}
0 commit comments