You are here

public function SwiftMailerSettingsTest::testMessageSettings in Swift Mailer 8.2

Tests the Message Settings.

File

tests/src/FunctionalJavascript/SwiftMailerSettingsTest.php, line 117

Class

SwiftMailerSettingsTest
Tests the Transport and Message Settings UI.

Namespace

Drupal\Tests\swiftmailer\FunctionalJavascript

Code

public function testMessageSettings() {
  $this
    ->drupalGet('admin/config/swiftmailer/transport');
  $this
    ->assertSession()
    ->pageTextContains('You are not authorized to access this page.');

  // Login..
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('admin/config/swiftmailer/transport');
  $this
    ->assertSession()
    ->pageTextContains('Transport types');
  $this
    ->clickLink('Messages');
  $this
    ->assertSession()
    ->pageTextContains('Content type');
  $this
    ->submitForm([
    'content_type[type]' => 'text/html',
    'generate_plain[mode]' => TRUE,
    'character_set[type]' => 'EUC-CN',
  ], 'Save configuration');
  $this
    ->assertSession()
    ->pageTextContains('The configuration options have been saved.');
  $config = $this
    ->config('swiftmailer.message');
  $content_type = $config
    ->get('content_type');
  $mode = $config
    ->get('generate_plain');
  $character = $config
    ->get('character_set');
  $this
    ->assertEqual($content_type, 'text/html');
  $this
    ->assertEqual($mode, TRUE);
  $this
    ->assertEqual($character, 'EUC-CN');
}