public function testUninstallRegistry()
 {
     $this->output->expects($this->atLeastOnce())->method('writeln');
     $this->themePackageInfo->expects($this->never())->method($this->anything());
     $this->remove->expects($this->never())->method($this->anything());
     $theme = $this->getMock('Magento\\Theme\\Model\\Theme', [], [], '', false);
     $theme->expects($this->exactly(3))->method('delete');
     $this->themeProvider->expects($this->exactly(3))->method('getThemeByFullPath')->willReturn($theme);
     $this->themeUninstaller->uninstallRegistry($this->output, ['frontend/Magento/ThemeA', 'frontend/Magento/ThemeB', 'frontend/Magento/ThemeC']);
 }
Exemplo n.º 2
0
 /**
  * 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]);
 }
Exemplo n.º 3
0
 /**
  * {@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>');
     }
 }