You are here

public function ContactLanguageTest::testContactLanguage in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/contact/src/Tests/ContactLanguageTest.php \Drupal\contact\Tests\ContactLanguageTest::testContactLanguage()

Tests configuration options with language enabled.

File

core/modules/contact/src/Tests/ContactLanguageTest.php, line 51
Contains \Drupal\contact\Tests\ContactLanguageTest.

Class

ContactLanguageTest
Tests contact messages with language module.

Namespace

Drupal\contact\Tests

Code

public function testContactLanguage() {

  // Ensure that contact form by default does not show the language select.
  $this
    ->drupalGet('contact');
  $this
    ->assertResponse(200, 'The page exists');
  $this
    ->assertNoField('edit-langcode-0-value');

  // Enable language select from content language settings page.
  $settings_path = 'admin/config/regional/content-language';
  $edit['entity_types[contact_message]'] = TRUE;
  $edit['settings[contact_message][feedback][settings][language][language_alterable]'] = TRUE;
  $this
    ->drupalPostForm($settings_path, $edit, t('Save configuration'));

  // Ensure that contact form now shows the language select.
  $this
    ->drupalGet('contact');
  $this
    ->assertResponse(200, 'The page exists');
  $this
    ->assertField('edit-langcode-0-value');
}