function RouterTest::testAttributeDiscovery
Same name and namespace in other branches
- main core/modules/system/tests/src/Functional/Routing/RouterTest.php \Drupal\Tests\system\Functional\Routing\RouterTest::testAttributeDiscovery()
Tests routes defined using PHP attributes.
File
-
core/
modules/ system/ tests/ src/ Functional/ Routing/ RouterTest.php, line 408
Class
- RouterTest
- Functional class for the full integrated routing system.
Namespace
Drupal\Tests\system\Functional\RoutingCode
public function testAttributeDiscovery() : void {
$this->drupalGet('/test_class_attribute');
$this->assertSession()
->statusCodeEquals(200);
$this->assertSession()
->pageTextContains('Testing __invoke() with a Route attribute on the class');
$this->drupalGet('/test_method_attribute');
$this->assertSession()
->statusCodeEquals(200);
$this->assertSession()
->pageTextContains('Testing method with a Route attribute');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.