1
0
Fork 0

Alias dev-master/trunk/default to 9999999-dev instead of normalizing the version to that, fixes #8323

pull/8684/head
Jordi Boggiano 2020-03-11 13:37:39 +01:00
parent 97e2a249e8
commit a7a975ec1c
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
21 changed files with 200 additions and 66 deletions

View File

@ -24,7 +24,7 @@
"require": { "require": {
"php": "^5.3.2 || ^7.0", "php": "^5.3.2 || ^7.0",
"composer/ca-bundle": "^1.0", "composer/ca-bundle": "^1.0",
"composer/semver": "^1.0", "composer/semver": "^2.0@dev",
"composer/spdx-licenses": "^1.2", "composer/spdx-licenses": "^1.2",
"composer/xdebug-handler": "^1.1", "composer/xdebug-handler": "^1.1",
"justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0", "justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0",

109
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "7bfefa6f7d4d8c18836028dae680bd4f", "content-hash": "a0a9399315ac0b612d4296b8df745112",
"packages": [ "packages": [
{ {
"name": "composer/ca-bundle", "name": "composer/ca-bundle",
@ -60,20 +60,25 @@
"ssl", "ssl",
"tls" "tls"
], ],
"support": {
"irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/ca-bundle/issues",
"source": "https://github.com/composer/ca-bundle/tree/master"
},
"time": "2020-01-13T10:02:55+00:00" "time": "2020-01-13T10:02:55+00:00"
}, },
{ {
"name": "composer/semver", "name": "composer/semver",
"version": "1.5.1", "version": "2.0.x-dev",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/semver.git", "url": "https://github.com/composer/semver.git",
"reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de" "reference": "4df5ff3249f01018504939d66040d8d2b783d820"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/semver/zipball/c6bea70230ef4dd483e6bbcab6005f682ed3a8de", "url": "https://api.github.com/repos/composer/semver/zipball/4df5ff3249f01018504939d66040d8d2b783d820",
"reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de", "reference": "4df5ff3249f01018504939d66040d8d2b783d820",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -85,7 +90,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.x-dev" "dev-master": "2.x-dev"
} }
}, },
"autoload": { "autoload": {
@ -121,7 +126,22 @@
"validation", "validation",
"versioning" "versioning"
], ],
"time": "2020-01-13T12:06:48+00:00" "support": {
"irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/semver/issues",
"source": "https://github.com/composer/semver/tree/2.0"
},
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2020-03-11T13:41:23+00:00"
}, },
{ {
"name": "composer/spdx-licenses", "name": "composer/spdx-licenses",
@ -181,6 +201,11 @@
"spdx", "spdx",
"validator" "validator"
], ],
"support": {
"irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/spdx-licenses/issues",
"source": "https://github.com/composer/spdx-licenses/tree/1.5.3"
},
"time": "2020-02-14T07:44:31+00:00" "time": "2020-02-14T07:44:31+00:00"
}, },
{ {
@ -225,6 +250,11 @@
"Xdebug", "Xdebug",
"performance" "performance"
], ],
"support": {
"irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/xdebug-handler/issues",
"source": "https://github.com/composer/xdebug-handler/tree/master"
},
"funding": [ "funding": [
{ {
"url": "https://packagist.com", "url": "https://packagist.com",
@ -388,12 +418,6 @@
"license": [ "license": [
"MIT" "MIT"
], ],
"authors": [
{
"name": "Jan Sorgalla",
"email": "jsorgalla@gmail.com"
}
],
"description": "A lightweight implementation of CommonJS Promises/A for PHP", "description": "A lightweight implementation of CommonJS Promises/A for PHP",
"time": "2016-03-07T13:46:50+00:00" "time": "2016-03-07T13:46:50+00:00"
}, },
@ -492,6 +516,10 @@
"keywords": [ "keywords": [
"phar" "phar"
], ],
"support": {
"issues": "https://github.com/Seldaek/phar-utils/issues",
"source": "https://github.com/Seldaek/phar-utils/tree/1.1.0"
},
"time": "2020-02-14T15:25:33+00:00" "time": "2020-02-14T15:25:33+00:00"
}, },
{ {
@ -761,6 +789,16 @@
"license": [ "license": [
"MIT" "MIT"
], ],
"authors": [
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for ctype functions", "description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"keywords": [ "keywords": [
@ -769,6 +807,9 @@
"polyfill", "polyfill",
"portable" "portable"
], ],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/master"
},
"time": "2020-01-13T11:15:53+00:00" "time": "2020-01-13T11:15:53+00:00"
}, },
{ {
@ -828,6 +869,9 @@
"portable", "portable",
"shim" "shim"
], ],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/master"
},
"time": "2020-01-13T11:15:53+00:00" "time": "2020-01-13T11:15:53+00:00"
}, },
{ {
@ -983,6 +1027,16 @@
"license": [ "license": [
"MIT" "MIT"
], ],
"authors": [
{
"name": "Mike van Riel",
"email": "mike.vanriel@naenius.com"
}
],
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/release/2.x"
},
"time": "2016-01-25T08:17:30+00:00" "time": "2016-01-25T08:17:30+00:00"
}, },
{ {
@ -1046,6 +1100,10 @@
"spy", "spy",
"stub" "stub"
], ],
"support": {
"issues": "https://github.com/phpspec/prophecy/issues",
"source": "https://github.com/phpspec/prophecy/tree/v1.10.3"
},
"time": "2020-03-05T15:02:03+00:00" "time": "2020-03-05T15:02:03+00:00"
}, },
{ {
@ -1110,6 +1168,10 @@
"compare", "compare",
"equality" "equality"
], ],
"support": {
"issues": "https://github.com/sebastianbergmann/comparator/issues",
"source": "https://github.com/sebastianbergmann/comparator/tree/1.2"
},
"time": "2017-01-29T09:50:25+00:00" "time": "2017-01-29T09:50:25+00:00"
}, },
{ {
@ -1162,6 +1224,10 @@
"keywords": [ "keywords": [
"diff" "diff"
], ],
"support": {
"issues": "https://github.com/sebastianbergmann/diff/issues",
"source": "https://github.com/sebastianbergmann/diff/tree/1.4"
},
"time": "2017-05-22T07:24:03+00:00" "time": "2017-05-22T07:24:03+00:00"
}, },
{ {
@ -1229,6 +1295,10 @@
"export", "export",
"exporter" "exporter"
], ],
"support": {
"issues": "https://github.com/sebastianbergmann/exporter/issues",
"source": "https://github.com/sebastianbergmann/exporter/tree/master"
},
"time": "2016-11-19T08:54:04+00:00" "time": "2016-11-19T08:54:04+00:00"
}, },
{ {
@ -1282,6 +1352,10 @@
], ],
"description": "Provides functionality to recursively process PHP variables", "description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context", "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"support": {
"issues": "https://github.com/sebastianbergmann/recursion-context/issues",
"source": "https://github.com/sebastianbergmann/recursion-context/tree/master"
},
"time": "2016-11-19T07:33:16+00:00" "time": "2016-11-19T07:33:16+00:00"
}, },
{ {
@ -1347,6 +1421,9 @@
], ],
"description": "Symfony PHPUnit Bridge", "description": "Symfony PHPUnit Bridge",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/phpunit-bridge/tree/v3.4.38"
},
"funding": [ "funding": [
{ {
"url": "https://symfony.com/sponsor", "url": "https://symfony.com/sponsor",
@ -1366,7 +1443,9 @@
], ],
"aliases": [], "aliases": [],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": [], "stability-flags": {
"composer/semver": 20
},
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": { "platform": {
@ -1376,5 +1455,5 @@
"platform-overrides": { "platform-overrides": {
"php": "5.3.9" "php": "5.3.9"
}, },
"plugin-api-version": "1.1.0" "plugin-api-version": "2.0.0"
} }

