You are here

protected function ControllerResolverTest::assertCallableController in Drupal 8

Same name and namespace in other branches
  1. 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.

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.

mixed $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 221
Contains \Drupal\Tests\Core\Controller\ControllerResolverTest.

Class

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

Namespace

Drupal\Tests\Core\Controller

Code

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