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