View File

@ -160,6 +160,7 @@ EOT
$installedRepo = new InstalledRepository(array($platformRepo)); $installedRepo = new InstalledRepository(array($platformRepo));
if ($composer) { if ($composer) {
$repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories()); $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
$installedRepo->addRepository($composer->getRepositoryManager()->getLocalRepository());
} else { } else {
$defaultRepos = RepositoryFactory::defaultRepos($io); $defaultRepos = RepositoryFactory::defaultRepos($io);
$repos = new CompositeRepository($defaultRepos); $repos = new CompositeRepository($defaultRepos);
@ -675,15 +676,17 @@ EOT
*/ */
protected function printVersions(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo) protected function printVersions(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo)
{ {
uasort($versions, 'version_compare'); $versions = array_keys($versions);
$versions = array_keys(array_reverse($versions)); $versions = Semver::rsort($versions);
// highlight installed version // highlight installed version
if ($installedRepo->hasPackage($package)) { if ($installedPackages = $installedRepo->findPackages($package->getName())) {
$installedVersion = $package->getPrettyVersion(); foreach ($installedPackages as $installedPackage) {
$key = array_search($installedVersion, $versions); $installedVersion = $installedPackage->getPrettyVersion();
if (false !== $key) { $key = array_search($installedVersion, $versions);
$versions[$key] = '<info>* ' . $installedVersion . '</info>'; if (false !== $key) {
$versions[$key] = '<info>* ' . $installedVersion . '</info>';
}
} }
} }

View File

@ -273,6 +273,10 @@ class Problem
$prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion(); $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
} }
foreach ($prepared as $name => $package) { foreach ($prepared as $name => $package) {
// remove the implicit dev-master alias to avoid cruft in the display
if (isset($package['versions']['9999999-dev']) && isset($package['versions']['dev-master'])) {
unset($package['versions']['9999999-dev']);
}
$prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']'; $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
} }

View File

@ -89,6 +89,11 @@ class ArrayLoader implements LoaderInterface
// handle already normalized versions // handle already normalized versions
if (isset($config['version_normalized'])) { if (isset($config['version_normalized'])) {
$version = $config['version_normalized']; $version = $config['version_normalized'];
// handling of existing repos which need to remain composer v1 compatible, in case the version_normalized contained 9999999-dev, we renormalize it
if ($version === '9999999-dev') {
$version = $this->versionParser->normalize($config['version']);
}
} else { } else {
$version = $this->versionParser->normalize($config['version']); $version = $this->versionParser->normalize($config['version']);
} }
@ -320,39 +325,42 @@ class ArrayLoader implements LoaderInterface
*/ */
public function getBranchAlias(array $config) public function getBranchAlias(array $config)
{ {
if (('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4)) if ('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4)) {
|| !isset($config['extra']['branch-alias'])
|| !is_array($config['extra']['branch-alias'])
) {
return; return;
} }
foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) { if (isset($config['extra']['branch-alias']) && is_array($config['extra']['branch-alias'])) {
// ensure it is an alias to a -dev package foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
if ('-dev' !== substr($targetBranch, -4)) { // ensure it is an alias to a -dev package
continue; if ('-dev' !== substr($targetBranch, -4)) {
} continue;
}
// normalize without -dev and ensure it's a numeric branch that is parseable // normalize without -dev and ensure it's a numeric branch that is parseable
$validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4)); $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
if ('-dev' !== substr($validatedTargetBranch, -4)) { if ('-dev' !== substr($validatedTargetBranch, -4)) {
continue; continue;
} }
// ensure that it is the current branch aliasing itself // ensure that it is the current branch aliasing itself
if (strtolower($config['version']) !== strtolower($sourceBranch)) { if (strtolower($config['version']) !== strtolower($sourceBranch)) {
continue; continue;
} }
// If using numeric aliases ensure the alias is a valid subversion // If using numeric aliases ensure the alias is a valid subversion
if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch)) if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
&& ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch)) && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
&& (stripos($targetPrefix, $sourcePrefix) !== 0) && (stripos($targetPrefix, $sourcePrefix) !== 0)
) { ) {
continue; continue;
} }
return $validatedTargetBranch; return $validatedTargetBranch;
}
}
if (in_array($config['version'], array('dev-master', 'dev-default', 'dev-trunk'), true)) {
return '9999999-dev';
} }
} }
} }

