function EntityUrlLanguageTest::setUp

Same name in other branches
  1. 9 core/modules/language/tests/src/Kernel/EntityUrlLanguageTest.php \Drupal\Tests\language\Kernel\EntityUrlLanguageTest::setUp()
  2. 8.9.x core/modules/language/tests/src/Kernel/EntityUrlLanguageTest.php \Drupal\Tests\language\Kernel\EntityUrlLanguageTest::setUp()
  3. 11.x core/modules/language/tests/src/Kernel/EntityUrlLanguageTest.php \Drupal\Tests\language\Kernel\EntityUrlLanguageTest::setUp()

Overrides LanguageTestBase::setUp

File

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

Class

EntityUrlLanguageTest
Tests the language of entity URLs. @group language

Namespace

Drupal\Tests\language\Kernel

Code

protected function setUp() : void {
    parent::setUp();
    $this->installEntitySchema('entity_test');
    $this->installEntitySchema('configurable_language');
    // In order to reflect the changes for a multilingual site in the container
    // we have to rebuild it.
    ConfigurableLanguage::createFromLangcode('es')->save();
    ConfigurableLanguage::createFromLangcode('fr')->save();
    $config = $this->config('language.negotiation');
    $config->set('url.prefixes', [
        'en' => 'en',
        'es' => 'es',
        'fr' => 'fr',
    ])
        ->save();
    \Drupal::service('kernel')->rebuildContainer();
    $this->createTranslatableEntity();
}

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