You are here

protected function LanguageSelectionPageConditionTest::setUp in Language Selection Page 8.2

Overrides BrowserTestBase::setUp

File

tests/src/Functional/LanguageSelectionPageConditionTest.php, line 55

Class

LanguageSelectionPageConditionTest
Tests that the condition plugins work.

Namespace

Drupal\Tests\language_selection_page\Functional

Code

protected function setUp() {
  parent::setUp();
  $this
    ->drupalPlaceBlock('search_form_block', [
    'label' => 'Search',
  ]);
  $admin = $this
    ->drupalCreateUser([], NULL, TRUE);
  $this
    ->drupalLogin($admin);
  $this
    ->drupalCreateContentType([
    'type' => 'page',
  ]);

  // Create FR.
  $this
    ->drupalPostForm('admin/config/regional/language/add', [
    'predefined_langcode' => 'fr',
  ], 'Add language');

  // Set prefixes to en and fr.
  $this
    ->drupalPostForm('admin/config/regional/language/detection/url', [
    'prefix[en]' => 'en',
    'prefix[fr]' => 'fr',
  ], 'Save configuration');

  // Set up URL and language selection page methods.
  $this
    ->drupalPostForm('admin/config/regional/language/detection', [
    'language_interface[enabled][language-selection-page]' => 1,
    'language_interface[enabled][language-url]' => 1,
  ], 'Save settings');

  // Turn on content translation for pages.
  $this
    ->drupalPostform('admin/structure/types/manage/page', [
    'language_configuration[content_translation]' => 1,
  ], 'Save content type');
  $this->configOriginal = $this
    ->config('language_selection_page.negotiation')
    ->get();
}