You are here

public function QueueMailFunctionalTest::testQueuedEmailKeyMatching in Queue Mail 8

This tests the matching of mailkeys to be queued.

For example, we test that a specific email from a module is queued, and that emails from another module are not queued.

File

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

Class

QueueMailFunctionalTest
Tests queue mail functionality.

Namespace

Drupal\Tests\queue_mail\Functional

Code

public function testQueuedEmailKeyMatching() {

  // Set only some emails to be queued and test.
  \Drupal::configFactory()
    ->getEditable('queue_mail.settings')
    ->set('queue_mail_keys', 'queue_mail_test_queued')
    ->save();
  $this
    ->sendEmailAndTest('queued', TRUE);
  $this
    ->sendEmailAndTest('not_queued', FALSE);

  // And test the wildcard matching.
  \Drupal::configFactory()
    ->getEditable('queue_mail.settings')
    ->set('queue_mail_keys', 'queue_mail_test_que*')
    ->save();
  $this
    ->sendEmailAndTest('queued', TRUE);
  $this
    ->sendEmailAndTest('not_queued', FALSE);
}