View File

@ -219,7 +219,7 @@ class ValidatingArrayLoader implements LoaderInterface
} }
} }
$unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master')); $unboundConstraint = new Constraint('=', '10000000-dev');
$stableConstraint = new Constraint('=', '1.0.0'); $stableConstraint = new Constraint('=', '1.0.0');
foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) { foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {

View File

@ -70,6 +70,9 @@ class VersionParser extends SemverVersionParser
*/ */
public static function isUpgrade($normalizedFrom, $normalizedTo) public static function isUpgrade($normalizedFrom, $normalizedTo)
{ {
$normalizedFrom = str_replace(array('dev-master', 'dev-trunk', 'dev-default'), '9999999-dev', $normalizedFrom);
$normalizedTo = str_replace(array('dev-master', 'dev-trunk', 'dev-default'), '9999999-dev', $normalizedTo);
if (substr($normalizedFrom, 0, 4) === 'dev-' || substr($normalizedTo, 0, 4) === 'dev-') { if (substr($normalizedFrom, 0, 4) === 'dev-' || substr($normalizedTo, 0, 4) === 'dev-') {
return true; return true;
} }

View File

@ -28,4 +28,5 @@ install
--EXPECT-- --EXPECT--
Installing a/aliased (dev-master abcd) Installing a/aliased (dev-master abcd)
Marking a/aliased (1.0.0) as installed, alias of a/aliased (dev-master abcd) Marking a/aliased (1.0.0) as installed, alias of a/aliased (dev-master abcd)
Marking a/aliased (9999999-dev abcd) as installed, alias of a/aliased (dev-master abcd)
Installing b/requirer (1.0.0) Installing b/requirer (1.0.0)

View File

@ -14,12 +14,12 @@ Aliases take precedence over default package even if default is selected
"name": "a/req", "version": "dev-master", "name": "a/req", "version": "dev-master",
"extra": { "branch-alias": { "dev-master": "1.0.x-dev" } }, "extra": { "branch-alias": { "dev-master": "1.0.x-dev" } },
"source": { "reference": "forked", "type": "git", "url": "" } "source": { "reference": "forked", "type": "git", "url": "" }
} },
] {
}, "name": "a/req", "version": "dev-master",
{ "extra": { "branch-alias": { "dev-master": "1.0.x-dev" } },
"type": "package", "source": { "reference": "master", "type": "git", "url": "" }
"package": [ },
{ {
"name": "a/a", "version": "dev-master", "name": "a/a", "version": "dev-master",
"require": { "a/req": "dev-master" } "require": { "a/req": "dev-master" }
@ -27,11 +27,6 @@ Aliases take precedence over default package even if default is selected
{ {
"name": "a/b", "version": "dev-master", "name": "a/b", "version": "dev-master",
"require": { "a/req": "dev-master" } "require": { "a/req": "dev-master" }
},
{
"name": "a/req", "version": "dev-master",
"extra": { "branch-alias": { "dev-master": "1.0.x-dev" } },
"source": { "reference": "master", "type": "git", "url": "" }
} }
] ]
} }
@ -66,7 +61,7 @@ Aliases take precedence over default package even if default is selected
"aliases": [ "aliases": [
{ {
"alias": "dev-master", "alias": "dev-master",
"alias_normalized": "9999999-dev", "alias_normalized": "dev-master",
"version": "dev-feature-foo", "version": "dev-feature-foo",
"package": "a/req" "package": "a/req"
} }
@ -88,4 +83,6 @@ install
Installing a/req (dev-feature-foo feat.f) Installing a/req (dev-feature-foo feat.f)
Marking a/req (dev-master feat.f) as installed, alias of a/req (dev-feature-foo feat.f) Marking a/req (dev-master feat.f) as installed, alias of a/req (dev-feature-foo feat.f)
Installing a/a (dev-master) Installing a/a (dev-master)
Marking a/a (9999999-dev) as installed, alias of a/a (dev-master)
Installing a/b (dev-master) Installing a/b (dev-master)
Marking a/b (9999999-dev) as installed, alias of a/b (dev-master)

View File

@ -34,3 +34,4 @@ Installing b/b (dev-foo)
Marking b/b (dev-master) as installed, alias of b/b (dev-foo) Marking b/b (dev-master) as installed, alias of b/b (dev-foo)
Marking b/b (1.0.x-dev) as installed, alias of b/b (dev-foo) Marking b/b (1.0.x-dev) as installed, alias of b/b (dev-foo)
Installing a/a (dev-master) Installing a/a (dev-master)
Marking a/a (9999999-dev) as installed, alias of a/a (dev-master)

View File

@ -53,3 +53,4 @@ install --prefer-dist
} }
--EXPECT-- --EXPECT--
Installing a/a (dev-master) Installing a/a (dev-master)
Marking a/a (9999999-dev) as installed, alias of a/a (dev-master)

