You are here

protected function SimplenewsRecipientHandlerTest::checkRecipients in Simplenews 3.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/SimplenewsRecipientHandlerTest.php \Drupal\Tests\simplenews\Functional\SimplenewsRecipientHandlerTest::checkRecipients()

Checks the expected users received mails.

3 calls to SimplenewsRecipientHandlerTest::checkRecipients()
SimplenewsRecipientHandlerTest::testNewUsers in tests/src/Functional/SimplenewsRecipientHandlerTest.php
Tests the "new users" recipient handler.
SimplenewsRecipientHandlerTest::testSiteMail in tests/src/Functional/SimplenewsRecipientHandlerTest.php
Tests the "site mail" recipient handler.
SimplenewsRecipientHandlerTest::testSubscribersByRole in tests/src/Functional/SimplenewsRecipientHandlerTest.php
Tests the "subscribers by role" recipient handler.

File

tests/src/Functional/SimplenewsRecipientHandlerTest.php, line 140

Class

SimplenewsRecipientHandlerTest
Test cases for creating and sending newsletters.

Namespace

Drupal\Tests\simplenews\Functional

Code

protected function checkRecipients(array $expected) {
  simplenews_cron();
  $mails = $this
    ->getMails();
  $this
    ->assertEqual(count($expected), count($mails), t('All mails were sent.'));
  foreach ($mails as $mail) {
    $this
      ->assertTrue(isset($expected[$mail['to']]), t('Found valid recipient @recip', [
      '@recip' => $mail['to'],
    ]));
    unset($expected[$mail['to']]);
  }
}