Update lock file to contain the complete package info, fixes #890
parent
ab1c7fbb9b
commit
83239aa338
|
@ -2,24 +2,200 @@
|
||||||
"hash": "1023850095295cc1307c2219a0382930",
|
"hash": "1023850095295cc1307c2219a0382930",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"package": "justinrainbow/json-schema",
|
"name": "justinrainbow/json-schema",
|
||||||
"version": "1.1.0"
|
"version": "1.1.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/justinrainbow/json-schema.git",
|
||||||
|
"reference": "v1.1.0"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://github.com/justinrainbow/json-schema/zipball/v1.1.0",
|
||||||
|
"reference": "v1.1.0",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.0"
|
||||||
|
},
|
||||||
|
"time": "2012-01-02 22:33:17",
|
||||||
|
"type": "library",
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"JsonSchema": "src/"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"package": "seld/jsonlint",
|
"name": "seld/jsonlint",
|
||||||
"version": "1.0.0"
|
"version": "1.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "http://github.com/Seldaek/jsonlint",
|
||||||
|
"reference": "1.0.0"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://github.com/Seldaek/jsonlint/zipball/1.0.0",
|
||||||
|
"reference": "1.0.0",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.0"
|
||||||
|
},
|
||||||
|
"time": "2012-03-12 05:52:32",
|
||||||
|
"bin": [
|
||||||
|
"bin/jsonlint"
|
||||||
|
],
|
||||||
|
"type": "library",
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Seld\\JsonLint": "src/"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"package": "symfony/console",
|
"name": "symfony/console",
|
||||||
"version": "v2.1.0"
|
"version": "v2.1.1",
|
||||||
|
"target-dir": "Symfony/Component/Console",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/Console",
|
||||||
|
"reference": "v2.1.1"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://github.com/symfony/Console/zipball/v2.1.1",
|
||||||
|
"reference": "v2.1.1",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"time": "2012-08-22 11:48:41",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Symfony\\Component\\Console": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "http://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony Console Component",
|
||||||
|
"homepage": "http://symfony.com"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"package": "symfony/finder",
|
"name": "symfony/finder",
|
||||||
"version": "v2.1.0"
|
"version": "v2.1.1",
|
||||||
|
"target-dir": "Symfony/Component/Finder",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/Finder",
|
||||||
|
"reference": "v2.1.0-RC2"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://github.com/symfony/Finder/zipball/v2.1.0-RC2",
|
||||||
|
"reference": "v2.1.0-RC2",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"time": "2012-08-22 11:48:41",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Symfony\\Component\\Finder": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "http://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony Finder Component",
|
||||||
|
"homepage": "http://symfony.com"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"package": "symfony/process",
|
"name": "symfony/process",
|
||||||
"version": "v2.1.0"
|
"version": "v2.1.1",
|
||||||
|
"target-dir": "Symfony/Component/Process",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/Process",
|
||||||
|
"reference": "v2.1.1"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://github.com/symfony/Process/zipball/v2.1.1",
|
||||||
|
"reference": "v2.1.1",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"time": "2012-08-30 10:49:05",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Symfony\\Component\\Process": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "http://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony Process Component",
|
||||||
|
"homepage": "http://symfony.com"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": null,
|
"packages-dev": null,
|
||||||
|
|
|
@ -234,8 +234,10 @@ class Installer
|
||||||
$stabilityFlags = $this->package->getStabilityFlags();
|
$stabilityFlags = $this->package->getStabilityFlags();
|
||||||
|
|
||||||
// initialize locker to create aliased packages
|
// initialize locker to create aliased packages
|
||||||
|
$installFromLock = false;
|
||||||
if (!$this->update && $this->locker->isLocked($devMode)) {
|
if (!$this->update && $this->locker->isLocked($devMode)) {
|
||||||
$lockedPackages = $this->locker->getLockedPackages($devMode);
|
$installFromLock = true;
|
||||||
|
$lockedRepository = $this->locker->getLockedRepository($devMode);
|
||||||
$minimumStability = $this->locker->getMinimumStability();
|
$minimumStability = $this->locker->getMinimumStability();
|
||||||
$stabilityFlags = $this->locker->getStabilityFlags();
|
$stabilityFlags = $this->locker->getStabilityFlags();
|
||||||
}
|
}
|
||||||
|
@ -252,13 +254,15 @@ class Installer
|
||||||
// creating repository pool
|
// creating repository pool
|
||||||
$pool = new Pool($minimumStability, $stabilityFlags);
|
$pool = new Pool($minimumStability, $stabilityFlags);
|
||||||
$pool->addRepository($installedRepo, $aliases);
|
$pool->addRepository($installedRepo, $aliases);
|
||||||
|
if ($installFromLock) {
|
||||||
|
$pool->addRepository($lockedRepository);
|
||||||
|
}
|
||||||
$repositories = $this->repositoryManager->getRepositories();
|
$repositories = $this->repositoryManager->getRepositories();
|
||||||
foreach ($repositories as $repository) {
|
foreach ($repositories as $repository) {
|
||||||
$pool->addRepository($repository, $aliases);
|
$pool->addRepository($repository, $aliases);
|
||||||
}
|
}
|
||||||
|
|
||||||
// creating requirements request
|
// creating requirements request
|
||||||
$installFromLock = false;
|
|
||||||
$request = new Request($pool);
|
$request = new Request($pool);
|
||||||
|
|
||||||
$constraint = new VersionConstraint('=', $this->package->getVersion());
|
$constraint = new VersionConstraint('=', $this->package->getVersion());
|
||||||
|
@ -274,15 +278,14 @@ class Installer
|
||||||
foreach ($links as $link) {
|
foreach ($links as $link) {
|
||||||
$request->install($link->getTarget(), $link->getConstraint());
|
$request->install($link->getTarget(), $link->getConstraint());
|
||||||
}
|
}
|
||||||
} elseif ($this->locker->isLocked($devMode)) {
|
} elseif ($installFromLock) {
|
||||||
$installFromLock = true;
|
|
||||||
$this->io->write('<info>Installing '.($devMode ? 'dev ': '').'dependencies from lock file</info>');
|
$this->io->write('<info>Installing '.($devMode ? 'dev ': '').'dependencies from lock file</info>');
|
||||||
|
|
||||||
if (!$this->locker->isFresh() && !$devMode) {
|
if (!$this->locker->isFresh() && !$devMode) {
|
||||||
$this->io->write('<warning>Your lock file is out of sync with your composer.json, run "composer.phar update" to update dependencies</warning>');
|
$this->io->write('<warning>Your lock file is out of sync with your composer.json, run "composer.phar update" to update dependencies</warning>');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($lockedPackages as $package) {
|
foreach ($lockedRepository->getPackages() as $package) {
|
||||||
$version = $package->getVersion();
|
$version = $package->getVersion();
|
||||||
if (isset($aliases[$package->getName()][$version])) {
|
if (isset($aliases[$package->getName()][$version])) {
|
||||||
$version = $aliases[$package->getName()][$version]['alias_normalized'];
|
$version = $aliases[$package->getName()][$version]['alias_normalized'];
|
||||||
|
@ -316,7 +319,7 @@ class Installer
|
||||||
// to the version specified in the lock, or their currently installed version
|
// to the version specified in the lock, or their currently installed version
|
||||||
if ($this->update && $this->updateWhitelist) {
|
if ($this->update && $this->updateWhitelist) {
|
||||||
if ($this->locker->isLocked($devMode)) {
|
if ($this->locker->isLocked($devMode)) {
|
||||||
$currentPackages = $this->locker->getLockedPackages($devMode);
|
$currentPackages = $this->locker->getLockedRepository($devMode)->getPackages();
|
||||||
} else {
|
} else {
|
||||||
$currentPackages = $installedRepo->getPackages();
|
$currentPackages = $installedRepo->getPackages();
|
||||||
}
|
}
|
||||||
|
@ -381,18 +384,20 @@ class Installer
|
||||||
|
|
||||||
// force update to locked version if it does not match the installed version
|
// force update to locked version if it does not match the installed version
|
||||||
if ($installFromLock) {
|
if ($installFromLock) {
|
||||||
$lockData = $this->locker->getLockData();
|
|
||||||
unset($lockedReference);
|
unset($lockedReference);
|
||||||
foreach ($lockData['packages'] as $lockedPackage) {
|
foreach ($lockedRepository->findPackages($package->getName()) as $lockedPackage) {
|
||||||
if (!empty($lockedPackage['source-reference']) && strtolower($lockedPackage['package']) === $package->getName()) {
|
if (
|
||||||
$lockedReference = $lockedPackage['source-reference'];
|
$lockedPackage->isDev()
|
||||||
|
&& $lockedPackage->getSourceReference()
|
||||||
|
&& $lockedPackage->getSourceReference() !== $package->getSourceReference()
|
||||||
|
) {
|
||||||
|
$newPackage = clone $package;
|
||||||
|
$newPackage->setSourceReference($lockedPackage->getSourceReference());
|
||||||
|
$operations[] = new UpdateOperation($package, $newPackage);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($lockedReference) && $lockedReference !== $package->getSourceReference()) {
|
|
||||||
// changing the source ref to update to will be handled in the operations loop below
|
|
||||||
$operations[] = new UpdateOperation($package, clone $package);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// force update to latest on update
|
// force update to latest on update
|
||||||
if ($this->update) {
|
if ($this->update) {
|
||||||
|
@ -455,29 +460,8 @@ class Installer
|
||||||
$this->eventDispatcher->dispatchPackageEvent(constant($event), $operation);
|
$this->eventDispatcher->dispatchPackageEvent(constant($event), $operation);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if installing from lock, restore dev packages' references to their locked state
|
// not installing from lock, force dev packages' references if they're in root package refs
|
||||||
if ($installFromLock) {
|
if (!$installFromLock) {
|
||||||
$package = null;
|
|
||||||
if ('update' === $operation->getJobType()) {
|
|
||||||
$package = $operation->getTargetPackage();
|
|
||||||
} elseif ('install' === $operation->getJobType()) {
|
|
||||||
$package = $operation->getPackage();
|
|
||||||
}
|
|
||||||
if ($package && $package->isDev()) {
|
|
||||||
$lockData = $this->locker->getLockData();
|
|
||||||
foreach ($lockData['packages'] as $lockedPackage) {
|
|
||||||
if (!empty($lockedPackage['source-reference']) && strtolower($lockedPackage['package']) === $package->getName()) {
|
|
||||||
// update commit date to allow recovery in case the commit disappeared
|
|
||||||
if (!empty($lockedPackage['commit-date'])) {
|
|
||||||
$package->setReleaseDate(new \DateTime('@'.$lockedPackage['commit-date']));
|
|
||||||
}
|
|
||||||
$package->setSourceReference($lockedPackage['source-reference']);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// not installing from lock, force dev packages' references if they're in root package refs
|
|
||||||
$package = null;
|
$package = null;
|
||||||
if ('update' === $operation->getJobType()) {
|
if ('update' === $operation->getJobType()) {
|
||||||
$package = $operation->getTargetPackage();
|
$package = $operation->getTargetPackage();
|
||||||
|
|
|
@ -17,6 +17,9 @@ use Composer\Installer\InstallationManager;
|
||||||
use Composer\Repository\RepositoryManager;
|
use Composer\Repository\RepositoryManager;
|
||||||
use Composer\Util\ProcessExecutor;
|
use Composer\Util\ProcessExecutor;
|
||||||
use Composer\Package\AliasPackage;
|
use Composer\Package\AliasPackage;
|
||||||
|
use Composer\Repository\ArrayRepository;
|
||||||
|
use Composer\Package\Dumper\ArrayDumper;
|
||||||
|
use Composer\Package\Loader\ArrayLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads/writes project lockfile (composer.lock).
|
* Reads/writes project lockfile (composer.lock).
|
||||||
|
@ -30,6 +33,8 @@ class Locker
|
||||||
private $repositoryManager;
|
private $repositoryManager;
|
||||||
private $installationManager;
|
private $installationManager;
|
||||||
private $hash;
|
private $hash;
|
||||||
|
private $loader;
|
||||||
|
private $dumper;
|
||||||
private $lockDataCache;
|
private $lockDataCache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,6 +51,8 @@ class Locker
|
||||||
$this->repositoryManager = $repositoryManager;
|
$this->repositoryManager = $repositoryManager;
|
||||||
$this->installationManager = $installationManager;
|
$this->installationManager = $installationManager;
|
||||||
$this->hash = $hash;
|
$this->hash = $hash;
|
||||||
|
$this->loader = new ArrayLoader();
|
||||||
|
$this->dumper = new ArrayDumper();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,16 +91,29 @@ class Locker
|
||||||
* Searches and returns an array of locked packages, retrieved from registered repositories.
|
* Searches and returns an array of locked packages, retrieved from registered repositories.
|
||||||
*
|
*
|
||||||
* @param bool $dev true to retrieve the locked dev packages
|
* @param bool $dev true to retrieve the locked dev packages
|
||||||
* @return array
|
* @return \Composer\Repository\RepositoryInterface
|
||||||
*/
|
*/
|
||||||
public function getLockedPackages($dev = false)
|
public function getLockedRepository($dev = false)
|
||||||
{
|
{
|
||||||
$lockData = $this->getLockData();
|
$lockData = $this->getLockData();
|
||||||
$packages = array();
|
$packages = new ArrayRepository();
|
||||||
|
|
||||||
$lockedPackages = $dev ? $lockData['packages-dev'] : $lockData['packages'];
|
$lockedPackages = $dev ? $lockData['packages-dev'] : $lockData['packages'];
|
||||||
$repo = $dev ? $this->repositoryManager->getLocalDevRepository() : $this->repositoryManager->getLocalRepository();
|
|
||||||
|
|
||||||
|
if (empty($lockedPackages)) {
|
||||||
|
return $packages;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($lockedPackages[0]['name'])) {
|
||||||
|
foreach ($lockedPackages as $info) {
|
||||||
|
$packages->addPackage($this->loader->load($info));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $packages;
|
||||||
|
}
|
||||||
|
|
||||||
|
// legacy lock file support
|
||||||
|
$repo = $dev ? $this->repositoryManager->getLocalDevRepository() : $this->repositoryManager->getLocalRepository();
|
||||||
foreach ($lockedPackages as $info) {
|
foreach ($lockedPackages as $info) {
|
||||||
$resolvedVersion = !empty($info['alias-version']) ? $info['alias-version'] : $info['version'];
|
$resolvedVersion = !empty($info['alias-version']) ? $info['alias-version'] : $info['version'];
|
||||||
|
|
||||||
|
@ -122,7 +142,7 @@ class Locker
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
$packages[] = $package;
|
$packages->addPackage(clone $package);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $packages;
|
return $packages;
|
||||||
|
@ -221,11 +241,8 @@ class Locker
|
||||||
$locked = array();
|
$locked = array();
|
||||||
|
|
||||||
foreach ($packages as $package) {
|
foreach ($packages as $package) {
|
||||||
$alias = null;
|
|
||||||
|
|
||||||
if ($package instanceof AliasPackage) {
|
if ($package instanceof AliasPackage) {
|
||||||
$alias = $package;
|
continue;
|
||||||
$package = $package->getAliasOf();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$name = $package->getPrettyName();
|
$name = $package->getPrettyName();
|
||||||
|
@ -237,38 +254,30 @@ class Locker
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
$spec = array('package' => $name, 'version' => $version);
|
$spec = $this->dumper->dump($package);
|
||||||
|
unset($spec['version_normalized']);
|
||||||
|
|
||||||
if ($package->isDev() && !$alias) {
|
if ($package->isDev()) {
|
||||||
$spec['source-reference'] = $package->getSourceReference();
|
|
||||||
if ('git' === $package->getSourceType() && $path = $this->installationManager->getInstallPath($package)) {
|
if ('git' === $package->getSourceType() && $path = $this->installationManager->getInstallPath($package)) {
|
||||||
$process = new ProcessExecutor();
|
$process = new ProcessExecutor();
|
||||||
if (0 === $process->execute('git log -n1 --pretty=%ct '.escapeshellarg($package->getSourceReference()), $output, $path)) {
|
if (0 === $process->execute('git log -n1 --pretty=%ct '.escapeshellarg($package->getSourceReference()), $output, $path)) {
|
||||||
$spec['commit-date'] = trim($output);
|
$spec['time'] = trim($output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($alias) {
|
|
||||||
$spec['alias-pretty-version'] = $alias->getPrettyVersion();
|
|
||||||
$spec['alias-version'] = $alias->getVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
$locked[] = $spec;
|
$locked[] = $spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
usort($locked, function ($a, $b) {
|
usort($locked, function ($a, $b) {
|
||||||
$comparison = strcmp($a['package'], $b['package']);
|
$comparison = strcmp($a['name'], $b['name']);
|
||||||
|
|
||||||
if (0 !== $comparison) {
|
if (0 !== $comparison) {
|
||||||
return $comparison;
|
return $comparison;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it is the same package, compare the versions to make the order deterministic
|
// If it is the same package, compare the versions to make the order deterministic
|
||||||
$aVersion = isset($a['alias-version']) ? $a['alias-version'] : $a['version'];
|
return strcmp($a['version'], $b['version']);
|
||||||
$bVersion = isset($b['alias-version']) ? $b['alias-version'] : $b['version'];
|
|
||||||
|
|
||||||
return strcmp($aVersion, $bVersion);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return $locked;
|
return $locked;
|
||||||
|
|
|
@ -53,8 +53,12 @@ update
|
||||||
--EXPECT-LOCK--
|
--EXPECT-LOCK--
|
||||||
{
|
{
|
||||||
"packages": [
|
"packages": [
|
||||||
{ "package": "a/a", "version": "dev-master", "alias-pretty-version": "1.0.x-dev", "alias-version": "1.0.9999999.9999999-dev" },
|
{
|
||||||
{ "package": "a/a", "version": "dev-master", "source-reference": "master" }
|
"name": "a/a", "version": "dev-master",
|
||||||
|
"extra": { "branch-alias": { "dev-master": "1.0.x-dev" } },
|
||||||
|
"source": { "reference": "master", "type": "git", "url": "" },
|
||||||
|
"type": "library"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": null,
|
"packages-dev": null,
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
|
|
|
@ -48,7 +48,7 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
$this->setExpectedException('LogicException');
|
$this->setExpectedException('LogicException');
|
||||||
|
|
||||||
$locker->getLockedPackages();
|
$locker->getLockedRepository();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetLockedPackages()
|
public function testGetLockedPackages()
|
||||||
|
@ -82,7 +82,7 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
||||||
->with($this->logicalOr('pkg1', 'pkg2'), $this->logicalOr('1.0.0-beta', '0.1.10'))
|
->with($this->logicalOr('pkg1', 'pkg2'), $this->logicalOr('1.0.0-beta', '0.1.10'))
|
||||||
->will($this->onConsecutiveCalls($package1, $package2));
|
->will($this->onConsecutiveCalls($package1, $package2));
|
||||||
|
|
||||||
$this->assertEquals(array($package1, $package2), $locker->getLockedPackages());
|
$this->assertEquals(array($package1, $package2), $locker->getLockedRepository()->getPackages());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetPackagesWithoutRepo()
|
public function testGetPackagesWithoutRepo()
|
||||||
|
@ -118,7 +118,7 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
$this->setExpectedException('LogicException');
|
$this->setExpectedException('LogicException');
|
||||||
|
|
||||||
$locker->getLockedPackages();
|
$locker->getLockedRepository();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetLockData()
|
public function testSetLockData()
|
||||||
|
@ -133,22 +133,30 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
||||||
$package2 = $this->createPackageMock();
|
$package2 = $this->createPackageMock();
|
||||||
|
|
||||||
$package1
|
$package1
|
||||||
->expects($this->once())
|
->expects($this->atLeastOnce())
|
||||||
->method('getPrettyName')
|
->method('getPrettyName')
|
||||||
->will($this->returnValue('pkg1'));
|
->will($this->returnValue('pkg1'));
|
||||||
$package1
|
$package1
|
||||||
->expects($this->once())
|
->expects($this->atLeastOnce())
|
||||||
->method('getPrettyVersion')
|
->method('getPrettyVersion')
|
||||||
->will($this->returnValue('1.0.0-beta'));
|
->will($this->returnValue('1.0.0-beta'));
|
||||||
|
$package1
|
||||||
|
->expects($this->atLeastOnce())
|
||||||
|
->method('getVersion')
|
||||||
|
->will($this->returnValue('1.0.0.0-beta'));
|
||||||
|
|
||||||
$package2
|
$package2
|
||||||
->expects($this->once())
|
->expects($this->atLeastOnce())
|
||||||
->method('getPrettyName')
|
->method('getPrettyName')
|
||||||
->will($this->returnValue('pkg2'));
|
->will($this->returnValue('pkg2'));
|
||||||
$package2
|
$package2
|
||||||
->expects($this->once())
|
->expects($this->atLeastOnce())
|
||||||
->method('getPrettyVersion')
|
->method('getPrettyVersion')
|
||||||
->will($this->returnValue('0.1.10'));
|
->will($this->returnValue('0.1.10'));
|
||||||
|
$package2
|
||||||
|
->expects($this->atLeastOnce())
|
||||||
|
->method('getVersion')
|
||||||
|
->will($this->returnValue('0.1.10.0'));
|
||||||
|
|
||||||
$json
|
$json
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
|
@ -156,8 +164,8 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
||||||
->with(array(
|
->with(array(
|
||||||
'hash' => 'md5',
|
'hash' => 'md5',
|
||||||
'packages' => array(
|
'packages' => array(
|
||||||
array('package' => 'pkg1', 'version' => '1.0.0-beta'),
|
array('name' => 'pkg1', 'version' => '1.0.0-beta'),
|
||||||
array('package' => 'pkg2', 'version' => '0.1.10')
|
array('name' => 'pkg2', 'version' => '0.1.10')
|
||||||
),
|
),
|
||||||
'packages-dev' => array(),
|
'packages-dev' => array(),
|
||||||
'aliases' => array(),
|
'aliases' => array(),
|
||||||
|
|
Loading…
Reference in New Issue