You are here

function DrupalHtmlToTextTestCase::testDrupalHtmltoTextUsenetSignature in Drupal 7

Tests drupal_wrap_mail() retains whitespace from Usenet style signatures.

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."

File

modules/simpletest/tests/mail.test, line 360
Test the Drupal mailing system.

Class

DrupalHtmlToTextTestCase
Unit tests for drupal_html_to_text().

Code

function testDrupalHtmltoTextUsenetSignature() {
  $text = "Hi there!\n-- \nHerp Derp";
  $mail_lines = explode("\n", drupal_wrap_mail($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", drupal_wrap_mail($text));
  $this
    ->assertEqual("--", $mail_lines[1], 'Trailing whitespace removed for incorrect dash-dash-space signatures.');
}