diff --git a/src/Composer/Package/Link.php b/src/Composer/Package/Link.php index 585a269c9..e80cfb592 100644 --- a/src/Composer/Package/Link.php +++ b/src/Composer/Package/Link.php @@ -34,7 +34,7 @@ class Link * @param LinkConstraintInterface $constraint Constraint applying to the target of this link * @param string $description Used to create a descriptive string representation */ - public function __construct($source, $target, LinkConstraintInterface $constraint, $description = 'relates to') + public function __construct($source, $target, LinkConstraintInterface $constraint = null, $description = 'relates to') { $this->source = $source; $this->target = $target; diff --git a/tests/Composer/Test/DependencyResolver/SolverTest.php b/tests/Composer/Test/DependencyResolver/SolverTest.php index 426daf2b6..03e1558e7 100644 --- a/tests/Composer/Test/DependencyResolver/SolverTest.php +++ b/tests/Composer/Test/DependencyResolver/SolverTest.php @@ -184,6 +184,21 @@ class SolverTest extends \PHPUnit_Framework_TestCase )); } + public function testSolverObsolete() + { + $this->repoInstalled->addPackage($packageA = new MemoryPackage('A', '1.0')); + $this->repo->addPackage($packageB = new MemoryPackage('B', '1.0')); + $packageB->setReplaces(array(new Link('B', 'A', null))); + + $this->reposComplete(); + + $this->request->install('B'); + + $this->checkSolverResult(array( + array('job' => 'update', 'from' => $packageA, 'to' => $packageB), + )); + } + public function testInstallOneOfTwoAlternatives() { $this->repo->addPackage($packageA = new MemoryPackage('A', '1.0'));