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

@ -32,21 +32,17 @@ class VersionParserTest extends TestCase
public function provideParseNameVersionPairsData(): array
{
return array(
array(array('php:^7.0'), array(array('name' => 'php', 'version' => '^7.0'))),
array(array('php', '^7.0'), array(array('name' => 'php', 'version' => '^7.0'))),
array(array('php', 'ext-apcu'), array(array('name' => 'php'), array('name' => 'ext-apcu'))),
array(array('foo/*', 'bar*', 'acme/baz', '*@dev'), array(array('name' => 'foo/*'), array('name' => 'bar*'), array('name' => 'acme/baz', 'version' => '*@dev'))),
array(array('php', '*'), array(array('name' => 'php', 'version' => '*'))),
);
return [
[['php:^7.0'], [['name' => 'php', 'version' => '^7.0']]],
[['php', '^7.0'], [['name' => 'php', 'version' => '^7.0']]],
[['php', 'ext-apcu'], [['name' => 'php'], ['name' => 'ext-apcu']]],
[['foo/*', 'bar*', 'acme/baz', '*@dev'], [['name' => 'foo/*'], ['name' => 'bar*'], ['name' => 'acme/baz', 'version' => '*@dev']]],
[['php', '*'], [['name' => 'php', 'version' => '*']]],
];
}
/**
* @dataProvider provideIsUpgradeTests
*
* @param string $from
* @param string $to
* @param bool $expected
*/
public function testIsUpgrade(string $from, string $to, bool $expected): void
{
@ -55,15 +51,15 @@ class VersionParserTest extends TestCase
public function provideIsUpgradeTests(): array
{
return array(
array('0.9.0.0', '1.0.0.0', true),
array('1.0.0.0', '0.9.0.0', false),
array('1.0.0.0', VersionParser::DEFAULT_BRANCH_ALIAS, true),
array(VersionParser::DEFAULT_BRANCH_ALIAS, VersionParser::DEFAULT_BRANCH_ALIAS, true),
array(VersionParser::DEFAULT_BRANCH_ALIAS, '1.0.0.0', false),
array('1.0.0.0', 'dev-foo', true),
array('dev-foo', 'dev-foo', true),
array('dev-foo', '1.0.0.0', true),
);
return [
['0.9.0.0', '1.0.0.0', true],
['1.0.0.0', '0.9.0.0', false],
['1.0.0.0', VersionParser::DEFAULT_BRANCH_ALIAS, true],
[VersionParser::DEFAULT_BRANCH_ALIAS, VersionParser::DEFAULT_BRANCH_ALIAS, true],
[VersionParser::DEFAULT_BRANCH_ALIAS, '1.0.0.0', false],
['1.0.0.0', 'dev-foo', true],
['dev-foo', 'dev-foo', true],
['dev-foo', '1.0.0.0', true],
];
}
}