You are here

public function EmailContext::enableEmailSpool in Open Social 8.2

Same name and namespace in other branches
  1. 8 tests/behat/features/bootstrap/EmailContext.php \EmailContext::enableEmailSpool()

We need to enable the spool directory.

@BeforeScenario @email-spool

File

tests/behat/features/bootstrap/EmailContext.php, line 17

Class

EmailContext

Code

public function enableEmailSpool() {

  // Update Drupal configuration.
  $swiftmailer_config = \Drupal::configFactory()
    ->getEditable('swiftmailer.transport');
  $swiftmailer_config
    ->set('transport', 'spool');
  $swiftmailer_config
    ->set('spool_directory', $this
    ->getSpoolDir());
  $swiftmailer_config
    ->save();

  // Clean up emails that were left behind.
  $this
    ->purgeSpool();
}