You are here

public function ControllerResolverTest::testGetArgumentsWithRouteMatchAndPsr7Request in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php \Drupal\Tests\Core\Controller\ControllerResolverTest::testGetArgumentsWithRouteMatchAndPsr7Request()

Tests getArguments with a route match and a PSR-7 request.

@covers ::getArguments @covers ::doGetArguments

File

core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php, line 239
Contains \Drupal\Tests\Core\Controller\ControllerResolverTest.

Class

ControllerResolverTest
@coversDefaultClass \Drupal\Core\Controller\ControllerResolver @group Controller

Namespace

Drupal\Tests\Core\Controller

Code

public function testGetArgumentsWithRouteMatchAndPsr7Request() {
  $request = Request::create('/test');
  $mock_controller = new MockControllerPsr7();
  $arguments = $this->controllerResolver
    ->getArguments($request, [
    $mock_controller,
    'getControllerWithRequestAndRouteMatch',
  ]);
  $this
    ->assertEquals(RouteMatch::createFromRequest($request), $arguments[0], 'Ensure that the route match object is passed along as well');
  $this
    ->assertInstanceOf('Psr\\Http\\Message\\ServerRequestInterface', $arguments[1], 'Ensure that the PSR-7 object is passed along as well');
}