function ControllerResolverTest::testGetController

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php \Drupal\Tests\Core\Controller\ControllerResolverTest::testGetController()
  2. 8.9.x core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php \Drupal\Tests\Core\Controller\ControllerResolverTest::testGetController()
  3. 11.x core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php \Drupal\Tests\Core\Controller\ControllerResolverTest::testGetController()

Tests getController().

@dataProvider providerTestGetController @group legacy

File

core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php, line 109

Class

ControllerResolverTest
@coversDefaultClass \Drupal\Core\Controller\ControllerResolver[[api-linebreak]] @group Controller

Namespace

Drupal\Tests\Core\Controller

Code

public function testGetController($attributes, $class, $output = NULL) : void {
  if ($class) {
    $this->expectDeprecation('Implementing \\Symfony\\Component\\DependencyInjection\\ContainerAwareInterface is deprecated in drupal:10.3.0 and it will be removed in drupal:11.0.0. Implement \\Drupal\\Core\\DependencyInjection\\ContainerInjectionInterface and use dependency injection instead. See https://www.drupal.org/node/3428661');
  }
  $request = new Request([], [], $attributes);
  $result = $this->controllerResolver
    ->getController($request);
  if ($class) {
    $this->assertCallableController($result, $class, $output);
  }
  else {
    $this->assertFalse($result);
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.