/** * @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 * * @expectedException \InvalidArgumentException * @expectedExceptionMessage Package is not installed : letudiant/foo-bar */ public function uninstallWhenPackageNotInstalledException() { $package = $this->createPackageMock(); $this->installer->expects($this->never())->method('uninstall')->with($this->repository, $package); $this->createSolver()->uninstall($this->repository, $package); }
/** * @test */ public function supports() { $library = new SharedPackageInstaller($this->io, $this->composer, $this->fs, $this->dataManager); $this->assertFalse($library->supports('foo')); $this->assertFalse($library->supports('library')); $this->assertTrue($library->supports(SharedPackageInstaller::PACKAGE_TYPE)); }