You are here

public function RerouteEmailTestBase::assertEmailReroutedFromTestForm in Reroute Email 2.x

Submit test email form and assert rerouting.

Parameters

array $post: An array of post data: 'to', 'cc', 'bcc', 'subject', 'body'.

Throws

\Behat\Mink\Exception\ResponseTextException

1 call to RerouteEmailTestBase::assertEmailReroutedFromTestForm()
TestEmailFormTest::testEmailWithDisplayName in tests/src/Functional/TestEmailFormTest.php
Test for reroute_email display name supporting.

File

tests/src/Functional/RerouteEmailTestBase.php, line 182

Class

RerouteEmailTestBase
Base test class for Reroute Email test cases.

Namespace

Drupal\Tests\reroute_email\Functional

Code

public function assertEmailReroutedFromTestForm(array $post) : void {

  // Submit the test form.
  $this
    ->drupalGet('admin/config/development/reroute_email/test');
  $this
    ->submitForm($post, $this
    ->t('Send email'));
  $this
    ->assertSession()
    ->pageTextContains($this
    ->t('Test email submitted for delivery from test form.'));

  // Check rerouted email.
  $this
    ->assertMail('to', $this->rerouteConfig
    ->get(REROUTE_EMAIL_ADDRESS), new FormattableMarkup('An email was rerouted to @address.', [
    '@address' => $this->rerouteDestination,
  ]));
  $this
    ->assertEmailOriginallyTo($post['to']);
}