/** * @param array $expected * * @dataProvider indexActionDataProvider */ public function testIndexActionWithError(array $expected) { $this->modules->expects($this->once())->method('getAllModules')->willReturn($expected['modules']); $this->status->expects($this->once())->method('checkConstraints')->willReturn(['ModuleA', 'ModuleB']); $jsonModel = $this->controller->indexAction(); $this->assertInstanceOf('Zend\\View\\Model\\JsonModel', $jsonModel); $variables = $jsonModel->getVariables(); $this->assertArrayHasKey('success', $variables); $this->assertArrayHasKey('error', $variables); $this->assertFalse($variables['success']); }
/** * @param bool $isEnable * * @dataProvider executeWithConstraintsDataProvider */ public function testExecuteNoChanges($isEnable) { $this->status->expects($this->once())->method('getModulesToChange')->with($isEnable, ['Magento_Module1', 'Magento_Module2'])->will($this->returnValue([])); $this->status->expects($this->never())->method('setIsEnabled'); $commandTester = $isEnable ? new CommandTester(new ModuleEnableCommand($this->objectManagerProvider)) : new CommandTester(new ModuleDisableCommand($this->objectManagerProvider)); $commandTester->execute(['module' => ['Magento_Module1', 'Magento_Module2']]); $this->assertStringMatchesFormat('No modules were changed%a', $commandTester->getDisplay()); }