You are here

protected function ControllerResolverTest::assertCallableController in Drupal 10

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

Asserts that the controller is callable and produces the correct output.

@internal

Parameters

callable $controller: A callable controller.

string|null $class: Either the name of the class the controller represents, or NULL if it is not an object.

string|null $output: The output expected for this controller.

3 calls to ControllerResolverTest::assertCallableController()
ControllerResolverTest::testCreateController in core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php
Tests createController().
ControllerResolverTest::testGetController in core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php
Tests getController().
ControllerResolverTest::testGetControllerFromDefinition in core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php
Tests getControllerFromDefinition().

File

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

Class

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

Namespace

Drupal\Tests\Core\Controller

Code

protected function assertCallableController(callable $controller, ?string $class, ?string $output) : void {
  if ($class) {
    $this
      ->assertIsObject($controller[0]);
    $this
      ->assertInstanceOf($class, $controller[0]);
  }
  $this
    ->assertIsCallable($controller);
  $this
    ->assertSame($output, call_user_func($controller));
}