function ControllerResolverTest::assertCallableController

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php \Drupal\Tests\Core\Controller\ControllerResolverTest::assertCallableController()
  2. 10 core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php \Drupal\Tests\Core\Controller\ControllerResolverTest::assertCallableController()
  3. 11.x 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

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));
}

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