1
0
Fork 0

Get rid of EmptyConstraint

pull/8850/head
Jordi Boggiano 2020-06-05 16:41:37 +02:00
parent cb19347031
commit 67a88880ec
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
9 changed files with 66 additions and 66 deletions

View File

@ -17,7 +17,7 @@ use Composer\Package\PackageInterface;
use Composer\Package\RootAliasPackage; use Composer\Package\RootAliasPackage;
use Composer\Repository\LockArrayRepository; use Composer\Repository\LockArrayRepository;
use Composer\Semver\Constraint\ConstraintInterface; use Composer\Semver\Constraint\ConstraintInterface;
use Composer\Semver\Constraint\EmptyConstraint; use Composer\Semver\Constraint\MatchAllConstraint;
/** /**
* @author Nils Adermann <naderman@naderman.de> * @author Nils Adermann <naderman@naderman.de>
@ -56,7 +56,7 @@ class Request
public function requireName($packageName, ConstraintInterface $constraint = null) public function requireName($packageName, ConstraintInterface $constraint = null)
{ {
$packageName = strtolower($packageName); $packageName = strtolower($packageName);
$this->requires[$packageName] = $constraint ? $constraint : new EmptyConstraint(); $this->requires[$packageName] = $constraint ? $constraint : new MatchAllConstraint();
} }
/** /**

View File

@ -13,7 +13,6 @@
namespace Composer\Package; namespace Composer\Package;
use Composer\Semver\Constraint\ConstraintInterface; use Composer\Semver\Constraint\ConstraintInterface;
use Composer\Semver\Constraint\EmptyConstraint;
/** /**
* Represents a link between two packages, represented by their names * Represents a link between two packages, represented by their names

View File

@ -16,7 +16,7 @@ use Composer\Autoload\AutoloadGenerator;
use Composer\Package\Link; use Composer\Package\Link;
use Composer\Package\Version\VersionParser; use Composer\Package\Version\VersionParser;
use Composer\Semver\Constraint\Constraint; use Composer\Semver\Constraint\Constraint;
use Composer\Semver\Constraint\EmptyConstraint; use Composer\Semver\Constraint\MatchAllConstraint;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Composer\Package\AliasPackage; use Composer\Package\AliasPackage;
use Composer\Package\Package; use Composer\Package\Package;
@ -367,8 +367,8 @@ class AutoloadGeneratorTest extends TestCase
{ {
$package = new Package('a', '1.0', '1.0'); $package = new Package('a', '1.0', '1.0');
$package->setRequires(array( $package->setRequires(array(
new Link('a', 'a/a', new EmptyConstraint()), new Link('a', 'a/a', new MatchAllConstraint()),
new Link('a', 'b/b', new EmptyConstraint()), new Link('a', 'b/b', new MatchAllConstraint()),
)); ));
$packages = array(); $packages = array();
@ -396,7 +396,7 @@ class AutoloadGeneratorTest extends TestCase
{ {
$package = new Package('a', '1.0', '1.0'); $package = new Package('a', '1.0', '1.0');
$package->setRequires(array( $package->setRequires(array(
new Link('a', 'a/a', new EmptyConstraint()), new Link('a', 'a/a', new MatchAllConstraint()),
)); ));
$packages = array(); $packages = array();
@ -404,11 +404,11 @@ class AutoloadGeneratorTest extends TestCase
$packages[] = $b = new Package('b/b', '1.0', '1.0'); $packages[] = $b = new Package('b/b', '1.0', '1.0');
$a->setAutoload(array('psr-0' => array('A' => 'src/', 'A\\B' => 'lib/'))); $a->setAutoload(array('psr-0' => array('A' => 'src/', 'A\\B' => 'lib/')));
$a->setRequires(array( $a->setRequires(array(
new Link('a/a', 'b/b', new EmptyConstraint()), new Link('a/a', 'b/b', new MatchAllConstraint()),
)); ));
$b->setAutoload(array('psr-0' => array('B\\Sub\\Name' => 'src/'))); $b->setAutoload(array('psr-0' => array('B\\Sub\\Name' => 'src/')));
$b->setRequires(array( $b->setRequires(array(
new Link('b/b', 'a/a', new EmptyConstraint()), new Link('b/b', 'a/a', new MatchAllConstraint()),
)); ));
$this->repository->expects($this->once()) $this->repository->expects($this->once())
@ -428,13 +428,13 @@ class AutoloadGeneratorTest extends TestCase
public function testNonDevAutoloadShouldIncludeReplacedPackages() public function testNonDevAutoloadShouldIncludeReplacedPackages()
{ {
$package = new Package('a', '1.0', '1.0'); $package = new Package('a', '1.0', '1.0');
$package->setRequires(array(new Link('a', 'a/a', new EmptyConstraint()))); $package->setRequires(array(new Link('a', 'a/a', new MatchAllConstraint())));
$packages = array(); $packages = array();
$packages[] = $a = new Package('a/a', '1.0', '1.0'); $packages[] = $a = new Package('a/a', '1.0', '1.0');
$packages[] = $b = new Package('b/b', '1.0', '1.0'); $packages[] = $b = new Package('b/b', '1.0', '1.0');
$a->setRequires(array(new Link('a/a', 'b/c', new EmptyConstraint()))); $a->setRequires(array(new Link('a/a', 'b/c', new MatchAllConstraint())));
$b->setAutoload(array('psr-4' => array('B\\' => 'src/'))); $b->setAutoload(array('psr-4' => array('B\\' => 'src/')));
$b->setReplaces( $b->setReplaces(
@ -463,7 +463,7 @@ class AutoloadGeneratorTest extends TestCase
{ {
$package = new Package('a', '1.0', '1.0'); $package = new Package('a', '1.0', '1.0');
$package->setRequires(array( $package->setRequires(array(
new Link('a', 'a/a', new EmptyConstraint()), new Link('a', 'a/a', new MatchAllConstraint()),
)); ));
$packages = array(); $packages = array();
@ -471,11 +471,11 @@ class AutoloadGeneratorTest extends TestCase
$packages[] = $b = new Package('b/b', '1.0', '1.0'); $packages[] = $b = new Package('b/b', '1.0', '1.0');
$a->setAutoload(array('psr-0' => array('A' => 'src/', 'A\\B' => 'lib/'))); $a->setAutoload(array('psr-0' => array('A' => 'src/', 'A\\B' => 'lib/')));
$a->setRequires(array( $a->setRequires(array(
new Link('a/a', 'c/c', new EmptyConstraint()), new Link('a/a', 'c/c', new MatchAllConstraint()),
)); ));
$b->setAutoload(array('psr-0' => array('B\\Sub\\Name' => 'src/'))); $b->setAutoload(array('psr-0' => array('B\\Sub\\Name' => 'src/')));
$b->setReplaces(array( $b->setReplaces(array(
new Link('b/b', 'c/c', new EmptyConstraint()), new Link('b/b', 'c/c', new MatchAllConstraint()),
)); ));
$this->repository->expects($this->once()) $this->repository->expects($this->once())
@ -496,7 +496,7 @@ class AutoloadGeneratorTest extends TestCase
{ {
$package = new Package('a', '1.0', '1.0'); $package = new Package('a', '1.0', '1.0');
$package->setRequires(array( $package->setRequires(array(
new Link('a', 'a/a', new EmptyConstraint()) new Link('a', 'a/a', new MatchAllConstraint())
)); ));
$packages = array(); $packages = array();
@ -507,18 +507,18 @@ class AutoloadGeneratorTest extends TestCase
$packages[] = $e = new Package('e/e', '1.0', '1.0'); $packages[] = $e = new Package('e/e', '1.0', '1.0');
$a->setAutoload(array('classmap' => array('src/A.php'))); $a->setAutoload(array('classmap' => array('src/A.php')));
$a->setRequires(array( $a->setRequires(array(
new Link('a/a', 'b/b', new EmptyConstraint()) new Link('a/a', 'b/b', new MatchAllConstraint())
)); ));
$b->setAutoload(array('classmap' => array('src/B.php'))); $b->setAutoload(array('classmap' => array('src/B.php')));
$b->setRequires(array( $b->setRequires(array(
new Link('b/b', 'e/e', new EmptyConstraint()) new Link('b/b', 'e/e', new MatchAllConstraint())
)); ));
$c->setAutoload(array('classmap' => array('src/C.php'))); $c->setAutoload(array('classmap' => array('src/C.php')));
$c->setReplaces(array( $c->setReplaces(array(
new Link('c/c', 'b/b', new EmptyConstraint()) new Link('c/c', 'b/b', new MatchAllConstraint())
)); ));
$c->setRequires(array( $c->setRequires(array(
new Link('c/c', 'd/d', new EmptyConstraint()) new Link('c/c', 'd/d', new MatchAllConstraint())
)); ));
$d->setAutoload(array('classmap' => array('src/D.php'))); $d->setAutoload(array('classmap' => array('src/D.php')));
$e->setAutoload(array('classmap' => array('src/E.php'))); $e->setAutoload(array('classmap' => array('src/E.php')));
@ -548,7 +548,7 @@ class AutoloadGeneratorTest extends TestCase
{ {
$package = new Package('a', '1.0', '1.0'); $package = new Package('a', '1.0', '1.0');
$package->setRequires(array( $package->setRequires(array(
new Link('a', 'a/a', new EmptyConstraint()), new Link('a', 'a/a', new MatchAllConstraint()),
)); ));
$package->setAutoload(array( $package->setAutoload(array(
@ -653,8 +653,8 @@ EOF;
{ {
$package = new Package('a', '1.0', '1.0'); $package = new Package('a', '1.0', '1.0');
$package->setRequires(array( $package->setRequires(array(
new Link('a', 'a/a', new EmptyConstraint()), new Link('a', 'a/a', new MatchAllConstraint()),
new Link('a', 'b/b', new EmptyConstraint()), new Link('a', 'b/b', new MatchAllConstraint()),
)); ));
$packages = array(); $packages = array();
@ -693,8 +693,8 @@ EOF;
{ {
$package = new Package('a', '1.0', '1.0'); $package = new Package('a', '1.0', '1.0');
$package->setRequires(array( $package->setRequires(array(
new Link('a', 'a/a', new EmptyConstraint()), new Link('a', 'a/a', new MatchAllConstraint()),
new Link('a', 'b/b', new EmptyConstraint()), new Link('a', 'b/b', new MatchAllConstraint()),
)); ));
$packages = array(); $packages = array();
@ -733,9 +733,9 @@ EOF;
{ {
$package = new Package('a', '1.0', '1.0'); $package = new Package('a', '1.0', '1.0');
$package->setRequires(array( $package->setRequires(array(
new Link('a', 'a/a', new EmptyConstraint()), new Link('a', 'a/a', new MatchAllConstraint()),
new Link('a', 'b/b', new EmptyConstraint()), new Link('a', 'b/b', new MatchAllConstraint()),
new Link('a', 'c/c', new EmptyConstraint()), new Link('a', 'c/c', new MatchAllConstraint()),
)); ));
$packages = array(); $packages = array();
@ -778,9 +778,9 @@ EOF;
{ {
$package = new Package('a', '1.0', '1.0'); $package = new Package('a', '1.0', '1.0');
$package->setRequires(array( $package->setRequires(array(
new Link('a', 'a/a', new EmptyConstraint()), new Link('a', 'a/a', new MatchAllConstraint()),
new Link('a', 'b/b', new EmptyConstraint()), new Link('a', 'b/b', new MatchAllConstraint()),
new Link('a', 'c/c', new EmptyConstraint()), new Link('a', 'c/c', new MatchAllConstraint()),
)); ));
$packages = array(); $packages = array();
@ -828,9 +828,9 @@ EOF;
$package = new Package('a', '1.0', '1.0'); $package = new Package('a', '1.0', '1.0');
$package->setAutoload(array('files' => array('root.php'))); $package->setAutoload(array('files' => array('root.php')));
$package->setRequires(array( $package->setRequires(array(
new Link('a', 'a/a', new EmptyConstraint()), new Link('a', 'a/a', new MatchAllConstraint()),
new Link('a', 'b/b', new EmptyConstraint()), new Link('a', 'b/b', new MatchAllConstraint()),
new Link('a', 'c/c', new EmptyConstraint()), new Link('a', 'c/c', new MatchAllConstraint()),
)); ));
$packages = array(); $packages = array();
@ -879,9 +879,9 @@ EOF;
$notAutoloadPackage = new Package('a', '1.0', '1.0'); $notAutoloadPackage = new Package('a', '1.0', '1.0');
$requires = array( $requires = array(
new Link('a', 'a/a', new EmptyConstraint()), new Link('a', 'a/a', new MatchAllConstraint()),
new Link('a', 'b/b', new EmptyConstraint()), new Link('a', 'b/b', new MatchAllConstraint()),
new Link('a', 'c/c', new EmptyConstraint()), new Link('a', 'c/c', new MatchAllConstraint()),
); );
$autoloadPackage->setRequires($requires); $autoloadPackage->setRequires($requires);
$notAutoloadPackage->setRequires($requires); $notAutoloadPackage->setRequires($requires);
@ -950,10 +950,10 @@ EOF;
$package = new Package('a', '1.0', '1.0'); $package = new Package('a', '1.0', '1.0');
$package->setAutoload(array('files' => array('root2.php'))); $package->setAutoload(array('files' => array('root2.php')));
$package->setRequires(array( $package->setRequires(array(
new Link('a', 'z/foo', new EmptyConstraint()), new Link('a', 'z/foo', new MatchAllConstraint()),
new Link('a', 'b/bar', new EmptyConstraint()), new Link('a', 'b/bar', new MatchAllConstraint()),
new Link('a', 'd/d', new EmptyConstraint()), new Link('a', 'd/d', new MatchAllConstraint()),
new Link('a', 'e/e', new EmptyConstraint()), new Link('a', 'e/e', new MatchAllConstraint()),
)); ));
$packages = array(); $packages = array();
@ -964,18 +964,18 @@ EOF;
$packages[] = $e = new Package('e/e', '1.0', '1.0'); $packages[] = $e = new Package('e/e', '1.0', '1.0');
$z->setAutoload(array('files' => array('testA.php'))); $z->setAutoload(array('files' => array('testA.php')));
$z->setRequires(array(new Link('z/foo', 'c/lorem', new EmptyConstraint()))); $z->setRequires(array(new Link('z/foo', 'c/lorem', new MatchAllConstraint())));
$b->setAutoload(array('files' => array('testB.php'))); $b->setAutoload(array('files' => array('testB.php')));
$b->setRequires(array(new Link('b/bar', 'c/lorem', new EmptyConstraint()), new Link('b/bar', 'd/d', new EmptyConstraint()))); $b->setRequires(array(new Link('b/bar', 'c/lorem', new MatchAllConstraint()), new Link('b/bar', 'd/d', new MatchAllConstraint())));
$c->setAutoload(array('files' => array('testC.php'))); $c->setAutoload(array('files' => array('testC.php')));
$d->setAutoload(array('files' => array('testD.php'))); $d->setAutoload(array('files' => array('testD.php')));
$d->setRequires(array(new Link('d/d', 'c/lorem', new EmptyConstraint()))); $d->setRequires(array(new Link('d/d', 'c/lorem', new MatchAllConstraint())));
$e->setAutoload(array('files' => array('testE.php'))); $e->setAutoload(array('files' => array('testE.php')));
$e->setRequires(array(new Link('e/e', 'c/lorem', new EmptyConstraint()))); $e->setRequires(array(new Link('e/e', 'c/lorem', new MatchAllConstraint())));
$this->repository->expects($this->once()) $this->repository->expects($this->once())
->method('getCanonicalPackages') ->method('getCanonicalPackages')
@ -1023,8 +1023,8 @@ EOF;
'classmap' => array($this->workingDir.'/src'), 'classmap' => array($this->workingDir.'/src'),
)); ));
$mainPackage->setRequires(array( $mainPackage->setRequires(array(
new Link('z', 'a/a', new EmptyConstraint()), new Link('z', 'a/a', new MatchAllConstraint()),
new Link('z', 'b/b', new EmptyConstraint()), new Link('z', 'b/b', new MatchAllConstraint()),
)); ));
$packages = array(); $packages = array();
@ -1286,7 +1286,7 @@ EOF;
'files' => array('test.php'), 'files' => array('test.php'),
)); ));
$package->setRequires(array( $package->setRequires(array(
new Link('a', 'b/b', new EmptyConstraint()), new Link('a', 'b/b', new MatchAllConstraint()),
)); ));
$vendorPackage = new Package('b/b', '1.0', '1.0'); $vendorPackage = new Package('b/b', '1.0', '1.0');

View File

@ -14,7 +14,7 @@ namespace Composer\Test\DependencyResolver;
use Composer\DependencyResolver\Request; use Composer\DependencyResolver\Request;
use Composer\Repository\ArrayRepository; use Composer\Repository\ArrayRepository;
use Composer\Semver\Constraint\EmptyConstraint; use Composer\Semver\Constraint\MatchAllConstraint;
use Composer\Test\TestCase; use Composer\Test\TestCase;
class RequestTest extends TestCase class RequestTest extends TestCase
@ -35,7 +35,7 @@ class RequestTest extends TestCase
$this->assertEquals( $this->assertEquals(
array( array(
'foo' => new EmptyConstraint(), 'foo' => new MatchAllConstraint(),
), ),
$request->getRequires() $request->getRequires()
); );

View File

@ -19,7 +19,7 @@ use Composer\DependencyResolver\Pool;
use Composer\Package\BasePackage; use Composer\Package\BasePackage;
use Composer\Package\Link; use Composer\Package\Link;
use Composer\Repository\ArrayRepository; use Composer\Repository\ArrayRepository;
use Composer\Semver\Constraint\EmptyConstraint; use Composer\Semver\Constraint\MatchAllConstraint;
use Composer\Test\TestCase; use Composer\Test\TestCase;
class RuleTest extends TestCase class RuleTest extends TestCase
@ -103,7 +103,7 @@ class RuleTest extends TestCase
$repositorySetMock = $this->getMockBuilder('Composer\Repository\RepositorySet')->disableOriginalConstructor()->getMock(); $repositorySetMock = $this->getMockBuilder('Composer\Repository\RepositorySet')->disableOriginalConstructor()->getMock();
$requestMock = $this->getMockBuilder('Composer\DependencyResolver\Request')->disableOriginalConstructor()->getMock(); $requestMock = $this->getMockBuilder('Composer\DependencyResolver\Request')->disableOriginalConstructor()->getMock();
$emptyConstraint = new EmptyConstraint(); $emptyConstraint = new MatchAllConstraint();
$emptyConstraint->setPrettyString('*'); $emptyConstraint->setPrettyString('*');
$rule = new GenericRule(array($p1->getId(), -$p2->getId()), Rule::RULE_PACKAGE_REQUIRES, new Link('baz', 'foo', $emptyConstraint)); $rule = new GenericRule(array($p1->getId(), -$p2->getId()), Rule::RULE_PACKAGE_REQUIRES, new Link('baz', 'foo', $emptyConstraint));

View File

@ -235,8 +235,8 @@ class SolverTest extends TestCase
$this->repo->addPackage($newPackageA = $this->getPackage('A', '1.1')); $this->repo->addPackage($newPackageA = $this->getPackage('A', '1.1'));
$this->repo->addPackage($newPackageB = $this->getPackage('B', '1.1')); $this->repo->addPackage($newPackageB = $this->getPackage('B', '1.1'));
$packageA->setRequires(array('b' => new Link('A', 'B', new EmptyConstraint(), 'requires'))); $packageA->setRequires(array('b' => new Link('A', 'B', new MatchAllConstraint(), 'requires')));
$newPackageA->setRequires(array('b' => new Link('A', 'B', new EmptyConstraint(), 'requires'))); $newPackageA->setRequires(array('b' => new Link('A', 'B', new MatchAllConstraint(), 'requires')));
$this->reposComplete(); $this->reposComplete();
@ -639,7 +639,7 @@ class SolverTest extends TestCase
$this->reposComplete(); $this->reposComplete();
$emptyConstraint = new EmptyConstraint(); $emptyConstraint = new MatchAllConstraint();
$emptyConstraint->setPrettyString('*'); $emptyConstraint->setPrettyString('*');
$this->request->requireName('A', $emptyConstraint); $this->request->requireName('A', $emptyConstraint);
@ -686,7 +686,7 @@ class SolverTest extends TestCase
$msg = "\n"; $msg = "\n";
$msg .= " Problem 1\n"; $msg .= " Problem 1\n";
$msg .= " - Root composer.json requires a [] -> satisfiable by A[1.0].\n"; $msg .= " - Root composer.json requires a * -> satisfiable by A[1.0].\n";
$msg .= " - A 1.0 requires b >= 2.0 -> found B[1.0] but it does not match the constraint.\n"; $msg .= " - A 1.0 requires b >= 2.0 -> found B[1.0] but it does not match the constraint.\n";
$this->assertEquals($msg, $e->getPrettyString($this->repoSet, $this->request, $this->pool, false)); $this->assertEquals($msg, $e->getPrettyString($this->repoSet, $this->request, $this->pool, false));
} }
@ -715,7 +715,7 @@ class SolverTest extends TestCase
$this->reposComplete(); $this->reposComplete();
$emptyConstraint = new EmptyConstraint(); $emptyConstraint = new MatchAllConstraint();
$emptyConstraint->setPrettyString('*'); $emptyConstraint->setPrettyString('*');
$this->request->requireName('A', $emptyConstraint); $this->request->requireName('A', $emptyConstraint);

View File

@ -14,7 +14,7 @@ namespace Composer\Test\Package;
use Composer\Package\Link; use Composer\Package\Link;
use Composer\Package\RootAliasPackage; use Composer\Package\RootAliasPackage;
use Composer\Semver\Constraint\EmptyConstraint; use Composer\Semver\Constraint\MatchAllConstraint;
use Composer\Test\TestCase; use Composer\Test\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
@ -27,7 +27,7 @@ class RootAliasPackageTest extends TestCase
$alias = new RootAliasPackage($root->reveal(), '1.0', '1.0.0.0'); $alias = new RootAliasPackage($root->reveal(), '1.0', '1.0.0.0');
$this->assertEmpty($alias->getRequires()); $this->assertEmpty($alias->getRequires());
$links = array(new Link('a', 'b', new EmptyConstraint(), 'foo', 'self.version')); $links = array(new Link('a', 'b', new MatchAllConstraint(), 'foo', 'self.version'));
$alias->setRequires($links); $alias->setRequires($links);
$this->assertNotEmpty($alias->getRequires()); $this->assertNotEmpty($alias->getRequires());
} }
@ -39,7 +39,7 @@ class RootAliasPackageTest extends TestCase
$alias = new RootAliasPackage($root->reveal(), '1.0', '1.0.0.0'); $alias = new RootAliasPackage($root->reveal(), '1.0', '1.0.0.0');
$this->assertEmpty($alias->getDevRequires()); $this->assertEmpty($alias->getDevRequires());
$links = array(new Link('a', 'b', new EmptyConstraint(), 'foo', 'self.version')); $links = array(new Link('a', 'b', new MatchAllConstraint(), 'foo', 'self.version'));
$alias->setDevRequires($links); $alias->setDevRequires($links);
$this->assertNotEmpty($alias->getDevRequires()); $this->assertNotEmpty($alias->getDevRequires());
} }
@ -51,7 +51,7 @@ class RootAliasPackageTest extends TestCase
$alias = new RootAliasPackage($root->reveal(), '1.0', '1.0.0.0'); $alias = new RootAliasPackage($root->reveal(), '1.0', '1.0.0.0');
$this->assertEmpty($alias->getConflicts()); $this->assertEmpty($alias->getConflicts());
$links = array(new Link('a', 'b', new EmptyConstraint(), 'foo', 'self.version')); $links = array(new Link('a', 'b', new MatchAllConstraint(), 'foo', 'self.version'));
$alias->setConflicts($links); $alias->setConflicts($links);
$this->assertNotEmpty($alias->getConflicts()); $this->assertNotEmpty($alias->getConflicts());
} }
@ -63,7 +63,7 @@ class RootAliasPackageTest extends TestCase
$alias = new RootAliasPackage($root->reveal(), '1.0', '1.0.0.0'); $alias = new RootAliasPackage($root->reveal(), '1.0', '1.0.0.0');
$this->assertEmpty($alias->getProvides()); $this->assertEmpty($alias->getProvides());
$links = array(new Link('a', 'b', new EmptyConstraint(), 'foo', 'self.version')); $links = array(new Link('a', 'b', new MatchAllConstraint(), 'foo', 'self.version'));
$alias->setProvides($links); $alias->setProvides($links);
$this->assertNotEmpty($alias->getProvides()); $this->assertNotEmpty($alias->getProvides());
} }
@ -75,7 +75,7 @@ class RootAliasPackageTest extends TestCase
$alias = new RootAliasPackage($root->reveal(), '1.0', '1.0.0.0'); $alias = new RootAliasPackage($root->reveal(), '1.0', '1.0.0.0');
$this->assertEmpty($alias->getReplaces()); $this->assertEmpty($alias->getReplaces());
$links = array(new Link('a', 'b', new EmptyConstraint(), 'foo', 'self.version')); $links = array(new Link('a', 'b', new MatchAllConstraint(), 'foo', 'self.version'));
$alias->setReplaces($links); $alias->setReplaces($links);
$this->assertNotEmpty($alias->getReplaces()); $this->assertNotEmpty($alias->getReplaces());
} }

View File

@ -16,7 +16,7 @@ use Composer\Repository\InstalledRepository;
use Composer\Repository\ArrayRepository; use Composer\Repository\ArrayRepository;
use Composer\Repository\InstalledArrayRepository; use Composer\Repository\InstalledArrayRepository;
use Composer\Package\Link; use Composer\Package\Link;
use Composer\Semver\Constraint\EmptyConstraint; use Composer\Semver\Constraint\MatchAllConstraint;
use Composer\Test\TestCase; use Composer\Test\TestCase;
class InstalledRepositoryTest extends TestCase class InstalledRepositoryTest extends TestCase
@ -31,8 +31,8 @@ class InstalledRepositoryTest extends TestCase
$arrayRepoTwo->addPackage($bar = $this->getPackage('bar', '1')); $arrayRepoTwo->addPackage($bar = $this->getPackage('bar', '1'));
$arrayRepoTwo->addPackage($bar2 = $this->getPackage('bar', '2')); $arrayRepoTwo->addPackage($bar2 = $this->getPackage('bar', '2'));
$foo->setReplaces(array(new Link('foo', 'provided', new EmptyConstraint()))); $foo->setReplaces(array(new Link('foo', 'provided', new MatchAllConstraint())));
$bar2->setProvides(array(new Link('bar', 'provided', new EmptyConstraint()))); $bar2->setProvides(array(new Link('bar', 'provided', new MatchAllConstraint())));
$repo = new InstalledRepository(array($arrayRepoOne, $arrayRepoTwo)); $repo = new InstalledRepository(array($arrayRepoOne, $arrayRepoTwo));

View File

@ -16,6 +16,7 @@ use Composer\Package\Link;
use Composer\Package\Package; use Composer\Package\Package;
use Composer\Test\TestCase; use Composer\Test\TestCase;
use Composer\Util\PackageSorter; use Composer\Util\PackageSorter;
use Composer\Semver\Constraint\MatchAllConstraint;
class PackageSorterTest extends TestCase class PackageSorterTest extends TestCase
{ {
@ -120,7 +121,7 @@ class PackageSorterTest extends TestCase
$links = array(); $links = array();
foreach ($requires as $requireName) { foreach ($requires as $requireName) {
$links[] = new Link($package->getName(), $requireName); $links[] = new Link($package->getName(), $requireName, new MatchAllConstraint);
} }
$package->setRequires($links); $package->setRequires($links);