You are here

protected function AllowedLanguagesKernelTestBase::setUp in Allowed Languages 2.x

Same name and namespace in other branches
  1. 8 tests/src/Kernel/AllowedLanguagesKernelTestBase.php \Drupal\Tests\allowed_languages\Kernel\AllowedLanguagesKernelTestBase::setUp()

Overrides KernelTestBase::setUp

File

tests/src/Kernel/AllowedLanguagesKernelTestBase.php, line 38

Class

AllowedLanguagesKernelTestBase
Kernel test base for the allowed languages module.

Namespace

Drupal\Tests\allowed_languages\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('user');
  $this->user = User::create([
    'uid' => 1,
    'name' => $this
      ->randomString(),
  ]);
  $this->user
    ->save();
  $sv = ConfigurableLanguage::create([
    'label' => 'Swedish',
    'id' => 'sv',
  ]);
  $en = ConfigurableLanguage::create([
    'label' => 'English',
    'id' => 'en',
  ]);
  $sv
    ->save();
  $en
    ->save();
  $this->user
    ->set('allowed_languages', [
    $sv,
    $en,
  ]);
}