Skip to content

Instantly share code, notes, and snippets.

@DragonBe
Created July 17, 2014 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DragonBe/a2f16a106fb29c9dfba7 to your computer and use it in GitHub Desktop.
Save DragonBe/a2f16a106fb29c9dfba7 to your computer and use it in GitHub Desktop.
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