You are here

public function SwiftMailerSettingsTest::testMessageSettings in Swift Mailer 8

Tests the Message Settings.

File

src/Tests/SwiftMailerSettingsTest.php, line 103

Class

SwiftMailerSettingsTest
Tests the Transport and Message Settings UI.

Namespace

Drupal\swiftmailer\Tests

Code

public function testMessageSettings() {
  $this
    ->drupalGet('admin/config/swiftmailer/transport');
  $this
    ->assertResponse(403);

  // Login..
  $user = $this
    ->createUser([
    'administer swiftmailer',
  ]);
  $this
    ->drupalLogin($user);
  $this
    ->drupalGet(t('admin/config/swiftmailer/transport'));
  $this
    ->assertText(t('Transport types'));
  $this
    ->clickLink('Messages');
  $this
    ->assertText(t('Message format'));
  $this
    ->drupalPostForm(NULL, [
    'format[type]' => 'text/html',
    'convert[mode]' => 'TRUE',
    'character_set[type]' => 'EUC-CN',
  ], t('Save configuration'));
  $this
    ->assertText('The configuration options have been saved.');
  $config = $this
    ->config('swiftmailer.message');
  $format = $config
    ->get('format');
  $mode = $config
    ->get('convert_mode');
  $character = $config
    ->get('character_set');
  $this
    ->assertEqual($format, 'text/html');
  $this
    ->assertEqual($mode, 'TRUE');
  $this
    ->assertEqual($character, 'EUC-CN');
}