1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00
This commit is contained in:
Jordi Boggiano 2022-08-17 15:20:07 +03:00 committed by GitHub
parent 6e205a0c84
commit 131da999ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
357 changed files with 5943 additions and 9174 deletions

View file

@ -21,10 +21,10 @@ class PoolTest extends TestCase
{
$package = $this->getPackage('foo', '1');
$pool = $this->createPool(array($package));
$pool = $this->createPool([$package]);
$this->assertEquals(array($package), $pool->whatProvides('foo'));
$this->assertEquals(array($package), $pool->whatProvides('foo'));
$this->assertEquals([$package], $pool->whatProvides('foo'));
$this->assertEquals([$package], $pool->whatProvides('foo'));
}
public function testWhatProvidesPackageWithConstraint(): void
@ -32,20 +32,20 @@ class PoolTest extends TestCase
$firstPackage = $this->getPackage('foo', '1');
$secondPackage = $this->getPackage('foo', '2');
$pool = $this->createPool(array(
$pool = $this->createPool([
$firstPackage,
$secondPackage,
));
]);
$this->assertEquals(array($firstPackage, $secondPackage), $pool->whatProvides('foo'));
$this->assertEquals(array($secondPackage), $pool->whatProvides('foo', $this->getVersionConstraint('==', '2')));
$this->assertEquals([$firstPackage, $secondPackage], $pool->whatProvides('foo'));
$this->assertEquals([$secondPackage], $pool->whatProvides('foo', $this->getVersionConstraint('==', '2')));
}
public function testPackageById(): void
{
$package = $this->getPackage('foo', '1');
$pool = $this->createPool(array($package));
$pool = $this->createPool([$package]);
$this->assertSame($package, $pool->packageById(1));
}
@ -54,14 +54,13 @@ class PoolTest extends TestCase
{
$pool = $this->createPool();
$this->assertEquals(array(), $pool->whatProvides('foo'));
$this->assertEquals([], $pool->whatProvides('foo'));
}
/**
* @param array<\Composer\Package\BasePackage>|null $packages
* @return \Composer\DependencyResolver\Pool
*/
protected function createPool(?array $packages = array()): Pool
protected function createPool(?array $packages = []): Pool
{
return new Pool($packages);
}