public function testSaveRootPackageFileGeneratesFactoryIfManagerAvailable() { $baseConfig = new Config(); $packageFile = new RootPackageFile(null, '/path', $baseConfig); $factoryManager = $this->getMock('Puli\\Manager\\Api\\Factory\\FactoryManager'); $storage = new PackageFileStorage($this->reader, $this->writer, $factoryManager); $factoryManager->expects($this->once())->method('autoGenerateFactoryClass'); $storage->saveRootPackageFile($packageFile); }
private function renameNonRootPackage(Package $package, $newName) { $previousInstallInfo = $package->getInstallInfo(); $installInfo = new InstallInfo($newName, $previousInstallInfo->getInstallPath()); $installInfo->setInstallerName($previousInstallInfo->getInstallerName()); foreach ($previousInstallInfo->getDisabledBindingUuids() as $uuid) { $installInfo->addDisabledBindingUuid($uuid); } $this->rootPackageFile->removeInstallInfo($package->getName()); $this->rootPackageFile->addInstallInfo($installInfo); try { $this->packageFileStorage->saveRootPackageFile($this->rootPackageFile); } catch (Exception $e) { $this->rootPackageFile->removeInstallInfo($newName); $this->rootPackageFile->addInstallInfo($previousInstallInfo); throw $e; } $this->packages->remove($package->getName()); $this->packages->add(new Package($package->getPackageFile(), $package->getInstallPath(), $installInfo, $package->getLoadErrors())); }
private function saveRootPackageFile() { $this->packageFileStorage->saveRootPackageFile($this->rootPackageFile); }
/** * {@inheritdoc} */ protected function saveConfigFile() { $this->packageFileStorage->saveRootPackageFile($this->rootPackageFile); }