1
0
Fork 0

Merge pull request #685 from Seldaek/integ-tests

More integration tests
pull/695/head
Nils Adermann 2012-05-13 13:48:20 -07:00
commit 35120d7d04
5 changed files with 77 additions and 7 deletions

View File

@ -61,6 +61,6 @@ class MarkAliasInstalledOperation extends SolverOperation
*/ */
public function __toString() public function __toString()
{ {
return 'Marking '.$this->package->getPrettyName().' ('.$this->package->getPrettyVersion().') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->package->getAliasOf()->getPrettyVersion().')'; return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
} }
} }

View File

@ -61,6 +61,6 @@ class MarkAliasUninstalledOperation extends SolverOperation
*/ */
public function __toString() public function __toString()
{ {
return 'Marking '.$this->package->getPrettyName().' ('.$this->package->getPrettyVersion().') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->package->getAliasOf()->getPrettyVersion().')'; return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
} }
} }

View File

@ -0,0 +1,53 @@
--TEST--
Aliases take precedence over default package
--COMPOSER--
{
"repositories": [
{
"type": "package",
"package": [
{
"name": "a/c", "version": "dev-feature-foo",
"source": { "reference": "feat.f", "type": "git", "url": "" }
},
{
"name": "a/b", "version": "dev-master",
"extra": { "branch-alias": { "dev-master": "1.0.x-dev" } },
"source": { "reference": "forked", "type": "git", "url": "" }
}
]
},
{
"type": "package",
"package": [
{
"name": "a/a", "version": "dev-master",
"extra": { "branch-alias": { "dev-master": "1.0.x-dev" } },
"source": { "reference": "master", "type": "git", "url": "" },
"require": {
"a/b": "dev-master",
"a/c": "dev-master"
}
},
{
"name": "a/b", "version": "dev-master",
"extra": { "branch-alias": { "dev-master": "1.0.x-dev" } },
"source": { "reference": "master", "type": "git", "url": "" }
},
{ "name": "a/c", "version": "dev-master" }
]
}
],
"require": {
"a/a": "1.*",
"a/b": "1.*",
"a/c": "dev-feature-foo as dev-master"
}
}
--EXPECT--
Installing a/c (dev-feature-foo feat.f)
Marking a/c (dev-master feat.f) as installed, alias of a/c (dev-feature-foo feat.f)
Installing a/b (dev-master forked)
Marking a/b (1.0.x-dev forked) as installed, alias of a/b (dev-master forked)
Installing a/a (dev-master master)
Marking a/a (1.0.x-dev master) as installed, alias of a/a (dev-master master)

View File

@ -196,13 +196,14 @@ class InstallerTest extends TestCase
$test = file_get_contents($file->getRealpath()); $test = file_get_contents($file->getRealpath());
$content = '(?:.(?!--[A-Z]))+';
$pattern = '{^ $pattern = '{^
--TEST--\s*(?P<test>.*?)\s* --TEST--\s*(?P<test>.*?)\s*
(?:--CONDITION--\s*(?P<condition>.*?))?\s* (?:--CONDITION--\s*(?P<condition>'.$content.'))?\s*
--COMPOSER--\s*(?P<composer>.*?)\s* --COMPOSER--\s*(?P<composer>'.$content.')\s*
(?:--LOCK--\s*(?P<lock>.*?))?\s* (?:--LOCK--\s*(?P<lock>'.$content.'))?\s*
(?:--INSTALLED--\s*(?P<installed>.*?))?\s* (?:--INSTALLED--\s*(?P<installed>'.$content.'))?\s*
(?:--INSTALLED:DEV--\s*(?P<installedDev>.*?))?\s* (?:--INSTALLED:DEV--\s*(?P<installedDev>'.$content.'))?\s*
--EXPECT(?P<update>:UPDATE)?(?P<dev>:DEV)?--\s*(?P<expect>.*?)\s* --EXPECT(?P<update>:UPDATE)?(?P<dev>:DEV)?--\s*(?P<expect>.*?)\s*
$}xs'; $}xs';

View File

@ -17,6 +17,8 @@ use Composer\DependencyResolver\Operation\OperationInterface;
use Composer\DependencyResolver\Operation\InstallOperation; use Composer\DependencyResolver\Operation\InstallOperation;
use Composer\DependencyResolver\Operation\UpdateOperation; use Composer\DependencyResolver\Operation\UpdateOperation;
use Composer\DependencyResolver\Operation\UninstallOperation; use Composer\DependencyResolver\Operation\UninstallOperation;
use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
class InstallationManagerMock extends InstallationManager class InstallationManagerMock extends InstallationManager
{ {
@ -47,6 +49,20 @@ class InstallationManagerMock extends InstallationManager
$repo->removePackage($operation->getPackage()); $repo->removePackage($operation->getPackage());
} }
public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
{
$this->installed[] = $operation->getPackage();
$this->trace[] = (string) $operation;
$repo->addPackage(clone $operation->getPackage());
}
public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
{
$this->uninstalled[] = $operation->getPackage();
$this->trace[] = (string) $operation;
$repo->removePackage($operation->getPackage());
}
public function getTrace() public function getTrace()
{ {
return $this->trace; return $this->trace;