function ControllerResolverTest::providerTestGetControllerFromDefinition

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

Provides test data for testGetControllerFromDefinition().

File

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

Class

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

Namespace

Drupal\Tests\Core\Controller

Code

public function providerTestGetControllerFromDefinition() {
    return [
        // Tests a method on an object.
[
            [
                new MockController(),
                'getResult',
            ],
            'This is a regular controller.',
        ],
        // Tests a function.
[
            'phpversion',
            phpversion(),
        ],
        // Tests an object using __invoke().
[
            new MockInvokeController(),
            'This used __invoke().',
        ],
        // Tests a class using __invoke().
[
            'Drupal\\Tests\\Core\\Controller\\MockInvokeController',
            'This used __invoke().',
        ],
        // Tests a service from the container using __invoke().
[
            'invoke_service',
            'This used __invoke().',
        ],
    ];
}

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