Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d470523

Browse filesBrowse files
BrokenSourceCodeBrokenSourceCode
BrokenSourceCode
authored and
BrokenSourceCode
committed
Add unit test
1 parent e028d52 commit d470523
Copy full SHA for d470523

File tree

1 file changed

+20
-0
lines changed
Filter options

1 file changed

+20
-0
lines changed

‎src/Symfony/Component/Mime/Tests/EmailTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mime/Tests/EmailTest.php
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,4 +458,24 @@ public function testTextBodyAcceptedTypes()
458458
$email->text($contents);
459459
$this->assertSame($contents, $email->getTextBody());
460460
}
461+
462+
public function testBodyCache()
463+
{
464+
$email = new Email();
465+
$email->from('fabien@symfony.com');
466+
$email->to('fabien@symfony.com');
467+
$email->text('foo');
468+
$body1 = $email->getBody();
469+
$body2 = $email->getBody();
470+
$this->assertSame($body1, $body2, "The two bodies must reference the same object. The body cache ensures that the hash of the DKIM signature is valid.");
471+
472+
$email = new Email();
473+
$email->from('fabien@symfony.com');
474+
$email->to('fabien@symfony.com');
475+
$email->text('foo');
476+
$body1 = $email->getBody();
477+
$email->html('<b>bar</b>'); // We change a part to reset the body cache.
478+
$body2 = $email->getBody();
479+
$this->assertNotSame($body1, $body2, "The two bodies must not reference the same object. The body cache ensures that the hash of the DKIM signature is valid.");
480+
}
461481
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.