public uninstall ( Composer\Repository\InstalledRepositoryInterface $repo, Composer\Package\PackageInterface $package ) | ||
$repo | Composer\Repository\InstalledRepositoryInterface | |
$package | Composer\Package\PackageInterface |
/** * @param InstalledRepositoryInterface $repo * @param PackageInterface $package * * @throws FilesystemException */ public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package) { if ($package->isDev()) { if (!$repo->hasPackage($package)) { throw new \InvalidArgumentException('Package is not installed : ' . $package->getPrettyName()); } $this->symlinkInstaller->uninstall($repo, $package); } else { $this->defaultInstaller->uninstall($repo, $package); } }
/** * @test */ public function uninstallDevelopment() { $this->io->expects($this->once())->method('askConfirmation')->willReturn(true); /** @var SymlinkFilesystem|\PHPUnit_Framework_MockObject_MockObject $filesystem */ $filesystem = $this->getMock('\\LEtudiant\\Composer\\Util\\SymlinkFilesystem'); $filesystem->expects($this->once())->method('removeSymlink')->willReturn(true); $library = new SharedPackageInstaller($this->io, $this->composer, $filesystem, $this->dataManager); $package = $this->createDevelopmentPackageMock(); $this->repository->expects($this->exactly(1))->method('hasPackage')->with($package)->will($this->onConsecutiveCalls(true, true)); $this->repository->expects($this->once())->method('removePackage')->with($package); $this->dm->expects($this->once())->method('remove')->with($package, $this->dependenciesDir . '/letudiant/foo-bar/dev-develop'); $this->dataManager->expects($this->once())->method('removePackageUsage')->with($package); $library->uninstall($this->repository, $package); }