/**
  * @expectedException \Zend_Json_Exception
  */
 public function testGetPackageNameInvalidJson()
 {
     $this->componentRegistrar->expects($this->once())->method('getPath')->willReturn('path/to/A');
     $this->dirRead->expects($this->once())->method('isExist')->willReturn(true);
     $this->dirRead->expects($this->once())->method('readFile')->willReturn('{"name": }');
     $this->themePackageInfo->getPackageName('themeA');
 }
 /**
  * Uninstall theme from code base
  *
  * @param OutputInterface $output
  * @param array $themePaths
  * @return void
  */
 public function uninstallCode(OutputInterface $output, array $themePaths)
 {
     $output->writeln('<info>Removing ' . implode(', ', $themePaths) . ' from Magento codebase');
     $packageNames = [];
     foreach ($themePaths as $themePath) {
         $packageNames[] = $this->themePackageInfo->getPackageName($themePath);
     }
     $output->writeln($this->remove->remove($packageNames));
 }
 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']);
 }
 /**
  * Check theme by package name(s) if has child virtual and physical theme
  *
  * @param string[] $packages
  * @return string[]
  */
 public function checkChildThemeByPackagesName($packages)
 {
     $themePaths = [];
     foreach ($packages as $package) {
         $themePath = $this->themePackageInfo->getFullThemePath($package);
         if ($themePath) {
             $themePaths[] = $themePath;
         }
     }
     if ($themePaths) {
         return $this->checkChildTheme($themePaths);
     }
     return [];
 }
Esempio n. 5
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]);
 }
 /**
  * Check dependencies to given full theme paths
  *
  * @param string[] $themePaths
  * @return string[]
  */
 private function checkDependencies($themePaths)
 {
     $messages = [];
     $packageToPath = [];
     foreach ($themePaths as $themePath) {
         $packageToPath[$this->themePackageInfo->getPackageName($themePath)] = $themePath;
     }
     $dependencies = $this->dependencyChecker->checkDependencies(array_keys($packageToPath), true);
     foreach ($dependencies as $package => $dependingPackages) {
         if (!empty($dependingPackages)) {
             $messages[] = '<error>' . $packageToPath[$package] . " has the following dependent package(s):</error>" . PHP_EOL . "\t<error>" . implode('</error>' . PHP_EOL . "\t<error>", $dependingPackages) . "</error>";
         }
     }
     return $messages;
 }
 public function testCheckChildThemeByPackagesName()
 {
     $packages = ['vendor/package1', 'vendor/package2'];
     $this->themePackageInfo->expects($this->exactly(2))->method('getFullThemePath')->willReturn(null);
     $this->themeDependencyChecker->checkChildThemeByPackagesName($packages);
 }