You are here

class QueueMailTestMailCollector in Queue Mail 8

QueueMailTestMailCollector class.

Defines a mail backend that captures sent and formatted messages in the state system.

Hierarchy

Expanded class hierarchy of QueueMailTestMailCollector

1 file declares its use of QueueMailTestMailCollector
queue_mail_test.module in tests/modules/queue_mail_test/queue_mail_test.module
Module for testing the Queue Mail module.

File

tests/modules/queue_mail_test/src/Plugin/Mail/QueueMailTestMailCollector.php, line 13

Namespace

Drupal\queue_mail_test\Plugin\Mail
View source
class QueueMailTestMailCollector extends TestMailCollector {

  /**
   * {@inheritdoc}
   */
  public function format(array $message) {
    $message = parent::format($message);
    $message['current_langcode'] = \Drupal::languageManager()
      ->getCurrentLanguage()
      ->getId();
    return $message;
  }

  /**
   * {@inheritdoc}
   */
  public function mail(array $message) {
    $result = parent::mail($message);
    if ($message['key'] == 'fail_message') {
      $result = FALSE;
    }
    return $result;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PhpMail::$configFactory protected property The configuration factory.
PhpMail::_isShellSafe protected static function Disallows potentially unsafe shell characters.
PhpMail::__construct public function PhpMail constructor.
QueueMailTestMailCollector::format public function Concatenates and wraps the email body for plain-text mails. Overrides PhpMail::format
QueueMailTestMailCollector::mail public function Sends an email message. Overrides TestMailCollector::mail