View File

@ -21,3 +21,4 @@ Installs a dev package forcing it's reference
install install
--EXPECT-- --EXPECT--
Installing a/a (dev-master def000) Installing a/a (dev-master def000)
Marking a/a (9999999-dev def000) as installed, alias of a/a (dev-master def000)

View File

@ -0,0 +1,31 @@
--TEST--
Test that a conflict against >=5 does not include dev-master or other dev-x
--COMPOSER--
{
"repositories": [
{
"type": "package",
"package": [
{ "name": "conflicter/pkg", "version": "1.0.0", "conflict": { "victim/pkg": ">=5", "victim/pkg2": ">=5" } },
{ "name": "victim/pkg", "version": "dev-master" },
{ "name": "victim/pkg2", "version": "dev-foo" }
]
}
],
"require": {
"conflicter/pkg": "1.0.0",
"victim/pkg": "*",
"victim/pkg2": "*"
},
"minimum-stability": "dev"
}
--RUN--
update
--EXPECT--
Installing conflicter/pkg (1.0.0)
Installing victim/pkg (dev-master)
Marking victim/pkg (9999999-dev) as installed, alias of victim/pkg (dev-master)
Installing victim/pkg2 (dev-foo)

View File

@ -217,4 +217,5 @@ update a/a b/b d/d g/g
Upgrading a/a (dev-master 1111111 => dev-master 2222222) Upgrading a/a (dev-master 1111111 => dev-master 2222222)
Upgrading b/b (2.0.3 1111111 => 2.0.3 2222222) Upgrading b/b (2.0.3 1111111 => 2.0.3 2222222)
Installing e/e (dev-master 1111111) Installing e/e (dev-master 1111111)
Marking e/e (9999999-dev 1111111) as installed, alias of e/e (dev-master 1111111)
Upgrading g/g (dev-master 0000000 => dev-master 1111111) Upgrading g/g (dev-master 0000000 => dev-master 1111111)

