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. 10 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 34

Class

EntityUrlLanguageTest
Tests the language of entity URLs. @group language

Namespace

Drupal\Tests\language\Kernel

Code

protected function setUp() {
    parent::setUp();
    $this->installEntitySchema('entity_test');
    $this->installEntitySchema('configurable_language');
    \Drupal::service('router.builder')->rebuild();
    // In order to reflect the changes for a multilingual site in the container
    // we have to rebuild it.
    ConfigurableLanguage::create([
        'id' => 'es',
    ])->save();
    ConfigurableLanguage::create([
        'id' => '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.