From fe15c6a827f2132d4e34cca2ad5f56878af2b111 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 11 Aug 2012 18:27:43 +0200 Subject: [PATCH] Make dev version matches preserve the proper case, fixes #935 --- src/Composer/Package/Version/VersionParser.php | 2 +- tests/Composer/Test/Package/Version/VersionParserTest.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Composer/Package/Version/VersionParser.php b/src/Composer/Package/Version/VersionParser.php index 75b601831..cd1ca30d0 100644 --- a/src/Composer/Package/Version/VersionParser.php +++ b/src/Composer/Package/Version/VersionParser.php @@ -97,7 +97,7 @@ class VersionParser } if ('dev-' === strtolower(substr($version, 0, 4))) { - return strtolower($version); + return 'dev-'.substr($version, 4); } // match classical versioning diff --git a/tests/Composer/Test/Package/Version/VersionParserTest.php b/tests/Composer/Test/Package/Version/VersionParserTest.php index 272f37571..ff64184e3 100644 --- a/tests/Composer/Test/Package/Version/VersionParserTest.php +++ b/tests/Composer/Test/Package/Version/VersionParserTest.php @@ -53,7 +53,8 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase 'parses trunk' => array('dev-trunk', '9999999-dev'), 'parses branches' => array('1.x-dev', '1.9999999.9999999.9999999-dev'), 'parses arbitrary' => array('dev-feature-foo', 'dev-feature-foo'), - 'parses arbitrary2' => array('DEV-FOOBAR', 'dev-foobar'), + 'parses arbitrary2' => array('DEV-FOOBAR', 'dev-FOOBAR'), + 'parses arbitrary3' => array('dev-feature/foo', 'dev-feature/foo'), 'ignores aliases' => array('dev-master as 1.0.0', '9999999-dev'), ); } @@ -102,7 +103,7 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase 'parses master' => array('master', '9999999-dev'), 'parses trunk' => array('trunk', '9999999-dev'), 'parses arbitrary' => array('feature-a', 'dev-feature-a'), - 'parses arbitrary/2' => array('foobar', 'dev-foobar'), + 'parses arbitrary/2' => array('FOOBAR', 'dev-FOOBAR'), ); } @@ -158,6 +159,7 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase 'accepts master/2' => array('dev-master', new VersionConstraint('=', '9999999-dev')), 'accepts arbitrary' => array('dev-feature-a', new VersionConstraint('=', 'dev-feature-a')), 'regression #550' => array('dev-some-fix', new VersionConstraint('=', 'dev-some-fix')), + 'regression #935' => array('dev-CAPS', new VersionConstraint('=', 'dev-CAPS')), 'ignores aliases' => array('dev-master as 1.0.0', new VersionConstraint('=', '9999999-dev')), ); }