function NormalizeTest::getEntityUri

Same name in other branches
  1. 9 core/modules/hal/tests/src/Kernel/NormalizeTest.php \Drupal\Tests\hal\Kernel\NormalizeTest::getEntityUri()

Constructs the entity URI.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity.

Return value

string The entity URI.

1 call to NormalizeTest::getEntityUri()
NormalizeTest::testNormalize in core/modules/hal/tests/src/Kernel/NormalizeTest.php
Tests the normalize function.

File

core/modules/hal/tests/src/Kernel/NormalizeTest.php, line 203

Class

NormalizeTest
Tests HAL normalization edge cases for EntityResource.

Namespace

Drupal\Tests\hal\Kernel

Code

protected function getEntityUri(EntityInterface $entity) {
    $url = $entity->toUrl('canonical', [
        'absolute' => TRUE,
    ]);
    return $url->setRouteParameter('_format', 'hal_json')
        ->toString();
}

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