/**
  * Perform setup side uninstall
  *
  * @param OutputInterface $output
  * @param string $componentName
  * @param bool $dataOption
  * @return void
  */
 public function uninstall(OutputInterface $output, $componentName, $dataOption)
 {
     $packageInfo = $this->packageInfoFactory->create();
     // convert to module name
     $moduleName = $packageInfo->getModuleName($componentName);
     if ($dataOption) {
         $this->moduleUninstaller->uninstallData($output, [$moduleName]);
     }
     $this->moduleRegistryUninstaller->removeModulesFromDb($output, [$moduleName]);
     $this->moduleRegistryUninstaller->removeModulesFromDeploymentConfig($output, [$moduleName]);
 }
 public function testUninstallRemoveData()
 {
     $this->moduleRegistryUninstaller->expects($this->never())->method($this->anything());
     $uninstall = $this->getMockForAbstractClass('Magento\\Framework\\Setup\\UninstallInterface', [], '', false);
     $uninstall->expects($this->atLeastOnce())->method('uninstall')->with($this->setup, $this->isInstanceOf('Magento\\Setup\\Model\\ModuleContext'));
     $this->collector->expects($this->once())->method('collectUninstall')->willReturn(['moduleA' => $uninstall, 'moduleB' => $uninstall]);
     $resource = $this->getMock('Magento\\Framework\\Module\\ModuleResource', [], [], '', false);
     $resource->expects($this->atLeastOnce())->method('getDbVersion')->willReturn('1.0');
     $this->output->expects($this->atLeastOnce())->method('writeln');
     $this->objectManager->expects($this->once())->method('get')->with('Magento\\Framework\\Module\\ModuleResource')->willReturn($resource);
     $this->uninstaller->uninstallData($this->output, ['moduleA', 'moduleB']);
 }
 /**
  * Invoke remove data routine in each specified module
  *
  * @param string[] $modules
  * @param OutputInterface $output
  * @param bool $dbBackupOption
  * @return void
  */
 private function removeData(array $modules, OutputInterface $output, $dbBackupOption)
 {
     if (!$dbBackupOption) {
         $output->writeln('<error>You are removing data without a database backup.</error>');
     } else {
         $output->writeln('<info>Removing data</info>');
     }
     $this->moduleUninstaller->uninstallData($output, $modules);
 }