function EntityUrlTest::registerLinkTemplate

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php \Drupal\Tests\Core\Entity\EntityUrlTest::registerLinkTemplate()
  2. 10 core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php \Drupal\Tests\Core\Entity\EntityUrlTest::registerLinkTemplate()
  3. 11.x 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 485

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.