Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
+++ b/core/lib/Drupal/Core/Mail/MailInterface.php
@@ -53,8 +53,10 @@ public function format(array $message);
+ * Email bodies must be wrapped.
+ * You can use
+ * \Drupal\Core\Mail\MailFormatHelper::wrapMail()
+ * for smart plain text wrapping.
Not formatted correctly.
+++ b/core/modules/system/src/Tests/Mail/HtmlToTextTest.php
@@ -358,28 +359,29 @@ public function testVeryLongLineWrap() {
- * Tests that drupal_wrap_mail() removes trailing whitespace before newlines.
+ * Tests that \Drupal\Core\Mail\MailFormatHelper::wrapMail()
+ * removes trailing whitespace before newlines.
...
- * Tests that drupal_wrap_mail() does not remove the trailing whitespace from
- * Usenet style signatures.
+ * Tests that \Drupal\Core\Mail\MailFormatHelper::wrapMail()
+ * does not remove the trailing whitespace from Usenet style signatures.
+++ b/core/tests/Drupal/Tests/Core/Mail/MailFormatHelperTest.php
@@ -17,7 +17,9 @@
- * Makes sure that drupal_wrap_mail() wraps the correct types of lines.
+ * Makes sure that
+ * \Drupal\Core\Mail\MailFormatHelper::wrapMail()
+ * wraps the correct types of lines.
Should be a single line. For example the first one could be:
Tests that trailing whitespace is removed before newlines.
@see \Drupal\Core\Mail\MailFormatHelper::wrapMail()
+++ b/core/tests/Drupal/Tests/Core/Mail/MailFormatHelperTest.php
@@ -17,7 +17,8 @@
/**
- * Makes sure that drupal_wrap_mail() wraps the correct types of lines.
+ * Makes sure that \Drupal\Core\Mail\MailFormatHelper::wrapMail() wraps the
+ * correct types of lines.
*/
This should be changed to just:
/**
* @covers ::wrapMail
*/
This is a special format for PHPUnit test method doc blocks that informs code coverage reports what is being tested. The docblock is essentially useless here.
Had to resolve one conflict in file HtmlToTextTest.php :
use Drupal\Component\Utility\String;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Mail\MailFormatHelper;
use Drupal\Core\Site\Settings;
use Drupal\simpletest\WebTestBase;
I hope I dit it correctly, if not : please advise on what I did wrong and what I should've done :)
PS : yes, i tested the patch against the 8.0.x branch with git apply --check :)
This issue is a prioritized change (deprecated function removal) as per https://www.drupal.org/core/beta-changes and it's benefits outweigh any disruption. Committed 547a1a0 and pushed to 8.0.x. Thanks!
diff --git a/core/modules/system/src/Tests/Mail/HtmlToTextTest.php b/core/modules/system/src/Tests/Mail/HtmlToTextTest.php
index de76c13..a6eccee 100644
--- a/core/modules/system/src/Tests/Mail/HtmlToTextTest.php
+++ b/core/modules/system/src/Tests/Mail/HtmlToTextTest.php
@@ -363,6 +363,7 @@ public function testVeryLongLineWrap() {
/**
* Tests that trailing whitespace is removed before newlines.
+ *
* @see \Drupal\Core\Mail\MailFormatHelper::wrapMail()
*/
public function testRemoveTrailingWhitespace() {
@@ -372,11 +373,12 @@ public function testRemoveTrailingWhitespace() {
}
/**
- * Tests that \Drupal\Core\Mail\MailFormatHelper::wrapMail() 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";
Comments
Comment #1
jeroentRemoved all usages of drupal_wrap_mail. Patch attached.
Comment #2
jeroentGo testbot!
Comment #3
jeroentCreated follow-up issue to remove the function itself: #2359071: Remove drupal_wrap_mail.
Comment #4
rpayanmminor changes
Comment #5
javivf commentedComment #6
alexpottNot formatted correctly.
Should be a single line. For example the first one could be:
Comment #7
jeroentComment #8
pushpinderchauhan commentedRe-rolled.
Comment #9
rpayanm\Drupal\Core\Mail\MailFormatHelper::wrapMail()-space here-for
Comment #10
gaurav.pahuja commentedAdded required space.
Comment #11
rpayanmLook fine for me :)
Comment #12
alexpottThis should be changed to just:
This is a special format for PHPUnit test method doc blocks that informs code coverage reports what is being tested. The docblock is essentially useless here.
Comment #13
alexpottNeeds works for #12 and since the replacement docblock in #10 breaks code standards by being multi-line.
Comment #14
jeroentMade changes as suggested by alexpott in #2358995-12: Remove usage of drupal_wrap_mail(). Patch attached.
Comment #15
rpayanmFix comments length :)
Comment #18
rpayanmComment #19
Alienpruts commentedMy first attempt at a reroll.
Had to resolve one conflict in file HtmlToTextTest.php :
use Drupal\Component\Utility\String;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Mail\MailFormatHelper;
use Drupal\Core\Site\Settings;
use Drupal\simpletest\WebTestBase;
I hope I dit it correctly, if not : please advise on what I did wrong and what I should've done :)
PS : yes, i tested the patch against the 8.0.x branch with git apply --check :)
Comment #20
wim leersLooks good!
Comment #21
alexpottThis issue is a prioritized change (deprecated function removal) as per https://www.drupal.org/core/beta-changes and it's benefits outweigh any disruption. Committed 547a1a0 and pushed to 8.0.x. Thanks!
Minor fixes on commit.