diff --git a/core/modules/user/tests/src/FunctionalJavascript/UserPasswordResetTest.php b/core/modules/user/tests/src/FunctionalJavascript/UserPasswordResetTest.php index 5d996c0298edb45cd157296b4914762cff7951ec..061f8cf4011423fa28dd56fc26d633066fa43cb4 100644 --- a/core/modules/user/tests/src/FunctionalJavascript/UserPasswordResetTest.php +++ b/core/modules/user/tests/src/FunctionalJavascript/UserPasswordResetTest.php @@ -84,6 +84,9 @@ public function testUserPasswordResetWithAdditionalAjaxForm(): void { $edit['name'] = $this->account->getAccountName(); $this->submitForm($edit, 'Submit'); + // Check that the email message body does not contain HTML entities + $this->assertTrue($this->checkBodyText(), 'The body text of the email contains no HTML entities'); + $resetURL = $this->getResetURL(); $this->drupalGet($resetURL); @@ -122,4 +125,17 @@ public function getResetURL() { return $urls[0]; } + /** + * Checks the email body text for the presence of HTML entities. + */ + public function checkBodyText(): bool { + // Assume the most recent email. + $_emails = $this->drupalGetMails(); + $email = end($_emails); + if (strip_tags($email['body']) === $email['body']) { + return TRUE; + } + return FALSE; + } + }