Skip to content
Snippets Groups Projects
Commit b370eda6 authored by catch's avatar catch
Browse files

Issue #3419346 by longwave: Remove withConsecutive() in UrlTest

parent 9df6250d
No related branches found
No related tags found
No related merge requests found
...@@ -3347,11 +3347,6 @@ parameters: ...@@ -3347,11 +3347,6 @@ parameters:
count: 1 count: 1
path: tests/Drupal/Tests/Core/Test/AssertContentTraitTest.php 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: """ message: """
#^Class Drupal\\\\Tests\\\\Core\\\\Utility\\\\MockContainerAware implements deprecated interface Symfony\\\\Component\\\\DependencyInjection\\\\ContainerAwareInterface\\: #^Class Drupal\\\\Tests\\\\Core\\\\Utility\\\\MockContainerAware implements deprecated interface Symfony\\\\Component\\\\DependencyInjection\\\\ContainerAwareInterface\\:
......
...@@ -120,21 +120,17 @@ protected function setUp(): void { ...@@ -120,21 +120,17 @@ protected function setUp(): void {
public function testUrlFromRequest() { public function testUrlFromRequest() {
$this->router->expects($this->exactly(3)) $this->router->expects($this->exactly(3))
->method('matchRequest') ->method('matchRequest')
->withConsecutive( ->willReturnCallback(function (Request $request) {
[$this->getRequestConstraint('/node')], [$route_name, $vars] = match($request->getPathInfo()) {
[$this->getRequestConstraint('/node/1')], '/node' => ['view.frontpage.page_1', []],
[$this->getRequestConstraint('/node/2/edit')], '/node/1' => ['node_view', ['node' => '1']],
) '/node/2/edit' => ['node_edit', ['node' => '2']],
->willReturnOnConsecutiveCalls([ };
RouteObjectInterface::ROUTE_NAME => 'view.frontpage.page_1', return [
'_raw_variables' => new InputBag(), RouteObjectInterface::ROUTE_NAME => $route_name,
], [ '_raw_variables' => new InputBag($vars),
RouteObjectInterface::ROUTE_NAME => 'node_view', ];
'_raw_variables' => new InputBag(['node' => '1']), });
], [
RouteObjectInterface::ROUTE_NAME => 'node_edit',
'_raw_variables' => new InputBag(['node' => '2']),
]);
$urls = []; $urls = [];
foreach ($this->map as $index => $values) { foreach ($this->map as $index => $values) {
...@@ -147,21 +143,6 @@ public function testUrlFromRequest() { ...@@ -147,21 +143,6 @@ public function testUrlFromRequest() {
return $urls; 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. * Tests the fromRoute() method with the special <front> path.
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment