function AttributeRouteDiscoveryTest::testClassOnlyRouteWithInvoke
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/Routing/AttributeRouteDiscoveryTest.php \Drupal\Tests\Core\Routing\AttributeRouteDiscoveryTest::testClassOnlyRouteWithInvoke()
Tests that class-only #[Route] registers a route for invokable controllers.
File
-
core/
tests/ Drupal/ Tests/ Core/ Routing/ AttributeRouteDiscoveryTest.php, line 203
Class
Namespace
Drupal\Tests\Core\RoutingCode
public function testClassOnlyRouteWithInvoke() : void {
$route = $this->routeCollection
->get('router_test.class_only');
$this->assertNotNull($route);
$this->assertSame('/test_class_attribute_class_only', $route->getPath());
$this->assertSame(TestClassAttributeClassOnly::class, $route->getDefault('_controller'));
$this->assertSame('TRUE', $route->getRequirement('_access'));
// Aliases for invokable controllers must also be registered.
$this->assertSame($route, $this->routeCollection
->get(TestClassAttributeClassOnly::class . '::__invoke'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.