You are here

protected function EntityUrlLanguageTest::setUp 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::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() : 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::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();
}