You are here

protected function SimplenewsTestBase::getMail in Simplenews 8.2

Same name and namespace in other branches
  1. 3.x tests/src/Functional/SimplenewsTestBase.php \Drupal\Tests\simplenews\Functional\SimplenewsTestBase::getMail()

Returns the body content of mail that has been sent.

Parameters

int $offset: Zero-based ordinal number of a sent mail.

Return value

string The body of the mail.

4 calls to SimplenewsTestBase::getMail()
SimplenewsSubscribeTest::testAdminCreate in tests/src/Functional/SimplenewsSubscribeTest.php
Tests admin creating a single subscriber.
SimplenewsSubscribeTest::testSubscribeAnonymous in tests/src/Functional/SimplenewsSubscribeTest.php
TestSubscribeAnonymous.
SimplenewsSubscribeTest::testSubscribeMultiple in tests/src/Functional/SimplenewsSubscribeTest.php
Subscribe to multiple newsletters at the same time.
SimplenewsTestBase::assertMailText in tests/src/Functional/SimplenewsTestBase.php
Checks if a string is found in the latest sent mail.

File

tests/src/Functional/SimplenewsTestBase.php, line 274

Class

SimplenewsTestBase
Base class for simplenews web tests.

Namespace

Drupal\Tests\simplenews\Functional

Code

protected function getMail($offset) {
  $mails = $this
    ->getMails();
  $this
    ->assertTrue(isset($mails[$offset]), t('Valid mails offset %offset (%count mails sent).', [
    '%offset' => $offset,
    '%count' => count($mails),
  ]));
  return $mails[$offset]['body'];
}