Skip to content

Commit 5bc4233

Browse files
author
OlgaVasyltsun
committed
MC-19334: Reindex error when website have store without store view
1 parent 1725caa commit 5bc4233

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

dev/tests/integration/testsuite/Magento/Indexer/Console/Command/IndexerReindexCommandTest.php

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* Tests for \Magento\Indexer\Console\Command\IndexerReindexCommand.
1818
*
1919
* @magentoDbIsolation disabled
20+
* @magentoAppIsolation enabled
2021
*/
2122
class IndexerReindexCommandTest extends \PHPUnit\Framework\TestCase
2223
{
@@ -35,27 +36,34 @@ class IndexerReindexCommandTest extends \PHPUnit\Framework\TestCase
3536
*/
3637
private $outputMock;
3738

39+
/**
40+
* @var IndexerReindexCommand
41+
*/
42+
private $command;
43+
3844
/**
3945
* @inheritdoc
4046
*/
4147
protected function setUp()
4248
{
43-
Bootstrap::getInstance()->reinitialize();
4449
$this->objectManager = Bootstrap::getObjectManager();
4550

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);
5055
}
5156

5257
/**
5358
* @magentoDataFixture Magento/Store/_files/second_store_group_with_second_website.php
5459
*/
5560
public function testReindexAll()
5661
{
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+
);
6068
}
6169
}

dev/tests/integration/testsuite/Magento/Store/_files/second_store_group_with_second_website.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* @var \Magento\Store\Model\Group $storeGroup
1313
*/
14-
$storeGroup = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Store\Model\Group::class);
14+
$storeGroup = $objectManager->create(\Magento\Store\Model\Group::class);
1515
$storeGroup->setCode('some_group')
1616
->setName('custom store group')
1717
->setWebsite($website);

0 commit comments

Comments
 (0)