function EntityUrlTest::testToUrlLinkTemplateNoId
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php \Drupal\Tests\Core\Entity\EntityUrlTest::testToUrlLinkTemplateNoId()
- 10 core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php \Drupal\Tests\Core\Entity\EntityUrlTest::testToUrlLinkTemplateNoId()
- 11.x core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php \Drupal\Tests\Core\Entity\EntityUrlTest::testToUrlLinkTemplateNoId()
Tests the toUrl() method with link templates without an entity ID.
@dataProvider providerTestToUrlLinkTemplateNoId
@covers ::toUrl @covers ::linkTemplates @covers ::urlRouteParameters
Parameters
string $link_template: The link template to test.
string $expected_route_name: The expected route name of the generated URL.
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityUrlTest.php, line 222
Class
- EntityUrlTest
- Tests URL handling of the \Drupal\Core\Entity\EntityBase class.
Namespace
Drupal\Tests\Core\EntityCode
public function testToUrlLinkTemplateNoId($link_template, $expected_route_name) {
$entity = $this->getEntity(EntityBase::class, [
'id' => $this->entityId,
]);
$this->registerLinkTemplate($link_template);
/** @var \Drupal\Core\Url $url */
$url = $entity->toUrl($link_template);
$this->assertUrl($expected_route_name, [], $entity, FALSE, $url);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.