You are here

public function SharedEmailTest::testUpdateMessage in Shared Email 8.2

Test the configuration form.

File

tests/src/Functional/SharedEmailTest.php, line 53

Class

SharedEmailTest
Tests for the sharedemail module.

Namespace

Drupal\Tests\sharedemail\Functional

Code

public function testUpdateMessage() {
  $this
    ->drupalLogin($this->user);
  $this
    ->drupalGet('admin/config/people/shared-email');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->fieldValueEquals('sharedemail_msg', $this
    ->config('sharedemail.settings')
    ->get('sharedemail_msg'));
  $edit = [
    'sharedemail_msg' => 'Test message',
  ];

  // Post the form.
  $this
    ->drupalPostForm('admin/config/people/shared-email', $edit, t('Save configuration'));

  // Test the new values are there.
  $this
    ->drupalGet('admin/config/people/shared-email');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->fieldValueEquals('sharedemail_msg', 'Test message');
}