You are here

public function EntityUrlLanguageTest::testEntityUrlLanguage in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/language/tests/src/Kernel/EntityUrlLanguageTest.php \Drupal\Tests\language\Kernel\EntityUrlLanguageTest::testEntityUrlLanguage()

Ensures that entity URLs in a language have the right language prefix.

1 call to EntityUrlLanguageTest::testEntityUrlLanguage()
EntityUrlLanguageTest::testEntityUrlLanguageWithLanguageContentEnabled in core/modules/language/tests/src/Kernel/EntityUrlLanguageTest.php
Ensures correct entity URLs with the method language-content-entity enabled.

File

core/modules/language/tests/src/Kernel/EntityUrlLanguageTest.php, line 57

Class

EntityUrlLanguageTest
Tests the language of entity URLs. @group language

Namespace

Drupal\Tests\language\Kernel

Code

public function testEntityUrlLanguage() {
  $this
    ->assertStringContainsString('/en/entity_test/' . $this->entity
    ->id(), $this->entity
    ->toUrl()
    ->toString());
  $this
    ->assertStringContainsString('/es/entity_test/' . $this->entity
    ->id(), $this->entity
    ->getTranslation('es')
    ->toUrl()
    ->toString());
  $this
    ->assertStringContainsString('/fr/entity_test/' . $this->entity
    ->id(), $this->entity
    ->getTranslation('fr')
    ->toUrl()
    ->toString());
}