diff --git a/core/phpstan-baseline.neon b/core/phpstan-baseline.neon index 163dd69ab2c578cf5055c4fc4fe3261247e91b61..96046d07f6cfee1bb03b5196f1a3fde440a69198 100644 --- a/core/phpstan-baseline.neon +++ b/core/phpstan-baseline.neon @@ -3347,11 +3347,6 @@ parameters: count: 1 path: tests/Drupal/Tests/Core/Test/AssertContentTraitTest.php - - - message: "#^Call to deprecated method withConsecutive\\(\\) of class PHPUnit\\\\Framework\\\\MockObject\\\\Builder\\\\InvocationMocker\\.$#" - count: 1 - path: tests/Drupal/Tests/Core/UrlTest.php - - message: """ #^Class Drupal\\\\Tests\\\\Core\\\\Utility\\\\MockContainerAware implements deprecated interface Symfony\\\\Component\\\\DependencyInjection\\\\ContainerAwareInterface\\: diff --git a/core/tests/Drupal/Tests/Core/UrlTest.php b/core/tests/Drupal/Tests/Core/UrlTest.php index db86a0e6bbf392d70cc455e6b687144f25deb474..84115cd8e0df430c76705740ebabad904bce2b5c 100644 --- a/core/tests/Drupal/Tests/Core/UrlTest.php +++ b/core/tests/Drupal/Tests/Core/UrlTest.php @@ -120,21 +120,17 @@ protected function setUp(): void { public function testUrlFromRequest() { $this->router->expects($this->exactly(3)) ->method('matchRequest') - ->withConsecutive( - [$this->getRequestConstraint('/node')], - [$this->getRequestConstraint('/node/1')], - [$this->getRequestConstraint('/node/2/edit')], - ) - ->willReturnOnConsecutiveCalls([ - RouteObjectInterface::ROUTE_NAME => 'view.frontpage.page_1', - '_raw_variables' => new InputBag(), - ], [ - RouteObjectInterface::ROUTE_NAME => 'node_view', - '_raw_variables' => new InputBag(['node' => '1']), - ], [ - RouteObjectInterface::ROUTE_NAME => 'node_edit', - '_raw_variables' => new InputBag(['node' => '2']), - ]); + ->willReturnCallback(function (Request $request) { + [$route_name, $vars] = match($request->getPathInfo()) { + '/node' => ['view.frontpage.page_1', []], + '/node/1' => ['node_view', ['node' => '1']], + '/node/2/edit' => ['node_edit', ['node' => '2']], + }; + return [ + RouteObjectInterface::ROUTE_NAME => $route_name, + '_raw_variables' => new InputBag($vars), + ]; + }); $urls = []; foreach ($this->map as $index => $values) { @@ -147,21 +143,6 @@ public function testUrlFromRequest() { return $urls; } - /** - * This constraint checks whether a Request object has the right path. - * - * @param string $path - * The path. - * - * @return \PHPUnit\Framework\Constraint\Callback - * The constraint checks whether a Request object has the right path. - */ - protected function getRequestConstraint($path) { - return $this->callback(function (Request $request) use ($path) { - return $request->getPathInfo() == $path; - }); - } - /** * Tests the fromRoute() method with the special <front> path. *