class TestClassAttribute

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/modules/router_test_directory/src/Controller/TestClassAttribute.php \Drupal\router_test\Controller\TestClassAttribute

Test controller for class-level Route attribute with method-level merging.

Attributes

#[Route(path: '/test_class_attribute', name: 'router_test.class_', requirements: [ '_access' => 'TRUE', ], options: [ 'option_a' => 'from_class', ], defaults: [ 'default_a' => 'from_class', '_title' => 'Class title', ], methods: [ 'GET', ], schemes: [ 'http', ], priority: 5)]

Hierarchy

Expanded class hierarchy of TestClassAttribute

1 file declares its use of TestClassAttribute
AttributeRouteDiscoveryTest.php in core/tests/Drupal/Tests/Core/Routing/AttributeRouteDiscoveryTest.php

File

core/modules/system/tests/modules/router_test_directory/src/Controller/TestClassAttribute.php, line 13

Namespace

Drupal\router_test\Controller
View source
class TestClassAttribute extends ControllerBase {
  public function __invoke() : array {
    return [
      '#markup' => 'Testing __invoke() with a Route attribute on the class',
    ];
  }
  public function inherits() : array {
    return [
      '#markup' => 'Inherits class globals',
    ];
  }
  public function overrides() : array {
    return [
      '#markup' => 'Overrides class globals',
    ];
  }

}

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