You are here

protected function DynamicEntityReferenceLocaleTest::setUp in Dynamic Entity Reference 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/DynamicEntityReferenceLocaleTest.php \Drupal\Tests\dynamic_entity_reference\Functional\DynamicEntityReferenceLocaleTest::setUp()

Sets the test up.

Overrides DynamicEntityReferenceTest::setUp

File

tests/src/Functional/DynamicEntityReferenceLocaleTest.php, line 26

Class

DynamicEntityReferenceLocaleTest
Tests localization aspects of the module.

Namespace

Drupal\Tests\dynamic_entity_reference\Functional

Code

protected function setUp() : void {
  parent::setUp();
  $file = new \stdClass();
  $file->uri = \Drupal::service('file_system')
    ->realpath(drupal_get_path('module', 'dynamic_entity_reference') . '/tests/test.de.po');
  $file->langcode = 'de';
  Gettext::fileToDatabase($file, []);
  ConfigurableLanguage::createFromLangcode('de')
    ->save();
  $this
    ->config('system.site')
    ->set('default_langcode', 'de')
    ->save();

  // Rebuild the container to update the default language container variable.
  $this
    ->rebuildContainer();
}