You are here

protected function EntityUrlTest::registerLinkTemplate in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php \Drupal\Tests\Core\Entity\EntityUrlTest::registerLinkTemplate()

Registers a link template for the mock entity.

Parameters

string $link_template: The link template to register.

5 calls to EntityUrlTest::registerLinkTemplate()
EntityUrlTest::testToUrlLinkTemplateAddForm in core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php
Tests the toUrl() method with the 'revision' link template.
EntityUrlTest::testToUrlLinkTemplateNoId in core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php
Tests the toUrl() method with link templates without an entity ID.
EntityUrlTest::testToUrlLinkTemplateRevision in core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php
Tests the toUrl() method with the 'revision' link template.
EntityUrlTest::testToUrlLinkTemplates in core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php
Tests the toUrl() method with simple link templates.
EntityUrlTest::testUriRelationships in core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php
Tests the uriRelationships() method.

File

core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php, line 483

Class

EntityUrlTest
Tests URL handling of the \Drupal\Core\Entity\EntityBase class.

Namespace

Drupal\Tests\Core\Entity

Code

protected function registerLinkTemplate($link_template) {
  $link_templates = [
    // The path is actually never used because we never invoke the URL
    // generator but perform assertions on the URL object directly.
    $link_template => "/test-entity/{test_entity}/{$link_template}",
  ];
  $this->entityType
    ->getLinkTemplates()
    ->willReturn($link_templates);
}