/**
  * 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;
     }
 }
 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');
 }