@@ -37,7 +37,7 @@ class ModuleEnableDisableCommandTest extends \PHPUnit_Framework_TestCase
37
37
private $ fullModuleListMock ;
38
38
39
39
/**
40
- * @var \Magento\Framework\App\DeploymentConfig
40
+ * @var \Magento\Framework\App\DeploymentConfig|\PHPUnit_Framework_MockObject_MockObject
41
41
*/
42
42
private $ deploymentConfigMock ;
43
43
@@ -94,7 +94,8 @@ public function testExecute($isEnable, $clearStaticContent, $expectedMessage)
94
94
$ input ['--clear-static-content ' ] = true ;
95
95
}
96
96
$ commandTester ->execute ($ input );
97
- $ this ->assertStringMatchesFormat ($ expectedMessage , $ commandTester ->getDisplay ());
97
+ $ display = $ commandTester ->getDisplay ();
98
+ $ this ->assertStringMatchesFormat ($ expectedMessage , $ display );
98
99
}
99
100
100
101
/**
@@ -161,6 +162,7 @@ public function testExecuteDisableInvalidModule()
161
162
*/
162
163
public function testExecuteAll ($ isEnable , $ expectedMessage )
163
164
{
165
+ $ setupUpgradeMessage = 'To make sure that the enabled modules are properly registered, run \'setup:upgrade \'. ' ;
164
166
$ this ->fullModuleListMock ->expects ($ this ->once ())
165
167
->method ('getNames ' )
166
168
->will ($ this ->returnValue (['Magento_Module1 ' , 'Magento_Module2 ' ]));
@@ -174,10 +176,24 @@ public function testExecuteAll($isEnable, $expectedMessage)
174
176
$ this ->statusMock ->expects ($ this ->once ())
175
177
->method ('setIsEnabled ' )
176
178
->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
+ }
177
187
$ commandTester = $ this ->getCommandTester ($ isEnable );
178
188
$ input = ['--all ' => true ];
179
189
$ 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
+ }
181
197
}
182
198
183
199
/**
0 commit comments