Sfoglia il codice sorgente

Expaned the update tests to make sure a) Only requested updates execute and b) Installed repos with no actions get pruned from the jobqueue

Volker Dusch 13 anni fa
parent
commit
a8b2db64d5
1 ha cambiato i file con 34 aggiunte e 0 eliminazioni
  1. 34 0
      tests/Composer/Test/DependencyResolver/SolverTest.php

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

@@ -158,6 +158,22 @@ class SolverTest extends TestCase
         $this->checkSolverResult(array());
     }
 
+    public function testSolverUpdateOnlyUpdatesSelectedPackage()
+    {
+        $this->repoInstalled->addPackage($packageA = $this->getPackage('A', '1.0'));
+        $this->repoInstalled->addPackage($packageB = $this->getPackage('B', '1.0'));
+        $this->repo->addPackage($packageAnewer = $this->getPackage('A', '1.1'));
+        $this->repo->addPackage($packageBnewer = $this->getPackage('B', '1.1'));
+
+        $this->reposComplete();
+
+        $this->request->update('A');
+
+        $this->checkSolverResult(array(
+            array('job' => 'update', 'from' => $packageA, 'to' => $packageAnewer),
+        ));
+    }
+
     public function testSolverUpdateConstrained()
     {
         $this->repoInstalled->addPackage($packageA = $this->getPackage('A', '1.0'));
@@ -192,6 +208,24 @@ class SolverTest extends TestCase
         )));
     }
 
+    public function testSolverUpdateFullyConstrainedPrunesInstalledPackages()
+    {
+        $this->repoInstalled->addPackage($packageA = $this->getPackage('A', '1.0'));
+        $this->repoInstalled->addPackage($this->getPackage('B', '1.0'));
+        $this->repo->addPackage($newPackageA = $this->getPackage('A', '1.2'));
+        $this->repo->addPackage($this->getPackage('A', '2.0'));
+        $this->reposComplete();
+
+        $this->request->install('A', new VersionConstraint('<', '2.0.0.0'));
+        $this->request->update('A', new VersionConstraint('=', '1.0.0.0'));
+
+        $this->checkSolverResult(array(array(
+            'job' => 'update',
+            'from' => $packageA,
+            'to' => $newPackageA,
+        )));
+    }
+
     public function testSolverAllJobs()
     {
         $this->repoInstalled->addPackage($packageD = $this->getPackage('D', '1.0'));