You are here

public function EntityUrlLanguageTest::testEntityUrlLanguage in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/language/src/Tests/EntityUrlLanguageTest.php \Drupal\language\Tests\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/src/Tests/EntityUrlLanguageTest.php
Ensures correct entity URLs with the method language-content-entity enabled.

File

core/modules/language/src/Tests/EntityUrlLanguageTest.php, line 63
Contains \Drupal\language\Tests\EntityUrlLanguageTest.

Class

EntityUrlLanguageTest
Tests the language of entity URLs. @group language

Namespace

Drupal\language\Tests

Code

public function testEntityUrlLanguage() {
  $this
    ->assertTrue(strpos($this->entity
    ->urlInfo()
    ->toString(), '/en/entity_test/' . $this->entity
    ->id()) !== FALSE);
  $this
    ->assertTrue(strpos($this->entity
    ->getTranslation('es')
    ->urlInfo()
    ->toString(), '/es/entity_test/' . $this->entity
    ->id()) !== FALSE);
  $this
    ->assertTrue(strpos($this->entity
    ->getTranslation('fr')
    ->urlInfo()
    ->toString(), '/fr/entity_test/' . $this->entity
    ->id()) !== FALSE);
}