summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2014-11-18 12:23:51 (GMT)
committerAlex Pott2014-11-18 12:24:36 (GMT)
commit547a1a0de7e781e563b86d40a0bea9ba574753a9 (patch)
treef86abd44cf366b509a2e919ddf840044a687443d
parent3b945fe250e4af8ff6e121796ba28c9c22b16f04 (diff)
Issue #2358995 by rpayanm, JeroenT, Alienpruts, gaurav.pahuja, er.pushpinderrana | Les Lim: Remove usage of drupal_wrap_mail().
-rw-r--r--core/lib/Drupal/Core/Mail/MailInterface.php4
-rw-r--r--core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php2
-rw-r--r--core/modules/system/src/Tests/Mail/HtmlToTextTest.php15
-rw-r--r--core/tests/Drupal/Tests/Core/Mail/MailFormatHelperTest.php2
4 files changed, 13 insertions, 10 deletions
diff --git a/core/lib/Drupal/Core/Mail/MailInterface.php b/core/lib/Drupal/Core/Mail/MailInterface.php
index 64573ad..22eb8d1 100644
--- a/core/lib/Drupal/Core/Mail/MailInterface.php
+++ b/core/lib/Drupal/Core/Mail/MailInterface.php
@@ -53,8 +53,8 @@ interface MailInterface {
* - subject: Subject of the email to be sent. This must not contain any
* newline characters, or the mail may not be sent properly.
* - body: Message to be sent. Accepts both CRLF and LF line-endings.
- * Email bodies must be wrapped. You can use drupal_wrap_mail() for
- * smart plain text wrapping.
+ * Email bodies must be wrapped. For smart plain text wrapping you can use
+ * \Drupal\Core\Mail\MailFormatHelper::wrapMail() .
* - headers: Associative array containing all additional mail headers not
* defined by one of the other parameters. PHP's mail() looks for Cc and
* Bcc headers and sends the mail to addresses in these headers too.
diff --git a/core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php b/core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php
index 1a97b66..3390a4a 100644
--- a/core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php
+++ b/core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php
@@ -38,7 +38,7 @@ class PhpMail implements MailInterface {
// Convert any HTML to plain-text.
$message['body'] = MailFormatHelper::htmlToText($message['body']);
// Wrap the mail body for sending.
- $message['body'] = drupal_wrap_mail($message['body']);
+ $message['body'] = MailFormatHelper::wrapMail($message['body']);
return $message;
}
diff --git a/core/modules/system/src/Tests/Mail/HtmlToTextTest.php b/core/modules/system/src/Tests/Mail/HtmlToTextTest.php
index 57de914..a6eccee 100644
--- a/core/modules/system/src/Tests/Mail/HtmlToTextTest.php
+++ b/core/modules/system/src/Tests/Mail/HtmlToTextTest.php
@@ -362,28 +362,31 @@ class HtmlToTextTest extends WebTestBase {
}
/**
- * Tests that drupal_wrap_mail() removes trailing whitespace before newlines.
+ * Tests that trailing whitespace is removed before newlines.
+ *
+ * @see \Drupal\Core\Mail\MailFormatHelper::wrapMail()
*/
public function testRemoveTrailingWhitespace() {
$text = "Hi there! \nHerp Derp";
- $mail_lines = explode("\n", drupal_wrap_mail($text));
+ $mail_lines = explode("\n", MailFormatHelper::wrapMail($text));
$this->assertNotEqual(" ", substr($mail_lines[0], -1), 'Trailing whitespace removed.');
}
/**
- * Tests that drupal_wrap_mail() does not remove the trailing whitespace from
- * Usenet style signatures.
+ * 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 \Drupal\Core\Mail\MailFormatHelper::wrapMail()
*/
public function testUsenetSignature() {
$text = "Hi there!\n-- \nHerp Derp";
- $mail_lines = explode("\n", drupal_wrap_mail($text));
+ $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", drupal_wrap_mail($text));
+ $mail_lines = explode("\n", MailFormatHelper::wrapMail($text));
$this->assertEqual("--", $mail_lines[1], 'Trailing whitespace removed for incorrect dash-dash-space signatures.');
}
}
diff --git a/core/tests/Drupal/Tests/Core/Mail/MailFormatHelperTest.php b/core/tests/Drupal/Tests/Core/Mail/MailFormatHelperTest.php
index f1f4258..a0dd6ae 100644
--- a/core/tests/Drupal/Tests/Core/Mail/MailFormatHelperTest.php
+++ b/core/tests/Drupal/Tests/Core/Mail/MailFormatHelperTest.php
@@ -17,7 +17,7 @@ use Drupal\Tests\UnitTestCase;
class MailFormatHelperTest extends UnitTestCase {
/**
- * Makes sure that drupal_wrap_mail() wraps the correct types of lines.
+ * @covers ::wrapMail
*/
public function testWrapMail() {
$delimiter = "End of header\n";