/** * {@inheritdoc} */ public function removePackage($name) { // Only check that this is a string. The error message "not found" is // more helpful than e.g. "package name must contain /". Assert::string($name, 'The package name must be a string. Got: %s'); $this->assertPackagesLoaded(); if ($this->rootPackageFile->hasInstallInfo($name)) { $installInfo = $this->rootPackageFile->getInstallInfo($name); $this->rootPackageFile->removeInstallInfo($name); try { $this->packageFileStorage->saveRootPackageFile($this->rootPackageFile); } catch (Exception $e) { $this->rootPackageFile->addInstallInfo($installInfo); throw $e; } } $this->packages->remove($name); }
public function testHasInstallInfo() { $this->assertFalse($this->packageFile->hasInstallInfo('vendor/package')); $this->packageFile->addInstallInfo(new InstallInfo('vendor/package', '/path/to/package')); $this->assertTrue($this->packageFile->hasInstallInfo('vendor/package')); }