Browse Source

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

Martin Hasoň 12 years ago
parent
commit
b1c4eed57f

+ 0 - 2
src/Composer/Installer/LibraryInstaller.php

@@ -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);
         }
 

+ 0 - 2
src/Composer/Installer/MetapackageInstaller.php

@@ -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);
         }
 

+ 0 - 2
src/Composer/Installer/NoopInstaller.php

@@ -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);

+ 1 - 2
tests/Composer/Test/Installer/LibraryInstallerTest.php

@@ -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);
     }

+ 1 - 2
tests/Composer/Test/Installer/MetapackageInstallerTest.php

@@ -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);
     }