View File

@ -38,4 +38,5 @@ Updating a dev package to its latest ref should pick up new dependencies
update update
--EXPECT-- --EXPECT--
Installing a/dependency (dev-master ref) Installing a/dependency (dev-master ref)
Marking a/dependency (9999999-dev ref) as installed, alias of a/dependency (dev-master ref)
Upgrading a/devpackage (dev-master oldref => dev-master newref) Upgrading a/devpackage (dev-master oldref => dev-master newref)

View File

@ -47,3 +47,4 @@ Downgrading from unstable to more stable package should work even if already ins
update update
--EXPECT-- --EXPECT--
Downgrading a/a (dev-master abcd => 1.0.0) Downgrading a/a (dev-master abcd => 1.0.0)
Marking a/a (9999999-dev abcd) as uninstalled, alias of a/a (dev-master abcd)

View File

@ -45,3 +45,4 @@ update
} }
--EXPECT-- --EXPECT--
Uninstalling a/a (dev-master 1234) Uninstalling a/a (dev-master 1234)
Marking a/a (9999999-dev 1234) as uninstalled, alias of a/a (dev-master 1234)

View File

@ -43,3 +43,4 @@ install
--EXPECT-- --EXPECT--
Uninstalling a/dependency (dev-master ref) Uninstalling a/dependency (dev-master ref)
Upgrading a/devpackage (dev-master oldref => dev-master newref) Upgrading a/devpackage (dev-master oldref => dev-master newref)
Marking a/dependency (9999999-dev ref) as uninstalled, alias of a/dependency (dev-master ref)

