From 38a5f04ea024c28429d583b2eb18e5cbac54d43f Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Mon, 16 Jan 2012 22:29:22 +0100 Subject: [PATCH] Added a test for the new findPackagesByName method --- .../Test/Repository/ArrayRepositoryTest.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/Composer/Test/Repository/ArrayRepositoryTest.php b/tests/Composer/Test/Repository/ArrayRepositoryTest.php index def78e36e..5e29f5ed6 100644 --- a/tests/Composer/Test/Repository/ArrayRepositoryTest.php +++ b/tests/Composer/Test/Repository/ArrayRepositoryTest.php @@ -50,4 +50,20 @@ class ArrayRepositoryTest extends TestCase $this->assertTrue($repo->hasPackage($this->getPackage('foo', '1'))); $this->assertFalse($repo->hasPackage($this->getPackage('bar', '1'))); } + + public function testFindPackagesByName() + { + $repo = new ArrayRepository(); + $repo->addPackage($this->getPackage('foo', '1')); + $repo->addPackage($this->getPackage('bar', '2')); + $repo->addPackage($this->getPackage('bar', '3')); + + $foo = $repo->findPackagesByName('foo'); + $this->assertCount(1, $foo); + $this->assertEquals('foo', $foo[0]->getName()); + + $bar = $repo->findPackagesByName('bar'); + $this->assertCount(2, $bar); + $this->assertEquals('bar', $bar[0]->getName()); + } }