You are here

class TestHtmlMailCollector in Ubercart 8.4

Defines an HTML-capable mail backend that captures sent messages for tests.

Plugin annotation


@Mail(
  id = "test_html_mail_collector",
  label = @Translation("HTML mailer for testing"),
  description = @Translation("Does not send the message, but stores it in Drupal within the state system. Used for testing HTML messages.")
)

Hierarchy

Expanded class hierarchy of TestHtmlMailCollector

File

uc_store/src/Plugin/Mail/TestHtmlMailCollector.php, line 16

Namespace

Drupal\uc_store\Plugin\Mail
View source
class TestHtmlMailCollector extends TestMailCollector {

  /**
   * Overrides PhpMail::format() to prevent it from stripping out the HTML.
   *
   * @param array $message
   *   A message array, as described in hook_mail_alter().
   *
   * @return string
   *   The formatted $message.
   */
  public function format(array $message) {
    $message['body'] = implode("\n\n", $message['body']);
    return $message;
  }

}

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.
TestHtmlMailCollector::format public function Overrides PhpMail::format() to prevent it from stripping out the HTML. Overrides PhpMail::format
TestMailCollector::mail public function Sends an email message. Overrides PhpMail::mail