function AttributeRouteDiscoveryTest::testTitleConflictsWithTitleDefault
Tests that the "title" property and a "_title" default cannot both be set.
File
-
core/
tests/ Drupal/ Tests/ Core/ Routing/ AttributeRouteDiscoveryTest.php, line 218
Class
Namespace
Drupal\Tests\Core\RoutingCode
public function testTitleConflictsWithTitleDefault() : void {
$this->expectException(\AssertionError::class);
$this->expectExceptionMessage('The "title" property cannot be used together with a "_title" default on the Route attribute.');
new Route(path: '/test', name: 'router_test.title_conflict', title: new TranslatableMarkup('Title from property'), defaults: [
'_title' => 'Title from default',
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.