Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Testing if mail headers are properly removed
<?php
namespace BMytest;
class ZendMailTest extends \PHPUnit_Framework_TestCase
{
public function testRemovingHeadersFromMultipleMailObjects()
{
$mail1 = new \Zend_Mail();
$mail1->addHeader('foo', 'bar');
$mail1->addHeader('x-mfo-mailid', uniqid());
$mail2 = clone $mail1;
$mail2->addHeader('bar', 'baz', true);
$mail3 = clone $mail2;
$mail3->addHeader('baz', 'foobar', true);
$mailList = array ($mail1, $mail2, $mail3);
foreach ($mailList as $mail) {
$mail->clearHeader('x-mfo-mailid');
$this->assertArrayNotHasKey('x-mfo-mailid', $mail->getHeaders());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.