mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
Revert "Merge remote-tracking branch 'naderman/load-no-providers'"
This reverts commit3e85f82373
, reversing changes made tob025d0982b
.
This commit is contained in:
parent
74e7c5fe22
commit
75c501251d
5 changed files with 156 additions and 193 deletions
|
@ -96,7 +96,7 @@ class ComposerRepositoryTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testLoadRecursively()
|
||||
public function testWhatProvides()
|
||||
{
|
||||
$repo = $this->getMockBuilder('Composer\Repository\ComposerRepository')
|
||||
->disableOriginalConstructor()
|
||||
|
@ -124,41 +124,45 @@ class ComposerRepositoryTest extends TestCase
|
|||
->method('fetchFile')
|
||||
->will($this->returnValue(array(
|
||||
'packages' => array(
|
||||
'a' => array(
|
||||
'dev-master' => array(
|
||||
'uid' => 1,
|
||||
'name' => 'a',
|
||||
'version' => 'dev-master',
|
||||
'extra' => array('branch-alias' => array('dev-master' => '1.0.x-dev')),
|
||||
),
|
||||
'dev-develop' => array(
|
||||
'uid' => 2,
|
||||
'name' => 'a',
|
||||
'version' => 'dev-develop',
|
||||
'extra' => array('branch-alias' => array('dev-develop' => '1.1.x-dev')),
|
||||
),
|
||||
'0.6' => array(
|
||||
'uid' => 3,
|
||||
'name' => 'a',
|
||||
'version' => '0.6',
|
||||
),
|
||||
),
|
||||
array(array(
|
||||
'uid' => 1,
|
||||
'name' => 'a',
|
||||
'version' => 'dev-master',
|
||||
'extra' => array('branch-alias' => array('dev-master' => '1.0.x-dev')),
|
||||
)),
|
||||
array(array(
|
||||
'uid' => 2,
|
||||
'name' => 'a',
|
||||
'version' => 'dev-develop',
|
||||
'extra' => array('branch-alias' => array('dev-develop' => '1.1.x-dev')),
|
||||
)),
|
||||
array(array(
|
||||
'uid' => 3,
|
||||
'name' => 'a',
|
||||
'version' => '0.6',
|
||||
)),
|
||||
)
|
||||
)));
|
||||
|
||||
$pool = $this->getMock('Composer\DependencyResolver\Pool');
|
||||
$pool->expects($this->any())
|
||||
->method('isPackageAcceptable')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$versionParser = new VersionParser();
|
||||
$repo->setRootAliases(array(
|
||||
'a' => array(
|
||||
$versionParser->normalize('0.6') => array('alias' => 'dev-feature', 'alias_normalized' => $versionParser->normalize('dev-feature')),
|
||||
$versionParser->normalize('1.1.x-dev') => array('alias' => '1.0', 'alias_normalized' => $versionParser->normalize('1.0')),
|
||||
),
|
||||
));
|
||||
|
||||
$that = $this;
|
||||
$packages = $repo->loadRecursively(array('a'), function ($name, $stability) use ($that) {
|
||||
$that->assertEquals('a', $name);
|
||||
return true;
|
||||
});
|
||||
$packages = $repo->whatProvides($pool, 'a');
|
||||
|
||||
$this->assertCount(5, $packages);
|
||||
$this->assertEquals(array('1.0.x-dev', 'dev-master', '1.1.x-dev', 'dev-develop', '0.6'), array_map(function ($p) {
|
||||
return $p->getPrettyVersion();
|
||||
}, $packages));
|
||||
$this->assertInstanceOf('Composer\Package\AliasPackage', $packages[2]);
|
||||
$this->assertSame($packages[3], $packages[2]->getAliasOf());
|
||||
$this->assertCount(7, $packages);
|
||||
$this->assertEquals(array('1', '1-alias', '2', '2-alias', '2-root', '3', '3-root'), array_keys($packages));
|
||||
$this->assertInstanceOf('Composer\Package\AliasPackage', $packages['2-root']);
|
||||
$this->assertSame($packages['2'], $packages['2-root']->getAliasOf());
|
||||
$this->assertSame($packages['2'], $packages['2-alias']->getAliasOf());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue