public function testRemoveInstallInfoIgnoresUnknownPackageName() { $installInfo1 = new InstallInfo('vendor/package1', '/path/to/package1'); $this->packageFile->addInstallInfo($installInfo1); $this->packageFile->removeInstallInfo('foobar'); $this->assertSame(array($installInfo1), $this->packageFile->getInstallInfos()); }
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())); }