From 324ef0f9bb210c626929c93d75233f6c148ce773 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Mon, 20 May 2013 19:10:04 +1200 Subject: [PATCH] Fixed upper bound of wildcard matches. Follow-on from 95b4348afa2ee335d9dc1f9e2fecf579b49f7ddf --- src/Composer/Package/Version/VersionParser.php | 2 +- .../Test/Package/Version/VersionParserTest.php | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Composer/Package/Version/VersionParser.php b/src/Composer/Package/Version/VersionParser.php index 1a412dffd..93c10d80e 100644 --- a/src/Composer/Package/Version/VersionParser.php +++ b/src/Composer/Package/Version/VersionParser.php @@ -324,7 +324,7 @@ class VersionParser } $lowVersion = $this->manipulateVersionString($matches, $position) . "-dev"; - $highVersion = $this->manipulateVersionString($matches, $position, 0, '9999999'); + $highVersion = $this->manipulateVersionString($matches, $position, 1) . "-dev"; if($lowVersion === "0.0.0.0-dev") { return array(new VersionConstraint('<', $highVersion)); diff --git a/tests/Composer/Test/Package/Version/VersionParserTest.php b/tests/Composer/Test/Package/Version/VersionParserTest.php index 5587050b8..19fd9f16f 100644 --- a/tests/Composer/Test/Package/Version/VersionParserTest.php +++ b/tests/Composer/Test/Package/Version/VersionParserTest.php @@ -237,13 +237,13 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase public function wildcardConstraints() { return array( - array('2.*', new VersionConstraint('>=', '2.0.0.0-dev'), new VersionConstraint('<', '2.9999999.9999999.9999999')), - array('20.*', new VersionConstraint('>=', '20.0.0.0-dev'), new VersionConstraint('<', '20.9999999.9999999.9999999')), - array('2.0.*', new VersionConstraint('>=', '2.0.0.0-dev'), new VersionConstraint('<', '2.0.9999999.9999999')), - array('2.2.x', new VersionConstraint('>=', '2.2.0.0-dev'), new VersionConstraint('<', '2.2.9999999.9999999')), - array('2.10.x', new VersionConstraint('>=', '2.10.0.0-dev'), new VersionConstraint('<', '2.10.9999999.9999999')), - array('2.1.3.*', new VersionConstraint('>=', '2.1.3.0-dev'), new VersionConstraint('<', '2.1.3.9999999')), - array('0.*', null, new VersionConstraint('<', '0.9999999.9999999.9999999')), + array('2.*', new VersionConstraint('>=', '2.0.0.0-dev'), new VersionConstraint('<', '3.0.0.0-dev')), + array('20.*', new VersionConstraint('>=', '20.0.0.0-dev'), new VersionConstraint('<', '21.0.0.0-dev')), + array('2.0.*', new VersionConstraint('>=', '2.0.0.0-dev'), new VersionConstraint('<', '2.1.0.0-dev')), + array('2.2.x', new VersionConstraint('>=', '2.2.0.0-dev'), new VersionConstraint('<', '2.3.0.0-dev')), + array('2.10.x', new VersionConstraint('>=', '2.10.0.0-dev'), new VersionConstraint('<', '2.11.0.0-dev')), + array('2.1.3.*', new VersionConstraint('>=', '2.1.3.0-dev'), new VersionConstraint('<', '2.1.4.0-dev')), + array('0.*', null, new VersionConstraint('<', '1.0.0.0-dev')), ); }