Explorar o código

Add test for correct sorting when force installing deps

Nils Adermann %!s(int64=12) %!d(string=hai) anos
pai
achega
a7f1605cdf
Modificáronse 1 ficheiros con 27 adicións e 0 borrados
  1. 27 0
      tests/Composer/Test/DependencyResolver/SolverTest.php

+ 27 - 0
tests/Composer/Test/DependencyResolver/SolverTest.php

@@ -118,6 +118,33 @@ class SolverTest extends TestCase
         ));
     }
 
+    public function testSolverInstallWithDepsInOrder()
+    {
+        $this->repo->addPackage($packageA = $this->getPackage('A', '1.0'));
+        $this->repo->addPackage($packageB = $this->getPackage('B', '1.0'));
+        $this->repo->addPackage($packageC = $this->getPackage('C', '1.0'));
+
+        $packageB->setRequires(array(
+            new Link('B', 'A', $this->getVersionConstraint('>=', '1.0'), 'requires'),
+            new Link('B', 'C', $this->getVersionConstraint('>=', '1.0'), 'requires'),
+        ));
+        $packageC->setRequires(array(
+            new Link('C', 'A', $this->getVersionConstraint('>=', '1.0'), 'requires'),
+        ));
+
+        $this->reposComplete();
+
+        $this->request->install('A');
+        $this->request->install('B');
+        $this->request->install('C');
+
+        $this->checkSolverResult(array(
+            array('job' => 'install', 'package' => $packageA),
+            array('job' => 'install', 'package' => $packageC),
+            array('job' => 'install', 'package' => $packageB),
+        ));
+    }
+
     public function testSolverInstallInstalled()
     {
         $this->repoInstalled->addPackage($this->getPackage('A', '1.0'));