3 namespace Drupal\KernelTests\Core\Path;
5 use Drupal\Core\Language\LanguageInterface;
6 use Drupal\KernelTests\KernelTestBase;
9 * @coversDefaultClass \Drupal\Core\Path\AliasStorage
12 class AliasStorageTest extends KernelTestBase {
17 public static $modules = ['system'];
20 * @var \Drupal\Core\Path\AliasStorage
27 protected function setUp() {
30 $this->storage = $this->container->get('path.alias_storage');
36 public function testLoad() {
37 $this->storage->save('/test-source-Case', '/test-alias-Case');
41 'alias' => '/test-alias-Case',
42 'source' => '/test-source-Case',
43 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
46 $this->assertEquals($expected, $this->storage->load(['alias' => '/test-alias-Case']));
47 $this->assertEquals($expected, $this->storage->load(['alias' => '/test-alias-case']));
48 $this->assertEquals($expected, $this->storage->load(['source' => '/test-source-Case']));
49 $this->assertEquals($expected, $this->storage->load(['source' => '/test-source-case']));
53 * @covers ::lookupPathAlias
55 public function testLookupPathAlias() {
56 $this->storage->save('/test-source-Case', '/test-alias');
58 $this->assertEquals('/test-alias', $this->storage->lookupPathAlias('/test-source-Case', LanguageInterface::LANGCODE_NOT_SPECIFIED));
59 $this->assertEquals('/test-alias', $this->storage->lookupPathAlias('/test-source-case', LanguageInterface::LANGCODE_NOT_SPECIFIED));
63 * @covers ::lookupPathSource
65 public function testLookupPathSource() {
66 $this->storage->save('/test-source', '/test-alias-Case');
68 $this->assertEquals('/test-source', $this->storage->lookupPathSource('/test-alias-Case', LanguageInterface::LANGCODE_NOT_SPECIFIED));
69 $this->assertEquals('/test-source', $this->storage->lookupPathSource('/test-alias-case', LanguageInterface::LANGCODE_NOT_SPECIFIED));
73 * @covers ::aliasExists
75 public function testAliasExists() {
76 $this->storage->save('/test-source-Case', '/test-alias-Case');
78 $this->assertTrue($this->storage->aliasExists('/test-alias-Case', LanguageInterface::LANGCODE_NOT_SPECIFIED));
79 $this->assertTrue($this->storage->aliasExists('/test-alias-case', LanguageInterface::LANGCODE_NOT_SPECIFIED));