You are here

public function DisableLanguageSettingsFormTest::testSettingsSaved in Disable language 8

Test form submit.

File

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

Class

DisableLanguageSettingsFormTest
@coversDefaultClass \Drupal\disable_language\Form\DisableLanguageSettings @group disable_language

Namespace

Drupal\Tests\disable_language\Functional

Code

public function testSettingsSaved() {
  $this
    ->drupalGet('admin/config/regional/language/disable_language');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $config = $this
    ->config('disable_language.settings');
  $this
    ->assertSession()
    ->fieldValueEquals('redirect_override_routes', implode("\n", $config
    ->get('redirect_override_routes')));
  $this
    ->assertSession()
    ->fieldValueEquals('exclude_request_path[pages]', $config
    ->get('exclude_request_path')['pages']);
  $edit = [
    'redirect_override_routes' => 'system.admin_content',
    'exclude_request_path[pages]' => '/user/*',
  ];
  $this
    ->submitForm($edit, t('Save configuration'));
  $this
    ->assertSession()
    ->pageTextContains('The configuration options have been saved.');
  $this
    ->drupalGet('admin/config/regional/language/disable_language');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->fieldValueEquals('redirect_override_routes', 'system.admin_content');
  $this
    ->assertSession()
    ->fieldValueEquals('exclude_request_path[pages]', '/user/*');
}