Merge pull request #2157 from hason/125
Throw exception if the local repository does not contain a package to uninstallpull/2017/merge
commit
815f7687c5
|
@ -116,8 +116,6 @@ class LibraryInstaller implements InstallerInterface
|
||||||
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
|
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
|
||||||
{
|
{
|
||||||
if (!$repo->hasPackage($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);
|
throw new \InvalidArgumentException('Package is not installed: '.$package);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,8 +65,6 @@ class MetapackageInstaller implements InstallerInterface
|
||||||
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
|
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
|
||||||
{
|
{
|
||||||
if (!$repo->hasPackage($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);
|
throw new \InvalidArgumentException('Package is not installed: '.$package);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,8 +71,6 @@ class NoopInstaller implements InstallerInterface
|
||||||
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
|
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
|
||||||
{
|
{
|
||||||
if (!$repo->hasPackage($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);
|
throw new \InvalidArgumentException('Package is not installed: '.$package);
|
||||||
}
|
}
|
||||||
$repo->removePackage($package);
|
$repo->removePackage($package);
|
||||||
|
|
|
@ -197,8 +197,7 @@ class LibraryInstallerTest extends TestCase
|
||||||
|
|
||||||
$library->uninstall($this->repository, $package);
|
$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);
|
$library->uninstall($this->repository, $package);
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,8 +86,7 @@ class MetapackageInstallerTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
$this->installer->uninstall($this->repository, $package);
|
$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);
|
$this->installer->uninstall($this->repository, $package);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue