You are here

public function QueueMailFunctionalTest::testSkippedEmail in Queue Mail 8

Test that messages are not queued if the the "send" flag is FALSE.

File

tests/src/Functional/QueueMailFunctionalTest.php, line 109

Class

QueueMailFunctionalTest
Tests queue mail functionality.

Namespace

Drupal\Tests\queue_mail\Functional

Code

public function testSkippedEmail() {
  $this
    ->setAllEmailsToBeQueued();
  $this
    ->assertEmpty($this
    ->getMails(), 'Ensure that mail collector is empty.');
  $this
    ->sendQueueMailTest('skipped', 'info@example.com', $this
    ->getMessageParams());
  $this
    ->assertEmpty($this
    ->getMails(), 'Emails has not been sent.');
  $queue = _queue_mail_get_queue();
  $this
    ->assertEquals(0, $queue
    ->numberOfItems(), 'Email has not been added to the mail queue.');
  $this
    ->cronRun();
  $this
    ->assertEmpty($this
    ->getMails(), 'Emails has not been sent after cron run.');
}