From a8b2db64d58db5fb88360d812a0dafb75c3c35f2 Mon Sep 17 00:00:00 2001 From: Volker Dusch Date: Sat, 18 Feb 2012 16:55:45 +0100 Subject: [PATCH] Expaned the update tests to make sure a) Only requested updates execute and b) Installed repos with no actions get pruned from the jobqueue --- .../Test/DependencyResolver/SolverTest.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/Composer/Test/DependencyResolver/SolverTest.php b/tests/Composer/Test/DependencyResolver/SolverTest.php index 85ef6fc70..a71feafce 100644 --- a/tests/Composer/Test/DependencyResolver/SolverTest.php +++ b/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'));