public function testSetInstallInfos() { $installInfo1 = new InstallInfo('vendor/package1', '/path/to/package1'); $installInfo2 = new InstallInfo('vendor/package2', '/path/to/package2'); $this->packageFile->setInstallInfos(array($installInfo1, $installInfo2)); $this->assertSame(array($installInfo1, $installInfo2), $this->packageFile->getInstallInfos()); }
/** * {@inheritdoc} */ public function removePackages(Expression $expr) { $this->assertPackagesLoaded(); $installInfos = $this->rootPackageFile->getInstallInfos(); $packages = $this->packages->toArray(); foreach ($this->packages->getInstalledPackages() as $package) { if ($package->match($expr)) { $this->rootPackageFile->removeInstallInfo($package->getName()); $this->packages->remove($package->getName()); } } if (!$installInfos) { return; } try { $this->packageFileStorage->saveRootPackageFile($this->rootPackageFile); } catch (Exception $e) { $this->rootPackageFile->setInstallInfos($installInfos); $this->packages->replace($packages); throw $e; } }