public function testUninstallNotRemoveData()
 {
     $output = $this->getMockForAbstractClass('Symfony\\Component\\Console\\Output\\OutputInterface', [], '', false);
     $packageInfoFactory = $this->getMock('Magento\\Framework\\Module\\PackageInfoFactory', [], [], '', false);
     $packageInfo = $this->getMock('Magento\\Framework\\Module\\PackageInfo', [], [], '', false);
     $packageInfo->expects($this->once())->method('getModuleName')->willReturn('Module_A');
     $packageInfoFactory->expects($this->any())->method('create')->willReturn($packageInfo);
     $moduleUninstaller = $this->getMock('Magento\\Setup\\Model\\ModuleUninstaller', [], [], '', false);
     $moduleUninstaller->expects($this->never())->method('uninstallData');
     $moduleRegistryUninstaller = $this->getMock('Magento\\Setup\\Model\\ModuleRegistryUninstaller', [], [], '', false);
     $moduleRegistryUninstaller->expects($this->once())->method('removeModulesFromDb')->with($output, ['Module_A']);
     $moduleRegistryUninstaller->expects($this->once())->method('removeModulesFromDeploymentConfig')->with($output, ['Module_A']);
     $moduleUninstall = new ModuleUninstall($moduleUninstaller, $moduleRegistryUninstaller, $packageInfoFactory);
     $moduleUninstall->uninstall($output, 'vendor/module-package', false);
 }
 /**
  * Execute uninstall on a component
  *
  * @param array $component
  * @return void
  * @throw \RuntimeException
  */
 private function executeComponent(array $component)
 {
     if (!isset($component[self::COMPONENT_NAME])) {
         $this->status->toggleUpdateError(true);
         throw new \RuntimeException('Job parameter format is incorrect');
     }
     $componentName = $component[self::COMPONENT_NAME];
     $installedPackages = $this->composerInformation->getInstalledMagentoPackages();
     if (isset($installedPackages[$componentName]['type'])) {
         $type = $installedPackages[$componentName]['type'];
     } else {
         $this->status->toggleUpdateError(true);
         throw new \RuntimeException('Component type not set');
     }
     if (!in_array($type, [self::COMPONENT_MODULE, self::COMPONENT_THEME, self::COMPONENT_LANGUAGE, self::COMPONENT])) {
         $this->status->toggleUpdateError(true);
         throw new \RuntimeException('Unknown component type');
     }
     switch ($type) {
         case self::COMPONENT_MODULE:
             $dataOption = isset($this->params[self::DATA_OPTION]) && $this->params[self::DATA_OPTION] === 'true';
             $this->moduleUninstall->uninstall($this->output, $componentName, $dataOption);
             break;
         case self::COMPONENT_THEME:
             $this->themeUninstall->uninstall($this->output, $componentName);
             break;
     }
 }
 /**
  * @param array $params
  * @expectedException \RuntimeException
  * @expectedExceptionMessage Job parameter format is incorrect
  * @dataProvider executeWrongFormatDataProvider
  */
 public function testExecuteWrongFormat(array $params)
 {
     $this->moduleUninstallHelper->expects($this->never())->method($this->anything());
     $this->themeUninstallHelper->expects($this->never())->method($this->anything());
     $this->job = new JobComponentUninstall($this->composerInformation, $this->moduleUninstallHelper, $this->themeUninstallHelper, $this->objectManagerProvider, $this->output, $this->quence, $this->status, $this->updater, 'setup:component:uninstall', $params);
     $this->job->execute();
 }