Browse Source

Make the InstallationManagerMock behave like the real class on alias install

Nils Adermann 12 years ago
parent
commit
9346d4a501
1 changed files with 7 additions and 2 deletions
  1. 7 2
      tests/Composer/Test/Mock/InstallationManagerMock.php

+ 7 - 2
tests/Composer/Test/Mock/InstallationManagerMock.php

@@ -56,9 +56,14 @@ class InstallationManagerMock extends InstallationManager
 
     public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
     {
-        $this->installed[] = $operation->getPackage();
+        $package = $operation->getPackage();
+
+        $this->installed[] = $package;
         $this->trace[] = (string) $operation;
-        $repo->addPackage(clone $operation->getPackage());
+
+        if (!$repo->hasPackage($package)) {
+            $repo->addPackage($package);
+        }
     }
 
     public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)