1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00

Fix handling of dev versions and consolidate logic, refs #7119

This commit is contained in:
Jordi Boggiano 2018-04-13 13:48:30 +02:00
parent 24ad6307a7
commit c917865fe9
8 changed files with 78 additions and 43 deletions

View file

@ -35,4 +35,26 @@ class VersionParserTest extends TestCase
array(array('php', 'ext-apcu'), array(array('name' => 'php'), array('name' => 'ext-apcu'))),
);
}
/**
* @dataProvider getIsUpgradeTests
*/
public function testIsUpgrade($from, $to, $expected)
{
$this->assertSame($expected, VersionParser::isUpgrade($from, $to));
}
public function getIsUpgradeTests()
{
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', '9999999-dev', true),
array('9999999-dev', '9999999-dev', true),
array('9999999-dev', '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),
);
}
}