mirror of
https://github.com/composer/composer
synced 2025-05-08 16:17:37 +00:00
Added a test for the new findPackagesByName method
This commit is contained in:
parent
05c84e9dfd
commit
38a5f04ea0
1 changed files with 16 additions and 0 deletions
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue