瀏覽代碼

Add a test for two equivalent installable packages and fix the functional test

Nils Adermann 13 年之前
父節點
當前提交
ac61c3973b
共有 1 個文件被更改,包括 18 次插入2 次删除
  1. 18 2
      tests/Composer/Test/DependencyResolver/SolverTest.php

+ 18 - 2
tests/Composer/Test/DependencyResolver/SolverTest.php

@@ -165,11 +165,27 @@ class SolverTest extends \PHPUnit_Framework_TestCase
         ));
     }
 
-    public function testSolverWithComposerRepo()
+    public function testInstallOneOfTwoAlternatives()
     {
-        $this->markTestIncomplete();
+        $this->repo->addPackage($packageA = new MemoryPackage('A', '1.0'));
+        $this->repo->addPackage($packageB = new MemoryPackage('A', '1.0'));
+
+        $this->reposComplete();
+
+        $this->request->install('A');
+
+        $this->checkSolverResult(array(
+            array('job' => 'install', 'package' => $packageA),
+        ));
+    }
 
+    public function testSolverWithComposerRepo()
+    {
         $this->repoInstalled = new PlatformRepository;
+
+        // overwrite solver with custom installed repo
+        $this->solver = new Solver($this->policy, $this->pool, $this->repoInstalled);
+
         $this->repo = new ComposerRepository('http://packagist.org');
         list($monolog) = $this->repo->getPackages();