コード例 #1
0
 public function testUninstall()
 {
     $themeUninstaller = $this->getMock('Magento\\Theme\\Model\\Theme\\ThemeUninstaller', [], [], '', false);
     $themePackageInfo = $this->getMock('Magento\\Theme\\Model\\Theme\\ThemePackageInfo', [], [], '', false);
     $output = $this->getMockForAbstractClass('Symfony\\Component\\Console\\Output\\OutputInterface', [], '', false);
     $themePackageInfo->expects($this->once())->method('getFullThemePath')->willReturn('theme/path');
     $themeUninstaller->expects($this->once())->method('uninstallRegistry')->with($output, ['theme/path']);
     $themeUninstall = new ThemeUninstall($themeUninstaller, $themePackageInfo);
     $themeUninstall->uninstall($output, 'vendor/package-theme');
 }
コード例 #2
0
 /**
  * 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;
     }
 }
コード例 #3
0
 /**
  * @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();
 }