You are here

public function ControllerResolverTest::testGetArgumentsWithRouteMatchAndRequest in Drupal 8

Tests getArguments with a route match and a request.

@covers ::doGetArguments

@group legacy

File

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

Class

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

Namespace

Drupal\Tests\Core\Controller

Code

public function testGetArgumentsWithRouteMatchAndRequest() {
  if (!in_array('Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolverInterface', class_implements('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolver'))) {
    $this
      ->markTestSkipped("Do not test ::getArguments() method when it is not implemented by Symfony's ControllerResolver.");
  }
  $request = Request::create('/test');
  $mock_controller = new MockController();
  $arguments = $this->controllerResolver
    ->getArguments($request, [
    $mock_controller,
    'getControllerWithRequestAndRouteMatch',
  ]);
  $this
    ->assertEquals([
    RouteMatch::createFromRequest($request),
    $request,
  ], $arguments);
}