public function testUninstallCode() { $this->output->expects($this->atLeastOnce())->method('writeln'); $this->themePackageInfo->expects($this->at(0))->method('getPackageName')->willReturn('packageA'); $this->themePackageInfo->expects($this->at(1))->method('getPackageName')->willReturn('packageB'); $this->themePackageInfo->expects($this->at(2))->method('getPackageName')->willReturn('packageC'); $this->remove->expects($this->once())->method('remove')->with(['packageA', 'packageB', 'packageC'])->willReturn(''); $this->themeProvider->expects($this->never())->method($this->anything()); $this->themeUninstaller->uninstallCode($this->output, ['frontend/Magento/ThemeA', 'frontend/Magento/ThemeB', 'frontend/Magento/ThemeC']); }
public function setUpExecute() { $this->setUpPassValidation(); $this->setupPassThemeInUseCheck(); $this->setupPassChildThemeCheck(); $this->setupPassDependencyCheck(); $this->cache->expects($this->once())->method('clean'); $this->themeUninstaller->expects($this->once())->method('uninstallRegistry')->with($this->isInstanceOf('Symfony\\Component\\Console\\Output\\OutputInterface'), $this->anything()); $this->themeUninstaller->expects($this->once())->method('uninstallCode')->with($this->isInstanceOf('Symfony\\Component\\Console\\Output\\OutputInterface'), $this->anything()); }
/** * Perform setup side uninstall * * @param OutputInterface $output * @param string $componentName * @return void */ public function uninstall(OutputInterface $output, $componentName) { $themePath = $this->themePackageInfo->getFullThemePath($componentName); $this->themeUninstaller->uninstallRegistry($output, [$themePath]); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $messages = []; $themePaths = $input->getArgument(self::INPUT_KEY_THEMES); $messages = array_merge($messages, $this->validate($themePaths)); if (!empty($messages)) { $output->writeln($messages); return; } $messages = array_merge($messages, $this->themeValidator->validateIsThemeInUse($themePaths), $this->themeDependencyChecker->checkChildTheme($themePaths), $this->checkDependencies($themePaths)); if (!empty($messages)) { $output->writeln('<error>Unable to uninstall. Please resolve the following issues:</error>' . PHP_EOL . implode(PHP_EOL, $messages)); return; } try { $output->writeln('<info>Enabling maintenance mode</info>'); $this->maintenanceMode->set(true); if ($input->getOption(self::INPUT_KEY_BACKUP_CODE)) { $time = time(); $codeBackup = $this->backupRollbackFactory->create($output); $codeBackup->codeBackup($time); } $this->themeUninstaller->uninstallRegistry($output, $themePaths); $this->themeUninstaller->uninstallCode($output, $themePaths); $this->cleanup($input, $output); $output->writeln('<info>Disabling maintenance mode</info>'); $this->maintenanceMode->set(false); } catch (\Exception $e) { $output->writeln('<error>' . $e->getMessage() . '</error>'); $output->writeln('<error>Please disable maintenance mode after you resolved above issues</error>'); } }