You are here

public function ControllerResolverTest::testGetController in Drupal 9

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

Tests getController().

@dataProvider providerTestGetController

File

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

Class

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

Namespace

Drupal\Tests\Core\Controller

Code

public function testGetController($attributes, $class, $output = NULL) {
  $request = new Request([], [], $attributes);
  $result = $this->controllerResolver
    ->getController($request);
  if ($class) {
    $this
      ->assertCallableController($result, $class, $output);
  }
  else {
    $this
      ->assertFalse($result);
  }
}