Skip to content

Commit da5b252

Browse files
Igor Melnikovvrann
authored andcommitted
MAGETWO-51592: Make single tenant compiler work when Magento not installed
Updating unit test
1 parent 94a8c24 commit da5b252

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

setup/src/Magento/Setup/Test/Unit/Console/Command/ModuleEnableDisableCommandTest.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class ModuleEnableDisableCommandTest extends \PHPUnit_Framework_TestCase
3737
private $fullModuleListMock;
3838

3939
/**
40-
* @var \Magento\Framework\App\DeploymentConfig
40+
* @var \Magento\Framework\App\DeploymentConfig|\PHPUnit_Framework_MockObject_MockObject
4141
*/
4242
private $deploymentConfigMock;
4343

@@ -94,7 +94,8 @@ public function testExecute($isEnable, $clearStaticContent, $expectedMessage)
9494
$input['--clear-static-content'] = true;
9595
}
9696
$commandTester->execute($input);
97-
$this->assertStringMatchesFormat($expectedMessage, $commandTester->getDisplay());
97+
$display = $commandTester->getDisplay();
98+
$this->assertStringMatchesFormat($expectedMessage, $display);
9899
}
99100

100101
/**
@@ -161,6 +162,7 @@ public function testExecuteDisableInvalidModule()
161162
*/
162163
public function testExecuteAll($isEnable, $expectedMessage)
163164
{
165+
$setupUpgradeMessage = 'To make sure that the enabled modules are properly registered, run \'setup:upgrade\'.';
164166
$this->fullModuleListMock->expects($this->once())
165167
->method('getNames')
166168
->will($this->returnValue(['Magento_Module1', 'Magento_Module2']));
@@ -174,10 +176,24 @@ public function testExecuteAll($isEnable, $expectedMessage)
174176
$this->statusMock->expects($this->once())
175177
->method('setIsEnabled')
176178
->with($isEnable, ['Magento_Module1']);
179+
if ($isEnable) {
180+
$this->deploymentConfigMock->expects($this->once())
181+
->method('isAvailable')
182+
->willReturn(['Magento_Module1']);
183+
} else {
184+
$this->deploymentConfigMock->expects($this->never())
185+
->method('isAvailable');
186+
}
177187
$commandTester = $this->getCommandTester($isEnable);
178188
$input = ['--all' => true];
179189
$commandTester->execute($input);
180-
$this->assertStringMatchesFormat($expectedMessage, $commandTester->getDisplay());
190+
$output = $commandTester->getDisplay();
191+
$this->assertStringMatchesFormat($expectedMessage, $output);
192+
if ($isEnable) {
193+
$this->assertContains($setupUpgradeMessage, $output);
194+
} else {
195+
$this->assertNotContains($setupUpgradeMessage, $output);
196+
}
181197
}
182198

183199
/**

0 commit comments

Comments
 (0)