mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
Move VersionParser::parseLinks() to ArrayLoader::parseLinks()
Working towards #3545. parseLinks is a wrapper around VersionParser::parseConstraints() that creates Link objects, and better belongs in ArrayLoader.
This commit is contained in:
parent
2438105e11
commit
14d1f0f3f6
5 changed files with 79 additions and 62 deletions
|
@ -469,50 +469,4 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase
|
|||
array('RC', '2.0.0rc1')
|
||||
);
|
||||
}
|
||||
|
||||
public function pluginApiVersions()
|
||||
{
|
||||
return array(
|
||||
array('1.0'),
|
||||
array('1.0.0'),
|
||||
array('1.0.0.0'),
|
||||
array('1'),
|
||||
array('=1.0.0'),
|
||||
array('==1.0'),
|
||||
array('~1.0.0'),
|
||||
array('*'),
|
||||
array('3.0.*'),
|
||||
array('@stable'),
|
||||
array('1.0.0@stable'),
|
||||
array('^5.1'),
|
||||
array('>=1.0.0 <2.5'),
|
||||
array('x'),
|
||||
array('1.0.0-dev'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider pluginApiVersions
|
||||
*/
|
||||
public function testPluginApiVersionAreKeptAsDeclared($apiVersion)
|
||||
{
|
||||
$parser = new VersionParser;
|
||||
|
||||
/** @var Link[] $links */
|
||||
$links = $parser->parseLinks('Plugin', '9.9.9', '', array('composer-plugin-api' => $apiVersion));
|
||||
|
||||
$this->assertArrayHasKey('composer-plugin-api', $links);
|
||||
$this->assertSame($apiVersion, $links['composer-plugin-api']->getConstraint()->getPrettyString());
|
||||
}
|
||||
|
||||
public function testPluginApiVersionDoesSupportSelfVersion()
|
||||
{
|
||||
$parser = new VersionParser;
|
||||
|
||||
/** @var Link[] $links */
|
||||
$links = $parser->parseLinks('Plugin', '6.6.6', '', array('composer-plugin-api' => 'self.version'));
|
||||
|
||||
$this->assertArrayHasKey('composer-plugin-api', $links);
|
||||
$this->assertSame('6.6.6', $links['composer-plugin-api']->getConstraint()->getPrettyString());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue