function EntityUrlTest::registerLinkTemplate

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

6 calls to EntityUrlTest::registerLinkTemplate()
EntityUrlTest::testToUrlDefaultFallback in core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php
Tests the toUrl() method without specifying the $rel parameter.
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.

... See full list

File

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

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.