Skip to content

Commit 2d224e2

Browse files
committed
MCP-957: Parallel Indexation for Catalog Permission
-Show command when indexer is disabled;
1 parent 684fc7f commit 2d224e2

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

app/code/Magento/Indexer/Console/Command/IndexerShowDimensionsModeCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(
5151
ObjectManagerFactory $objectManagerFactory,
5252
ScopeConfigInterface $configReader,
5353
array $indexers,
54-
array $optionalIndexers
54+
array $optionalIndexers = []
5555
) {
5656
$this->configReader = $configReader;
5757
$this->indexers = $indexers;

app/code/Magento/Indexer/Test/Unit/Console/Command/IndexerShowDimensionsModeCommandTest.php

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,26 @@ class IndexerShowDimensionsModeCommandTest extends AbstractIndexerCommandCommonS
4141
*/
4242
private $indexerMock;
4343

44+
/**
45+
* @var string[]
46+
*/
47+
private $optionalIndexers;
48+
49+
/**
50+
* @var ObjectManagerHelper
51+
*/
52+
private $objectManagerHelper;
53+
4454
/**
4555
* @inheritdoc
4656
*/
4757
protected function setUp(): void
4858
{
4959
parent::setUp();
50-
$objectManagerHelper = new ObjectManagerHelper($this);
60+
$this->objectManagerHelper = new ObjectManagerHelper($this);
5161
$this->configReaderMock = $this->getMockForAbstractClass(ScopeConfigInterface::class);
5262
$this->indexers = ['indexer_1' => 'indexer_1', 'indexer_2' => 'indexer_2'];
53-
$this->command = $objectManagerHelper->getObject(
63+
$this->command = $this->objectManagerHelper->getObject(
5464
IndexerShowDimensionsModeCommand::class,
5565
[
5666
'objectManagerFactory' => $this->objectManagerFactory,
@@ -98,6 +108,29 @@ public function testExecuteWithAttributes($command, $consoleOutput)
98108
);
99109
}
100110

111+
public function testExecuteWithOptionalIndexers()
112+
{
113+
$this->optionalIndexers = ['indexer_3'];
114+
$this->indexers = ['indexer_3'=> 'indexer_3'];
115+
$this->command = $this->objectManagerHelper->getObject(
116+
IndexerShowDimensionsModeCommand::class,
117+
[
118+
'objectManagerFactory' => $this->objectManagerFactory,
119+
'configReader' => $this->configReaderMock,
120+
'indexers' => $this->indexers,
121+
'optionalIndexers' => $this->optionalIndexers
122+
]
123+
);
124+
$command = ['indexer' => ['indexer_3']];
125+
$this->configureAdminArea();
126+
/** @var CommandTester $commandTester */
127+
$commandTester = new CommandTester($this->command);
128+
$this->indexerMock->method('load')->willThrowException(new \InvalidArgumentException());
129+
$commandTester->execute($command);
130+
$actualValue = $commandTester->getDisplay();
131+
$this->assertEquals('', $actualValue);
132+
}
133+
101134
/**
102135
* @return array
103136
*/

0 commit comments

Comments
 (0)