You are here

protected function DisableLanguageRedirectTest::setUp in Disable language 8

Overrides BrowserTestBase::setUp

File

tests/src/Functional/DisableLanguageRedirectTest.php, line 38

Class

DisableLanguageRedirectTest
@coversDefaultClass \Drupal\disable_language\EventSubscriber\DisabledLanguagesEventSubscriber @group disable_language

Namespace

Drupal\Tests\disable_language\Functional

Code

protected function setUp() {
  parent::setUp();
  ConfigurableLanguage::load('en')
    ->setWeight(0)
    ->save();
  ConfigurableLanguage::createFromLangcode('nl')
    ->setWeight(1)
    ->save();
  ConfigurableLanguage::createFromLangcode('fr')
    ->setWeight(2)
    ->setThirdPartySetting('disable_language', 'disable', 1)
    ->setThirdPartySetting('disable_language', 'redirect_language', 'nl')
    ->save();
  if ($this->profile !== 'standard') {
    $this
      ->drupalCreateContentType([
      'type' => 'page',
      'name' => 'Basic page',
    ]);
  }
  $this->node = $this
    ->drupalCreateNode([
    'title' => $this
      ->randomString(),
  ]);
  $this->node
    ->addTranslation('nl', [
    'title' => $this
      ->randomString(),
  ]);
  $this->node
    ->addTranslation('fr', [
    'title' => $this
      ->randomString(),
  ]);
  $this->node
    ->save();
}