function EntityAliasTest::testEntityAlias

Same name and namespace in other branches
  1. 10 core/modules/path_alias/tests/src/Kernel/EntityAliasTest.php \Drupal\Tests\path_alias\Kernel\EntityAliasTest::testEntityAlias()

Tests transform.

File

core/modules/path_alias/tests/src/Kernel/EntityAliasTest.php, line 42

Class

EntityAliasTest
Tests path alias on entities.

Namespace

Drupal\Tests\path_alias\Kernel

Code

public function testEntityAlias() : void {
    EntityTest::create([
        'id' => 1,
    ])->save();
    $this->createPathAlias('/entity_test/1', '/entity-alias');
    $entity = EntityTest::load(1);
    $this->assertSame('/entity-alias', $entity->toUrl()
        ->toString());
}

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