blob: 5f4e9835ed26741953314b4d01e0e43e4dccd085 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
<?php
require_once 'swift_required.php';
require_once __DIR__.'/Mime/SimpleMessageAcceptanceTest.php';
class Swift_MessageAcceptanceTest extends Swift_Mime_SimpleMessageAcceptanceTest
{
public function testAddPartWrapper()
{
$message = $this->_createMessage();
$message->setSubject('just a test subject');
$message->setFrom(array(
'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
$id = $message->getId();
$date = $message->getDate();
$boundary = $message->getBoundary();
$message->addPart('foo', 'text/plain', 'iso-8859-1');
$message->addPart('test <b>foo</b>', 'text/html', 'iso-8859-1');
$this->assertEquals(
'Message-ID: <'.$id.'>'."\r\n".
'Date: '.date('r', $date)."\r\n".
'Subject: just a test subject'."\r\n".
'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'."\r\n".
'MIME-Version: 1.0'."\r\n".
'Content-Type: multipart/alternative;'."\r\n".
' boundary="'.$boundary.'"'."\r\n".
"\r\n\r\n".
'--'.$boundary."\r\n".
'Content-Type: text/plain; charset=iso-8859-1'."\r\n".
'Content-Transfer-Encoding: quoted-printable'."\r\n".
"\r\n".
'foo'.
"\r\n\r\n".
'--'.$boundary."\r\n".
'Content-Type: text/html; charset=iso-8859-1'."\r\n".
'Content-Transfer-Encoding: quoted-printable'."\r\n".
"\r\n".
'test <b>foo</b>'.
"\r\n\r\n".
'--'.$boundary.'--'."\r\n",
$message->toString()
);
}
protected function _createMessage()
{
Swift_DependencyContainer::getInstance()
->register('properties.charset')->asValue(null);
return Swift_Message::newInstance();
}
}
|