You are here

public function HtmlToTextTest::testUsenetSignature in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Mail/HtmlToTextTest.php \Drupal\system\Tests\Mail\HtmlToTextTest::testUsenetSignature()

Tests that trailing whitespace from Usenet style signatures is not removed.

RFC 3676 says, "This is a special case; an (optionally quoted or quoted and stuffed) line consisting of DASH DASH SP is neither fixed nor flowed."

See also

\Drupal\Core\Mail\MailFormatHelper::wrapMail()

File

core/modules/system/src/Tests/Mail/HtmlToTextTest.php, line 382
Contains \Drupal\system\Tests\Mail\HtmlToTextTest.

Class

HtmlToTextTest
Tests for \Drupal\Core\Mail\MailFormatHelper::htmlToText().

Namespace

Drupal\system\Tests\Mail

Code

public function testUsenetSignature() {
  $text = "Hi there!\n-- \nHerp Derp";
  $mail_lines = explode("\n", MailFormatHelper::wrapMail($text));
  $this
    ->assertEqual("-- ", $mail_lines[1], 'Trailing whitespace not removed for dash-dash-space signatures.');
  $text = "Hi there!\n--  \nHerp Derp";
  $mail_lines = explode("\n", MailFormatHelper::wrapMail($text));
  $this
    ->assertEqual("--", $mail_lines[1], 'Trailing whitespace removed for incorrect dash-dash-space signatures.');
}