View File

@ -160,6 +160,8 @@ class RootPackageLoaderTest extends TestCase
$loader = new RootPackageLoader($manager, $config, null, new VersionGuesser($config, $executor, new VersionParser())); $loader = new RootPackageLoader($manager, $config, null, new VersionGuesser($config, $executor, new VersionParser()));
$package = $loader->load(array('require' => array('foo/bar' => 'self.version'))); $package = $loader->load(array('require' => array('foo/bar' => 'self.version')));
$this->assertEquals("9999999-dev", $package->getPrettyVersion());
$package = $package->getAliasOf();
$this->assertEquals("dev-master", $package->getPrettyVersion()); $this->assertEquals("dev-master", $package->getPrettyVersion());
} }

View File

@ -356,7 +356,6 @@ class ValidatingArrayLoaderTest extends TestCase
'require' => array( 'require' => array(
'foo/baz' => '*', 'foo/baz' => '*',
'bar/baz' => '>=1.0', 'bar/baz' => '>=1.0',
'bar/foo' => 'dev-master',
'bar/hacked' => '@stable', 'bar/hacked' => '@stable',
'bar/woo' => '1.0.0', 'bar/woo' => '1.0.0',
), ),
@ -364,7 +363,6 @@ class ValidatingArrayLoaderTest extends TestCase
array( array(
'require.foo/baz : unbound version constraints (*) should be avoided', 'require.foo/baz : unbound version constraints (*) should be avoided',
'require.bar/baz : unbound version constraints (>=1.0) should be avoided', 'require.bar/baz : unbound version constraints (>=1.0) should be avoided',
'require.bar/foo : unbound version constraints (dev-master) should be avoided',
'require.bar/hacked : unbound version constraints (@stable) should be avoided', 'require.bar/hacked : unbound version constraints (@stable) should be avoided',
'require.bar/woo : exact version constraints (1.0.0) should be avoided if the package follows semantic versioning', 'require.bar/woo : exact version constraints (1.0.0) should be avoided if the package follows semantic versioning',
), ),

View File

@ -89,7 +89,7 @@ class VersionGuesserTest extends TestCase
$guesser = new VersionGuesser($config, $executor, new VersionParser()); $guesser = new VersionGuesser($config, $executor, new VersionParser());
$versionArray = $guesser->guessVersion(array(), 'dummy/path'); $versionArray = $guesser->guessVersion(array(), 'dummy/path');
$this->assertEquals("9999999-dev", $versionArray['version']); $this->assertEquals("dev-".$branch, $versionArray['version']);
$this->assertEquals("dev-".$branch, $versionArray['pretty_version']); $this->assertEquals("dev-".$branch, $versionArray['pretty_version']);
$this->assertEmpty($versionArray['commit']); $this->assertEmpty($versionArray['commit']);
} }
@ -124,7 +124,7 @@ class VersionGuesserTest extends TestCase
$guesser = new VersionGuesser($config, $executor, new VersionParser()); $guesser = new VersionGuesser($config, $executor, new VersionParser());
$versionArray = $guesser->guessVersion(array(), 'dummy/path'); $versionArray = $guesser->guessVersion(array(), 'dummy/path');
$this->assertEquals("9999999-dev", $versionArray['version']); $this->assertEquals("dev-master", $versionArray['version']);
$this->assertEquals("dev-master", $versionArray['pretty_version']); $this->assertEquals("dev-master", $versionArray['pretty_version']);
$this->assertArrayNotHasKey('feature_version', $versionArray); $this->assertArrayNotHasKey('feature_version', $versionArray);
$this->assertArrayNotHasKey('feature_pretty_version', $versionArray); $this->assertArrayNotHasKey('feature_pretty_version', $versionArray);