function EntityUrlTest::registerLinkTemplate

Same name and namespace in other branches
  1. 9 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.

6 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.

... See full list

File

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

Class

EntityUrlTest
Tests URL handling of the <a href="/api/drupal/core%21lib%21Drupal%21Core%21Entity%21Entity.php/class/Entity/8.9.x" title="Defines a base entity class." class="local">\Drupal\Core\Entity\Entity</a> 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.