From 63906171f08619fcc1f4d112389936d90be3f13b Mon Sep 17 00:00:00 2001 From: Yanick Witschi Date: Fri, 1 May 2020 20:14:04 +0200 Subject: [PATCH] Cleanup EmptyConstraint output --- .../Test/DependencyResolver/RuleTest.php | 4 ++-- .../Test/DependencyResolver/SolverTest.php | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/tests/Composer/Test/DependencyResolver/RuleTest.php b/tests/Composer/Test/DependencyResolver/RuleTest.php index fd5567520..cd3b74887 100644 --- a/tests/Composer/Test/DependencyResolver/RuleTest.php +++ b/tests/Composer/Test/DependencyResolver/RuleTest.php @@ -102,8 +102,8 @@ class RuleTest extends TestCase $repositorySetMock = $this->getMockBuilder('Composer\Repository\RepositorySet')->disableOriginalConstructor()->getMock(); $requestMock = $this->getMockBuilder('Composer\DependencyResolver\Request')->disableOriginalConstructor()->getMock(); - $rule = new GenericRule(array($p1->getId(), -$p2->getId()), Rule::RULE_PACKAGE_REQUIRES, new Link('baz', 'foo')); + $rule = new GenericRule(array($p1->getId(), -$p2->getId()), Rule::RULE_PACKAGE_REQUIRES, new Link('baz', 'foo', 'relates to', '*')); - $this->assertEquals('baz 1.1 relates to foo [] -> satisfiable by foo[2.1].', $rule->getPrettyString($repositorySetMock, $requestMock, $pool, false)); + $this->assertEquals('baz 1.1 relates to foo * -> satisfiable by foo[2.1].', $rule->getPrettyString($repositorySetMock, $requestMock, $pool, false)); } } diff --git a/tests/Composer/Test/DependencyResolver/SolverTest.php b/tests/Composer/Test/DependencyResolver/SolverTest.php index 48a30331f..56d2d7e5b 100644 --- a/tests/Composer/Test/DependencyResolver/SolverTest.php +++ b/tests/Composer/Test/DependencyResolver/SolverTest.php @@ -639,8 +639,11 @@ class SolverTest extends TestCase $this->reposComplete(); - $this->request->requireName('A'); - $this->request->requireName('B'); + $emptyConstraint = new EmptyConstraint(); + $emptyConstraint->setPrettyString('*'); + + $this->request->requireName('A', $emptyConstraint); + $this->request->requireName('B', $emptyConstraint); $this->createSolver(); try { @@ -652,9 +655,9 @@ class SolverTest extends TestCase $msg = "\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 conflicts with B 1.0.\n"; - $msg .= " - Root composer.json requires b [] -> satisfiable by B[1.0].\n"; + $msg .= " - Root composer.json requires b * -> satisfiable by B[1.0].\n"; $this->assertEquals($msg, $e->getPrettyString($this->repoSet, $this->request, $this->pool, false)); } } @@ -712,7 +715,10 @@ class SolverTest extends TestCase $this->reposComplete(); - $this->request->requireName('A'); + $emptyConstraint = new EmptyConstraint(); + $emptyConstraint->setPrettyString('*'); + + $this->request->requireName('A', $emptyConstraint); $this->createSolver(); try { @@ -729,7 +735,7 @@ class SolverTest extends TestCase $msg .= " - B 1.0 requires c >= 1.0 -> satisfiable by C[1.0].\n"; $msg .= " - You can only install one version of a package, so only one of these can be installed: B[0.9, 1.0].\n"; $msg .= " - A 1.0 requires b >= 1.0 -> satisfiable by B[1.0].\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"; $this->assertEquals($msg, $e->getPrettyString($this->repoSet, $this->request, $this->pool, false)); } }