1
0
Fork 0

Throw exception if the local repository does not contain a package to uninstall

pull/2157/head
Martin Hasoň 2013-08-07 10:50:12 +02:00
parent af1f5a3423
commit b1c4eed57f
5 changed files with 2 additions and 10 deletions

View File

@ -116,8 +116,6 @@ class LibraryInstaller implements InstallerInterface
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
{
if (!$repo->hasPackage($package)) {
// TODO throw exception again here, when update is fixed and we don't have to remove+install (see #125)
return;
throw new \InvalidArgumentException('Package is not installed: '.$package);
}

View File

@ -65,8 +65,6 @@ class MetapackageInstaller implements InstallerInterface
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
{
if (!$repo->hasPackage($package)) {
// TODO throw exception again here, when update is fixed and we don't have to remove+install (see #125)
return;
throw new \InvalidArgumentException('Package is not installed: '.$package);
}

View File

@ -71,8 +71,6 @@ class NoopInstaller implements InstallerInterface
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
{
if (!$repo->hasPackage($package)) {
// TODO throw exception again here, when update is fixed and we don't have to remove+install (see #125)
return;
throw new \InvalidArgumentException('Package is not installed: '.$package);
}
$repo->removePackage($package);

View File

@ -197,8 +197,7 @@ class LibraryInstallerTest extends TestCase
$library->uninstall($this->repository, $package);
// TODO re-enable once #125 is fixed and we throw exceptions again
// $this->setExpectedException('InvalidArgumentException');
$this->setExpectedException('InvalidArgumentException');
$library->uninstall($this->repository, $package);
}

View File

@ -86,8 +86,7 @@ class MetapackageInstallerTest extends \PHPUnit_Framework_TestCase
$this->installer->uninstall($this->repository, $package);
// TODO re-enable once #125 is fixed and we throw exceptions again
// $this->setExpectedException('InvalidArgumentException');
$this->setExpectedException('InvalidArgumentException');
$this->installer->uninstall($this->repository, $package);
}