From b277b8e73c718b61c5ddbd4af031dc65bfb31649 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 21 Jul 2011 13:42:47 +0200 Subject: [PATCH] Add failing test with composer repo --- .../Test/DependencyResolver/SolverTest.php | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/tests/Composer/Test/DependencyResolver/SolverTest.php b/tests/Composer/Test/DependencyResolver/SolverTest.php index e1c4c5eb4..979df4262 100644 --- a/tests/Composer/Test/DependencyResolver/SolverTest.php +++ b/tests/Composer/Test/DependencyResolver/SolverTest.php @@ -14,6 +14,7 @@ namespace Composer\Test\DependencyResolver; use Composer\Repository\ArrayRepository; use Composer\Repository\PlatformRepository; +use Composer\Repository\ComposerRepository; use Composer\DependencyResolver\DefaultPolicy; use Composer\DependencyResolver\Pool; use Composer\DependencyResolver\Request; @@ -28,7 +29,7 @@ class SolverTest extends \PHPUnit_Framework_TestCase { $pool = new Pool; - $repoInstalled = new ArrayRepository; + $repoInstalled = new PlatformRepository; $repoInstalled->addPackage($oldPackage = new MemoryPackage('old', '1.0')); $repoInstalled->addPackage($oldPackageC = new MemoryPackage('C', '1.0')); @@ -73,4 +74,32 @@ class SolverTest extends \PHPUnit_Framework_TestCase $this->assertEquals($expected, $result); } + + public function testSolverWithComposerRepo() + { + $pool = new Pool; + $repoInstalled = new PlatformRepository; + $repo = new ComposerRepository('http://packagist.org'); + list($monolog) = $repo->getPackages(); + + $pool->addRepository($repoInstalled); + $pool->addRepository($repo); + + $request = new Request($pool); + + $request->install('Monolog'); + + $policy = new DefaultPolicy; + $solver = new Solver($policy, $pool, $repoInstalled); + $result = $solver->solve($request); + + $expected = array( + array( + 'job' => 'install', + 'package' => $monolog, + ), + ); + + $this->assertEquals($expected, $result); + } }