You are here

protected function SimplenewsTestBase::getMail in Simplenews 8

Returns the body content of mail that has been sent.

Parameters

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

Return value

string|bool The body of the mail, or FALSE if the offset is invalid.

3 calls to SimplenewsTestBase::getMail()
SimplenewsSubscribeTest::testSubscribeAnonymous in src/Tests/SimplenewsSubscribeTest.php
testSubscribeAnonymous
SimplenewsSubscribeTest::testSubscribeMultiple in src/Tests/SimplenewsSubscribeTest.php
Subscribe to multiple newsletters at the same time.
SimplenewsTestBase::assertMailText in src/Tests/SimplenewsTestBase.php
Checks if a string is found in the latest sent mail.

File

src/Tests/SimplenewsTestBase.php, line 263
Simplenews test functions.

Class

SimplenewsTestBase
Base class for simplenews web tests.

Namespace

Drupal\simplenews\Tests

Code

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