
| Current Path : /var/www/html/rocksensor3/web/core/modules/path_alias/tests/src/Kernel/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor3/web/core/modules/path_alias/tests/src/Kernel/EntityAliasTest.php |
<?php
declare(strict_types=1);
namespace Drupal\Tests\path_alias\Kernel;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\KernelTests\KernelTestBase;
use Drupal\Tests\Traits\Core\PathAliasTestTrait;
/**
* Tests path alias on entities.
*
* @group path_alias
*/
class EntityAliasTest extends KernelTestBase {
use PathAliasTestTrait;
/**
* {@inheritdoc}
*/
protected static $modules = [
'path_alias',
'entity_test',
'user',
];
/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
$this->installEntitySchema('entity_test');
$this->installEntitySchema('path_alias');
$this->installEntitySchema('user');
}
/**
* Tests transform.
*/
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());
}
}