function EntityUrlTest::testUrlEmpty

Tests the url() method without an entity ID.

@covers ::url @covers ::hasLinkTemplate @covers ::linkTemplates

@dataProvider providerTestUrl

@group legacy @expectedDeprecation EntityInterface::url() is deprecated in Drupal 8.0.0 and will be removed in Drupal 9.0.0. EntityInterface::toUrl() instead. Note, a \Drupal\Core\Url object is returned. See https://www.drupal.org/node/2614344

Parameters

string $rel: The link relation to test.

File

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

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

public function testUrlEmpty($rel) {
    $entity = $this->getEntity(EntityBase::class, []);
    $this->assertEquals('', $entity->url($rel));
}

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