9 use Symfony\Component\Console\Tester\CommandTester;
20 private $objectManager;
26 private $commandTester;
35 $this->objectManager->get(\
Magento\TestFramework\
App\Config::class)->clean();
37 $this->command = $this->objectManager->create(
38 \
Magento\Indexer\Console\Command\IndexerSetDimensionsModeCommand::class
41 $this->commandTester =
new CommandTester($this->command);
54 if (!$db->isDbDumpExists()) {
55 throw new \LogicException(
'DB dump does not exist.');
57 $db->restoreFromDbDump();
59 parent::setUpBeforeClass();
72 $this->commandTester->execute(
74 'indexer' =>
'catalog_product_price',
75 'mode' => $currentMode,
78 $expectedOutput =
'Dimensions mode for indexer "Product Price" was changed from \'' 79 . $previousMode .
'\' to \
'' . $currentMode .
'\'' . PHP_EOL;
81 $actualOutput = $this->commandTester->getDisplay();
83 $this->assertContains($expectedOutput, $actualOutput);
87 $this->commandTester->getStatusCode(),
88 $this->commandTester->getDisplay(
true)
128 $this->commandTester->execute(
130 'indexer' =>
'catalog_product_price',
134 $expectedOutput =
'Dimensions mode for indexer "Product Price" has not been changed' . PHP_EOL;
136 $actualOutput = $this->commandTester->getDisplay();
138 $this->assertContains($expectedOutput, $actualOutput);
140 static::assertEquals(
142 $this->commandTester->getStatusCode(),
143 $this->commandTester->getDisplay(
true)
155 $this->commandTester->execute(
157 'indexer' =>
'indexer_not_valid'
testSwitchMode($previousMode, $currentMode)
const DIMENSION_WEBSITE_AND_CUSTOMER_GROUP
testSwitchModeWithInvalidArgument()
testSwitchModeForSameMode()
static setUpBeforeClass()
const DIMENSION_CUSTOMER_GROUP