function DrupalHtmlToTextTestCase::testDrupalHtmltoTextUsenetSignature

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

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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.