public function RouterTest::testControllerPlaceholders in Drupal 9
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Functional/Routing/RouterTest.php \Drupal\Tests\system\Functional\Routing\RouterTest::testControllerPlaceholders()
Confirms that placeholders in paths work correctly.
File
- core/
modules/ system/ tests/ src/ Functional/ Routing/ RouterTest.php, line 152
Class
- RouterTest
- Functional class for the full integrated routing system.
Namespace
Drupal\Tests\system\Functional\RoutingCode
public function testControllerPlaceholders() {
// Test with 0 and a random value.
$values = [
"0",
$this
->randomMachineName(),
];
foreach ($values as $value) {
$this
->drupalGet('router_test/test3/' . $value);
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextContains($value);
}
// Confirm that the page wrapping is being added, so we're not getting a
// raw body returned.
$this
->assertSession()
->responseContains('</html>');
// In some instances, the subrequest handling may get confused and render
// a page inception style. This test verifies that is not happening.
$this
->assertSession()
->responseNotMatches('#</body>.*</body>#s');
}