You are here

public function EmailContext::getSpooledEmails in Open Social 8.7

Same name and namespace in other branches
  1. 8.9 tests/behat/features/bootstrap/EmailContext.php \Drupal\social\Behat\EmailContext::getSpooledEmails()
  2. 8.3 tests/behat/features/bootstrap/EmailContext.php \Drupal\social\Behat\EmailContext::getSpooledEmails()
  3. 8.4 tests/behat/features/bootstrap/EmailContext.php \Drupal\social\Behat\EmailContext::getSpooledEmails()
  4. 8.5 tests/behat/features/bootstrap/EmailContext.php \Drupal\social\Behat\EmailContext::getSpooledEmails()
  5. 8.6 tests/behat/features/bootstrap/EmailContext.php \Drupal\social\Behat\EmailContext::getSpooledEmails()
  6. 8.8 tests/behat/features/bootstrap/EmailContext.php \Drupal\social\Behat\EmailContext::getSpooledEmails()
  7. 10.3.x tests/behat/features/bootstrap/EmailContext.php \Drupal\social\Behat\EmailContext::getSpooledEmails()
  8. 10.0.x tests/behat/features/bootstrap/EmailContext.php \Drupal\social\Behat\EmailContext::getSpooledEmails()
  9. 10.1.x tests/behat/features/bootstrap/EmailContext.php \Drupal\social\Behat\EmailContext::getSpooledEmails()
  10. 10.2.x tests/behat/features/bootstrap/EmailContext.php \Drupal\social\Behat\EmailContext::getSpooledEmails()

Get a list of spooled emails.

Return value

Finder|null Returns a Finder if the directory exists.

Throws

Exception

2 calls to EmailContext::getSpooledEmails()
EmailContext::findSubjectAndBody in tests/behat/features/bootstrap/EmailContext.php
Find an email with the given subject and body.
EmailContext::purgeSpool in tests/behat/features/bootstrap/EmailContext.php
Purge the messages in the spool.

File

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

Class

EmailContext

Namespace

Drupal\social\Behat

Code

public function getSpooledEmails() {
  $finder = new Finder();
  $spoolDir = $this
    ->getSpoolDir();
  if (empty($spoolDir)) {
    throw new \Exception('Could not retrieve the spool directory, or the directory does not exist.');
  }
  try {
    $finder
      ->files()
      ->in($spoolDir);
    return $finder;
  } catch (InvalidArgumentException $exception) {
    return NULL;
  }
}