summaryrefslogtreecommitdiff
path: root/vendor/swiftmailer/swiftmailer/tests/acceptance
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/swiftmailer/swiftmailer/tests/acceptance')
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/AttachmentAcceptanceTest.php12
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php162
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php179
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php24
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EmbeddedFileAcceptanceTest.php12
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Base64EncoderAcceptanceTest.php45
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php54
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php50
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EncodingAcceptanceTest.php30
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php173
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php173
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php55
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php123
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/Base64ContentEncoderAcceptanceTest.php56
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php88
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/PlainContentEncoderAcceptanceTest.php88
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php160
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php136
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php32
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php127
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php1249
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MimePartAcceptanceTest.php15
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php131
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php33
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php26
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php67
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php40
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/TlsSocketAcceptanceTest.php39
28 files changed, 3379 insertions, 0 deletions
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/AttachmentAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/AttachmentAcceptanceTest.php
new file mode 100644
index 0000000..5c0b826
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/AttachmentAcceptanceTest.php
@@ -0,0 +1,12 @@
+<?php
+
+require_once 'swift_required.php';
+require_once __DIR__.'/Mime/AttachmentAcceptanceTest.php';
+
+class Swift_AttachmentAcceptanceTest extends Swift_Mime_AttachmentAcceptanceTest
+{
+ protected function _createAttachment()
+ {
+ return Swift_Attachment::newInstance();
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php
new file mode 100644
index 0000000..49ad20a
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php
@@ -0,0 +1,162 @@
+<?php
+
+class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_TestCase
+{
+ private $_testFile;
+
+ protected function setUp()
+ {
+ $this->_testFile = sys_get_temp_dir().'/swift-test-file'.__CLASS__;
+ file_put_contents($this->_testFile, 'abcdefghijklm');
+ }
+
+ protected function tearDown()
+ {
+ unlink($this->_testFile);
+ }
+
+ public function testFileDataCanBeRead()
+ {
+ $file = $this->_createFileStream($this->_testFile);
+ $str = '';
+ while (false !== $bytes = $file->read(8192)) {
+ $str .= $bytes;
+ }
+ $this->assertEquals('abcdefghijklm', $str);
+ }
+
+ public function testFileDataCanBeReadSequentially()
+ {
+ $file = $this->_createFileStream($this->_testFile);
+ $this->assertEquals('abcde', $file->read(5));
+ $this->assertEquals('fghijklm', $file->read(8));
+ $this->assertFalse($file->read(1));
+ }
+
+ public function testFilenameIsReturned()
+ {
+ $file = $this->_createFileStream($this->_testFile);
+ $this->assertEquals($this->_testFile, $file->getPath());
+ }
+
+ public function testFileCanBeWrittenTo()
+ {
+ $file = $this->_createFileStream($this->_testFile, true);
+ $file->write('foobar');
+ $this->assertEquals('foobar', $file->read(8192));
+ }
+
+ public function testReadingFromThenWritingToFile()
+ {
+ $file = $this->_createFileStream($this->_testFile, true);
+ $file->write('foobar');
+ $this->assertEquals('foobar', $file->read(8192));
+ $file->write('zipbutton');
+ $this->assertEquals('zipbutton', $file->read(8192));
+ }
+
+ public function testWritingToFileWithCanonicalization()
+ {
+ $file = $this->_createFileStream($this->_testFile, true);
+ $file->addFilter($this->_createFilter(array("\r\n", "\r"), "\n"), 'allToLF');
+ $file->write("foo\r\nbar\r");
+ $file->write("\nzip\r\ntest\r");
+ $file->flushBuffers();
+ $this->assertEquals("foo\nbar\nzip\ntest\n", file_get_contents($this->_testFile));
+ }
+
+ public function testWritingWithFulleMessageLengthOfAMultipleOf8192()
+ {
+ $file = $this->_createFileStream($this->_testFile, true);
+ $file->addFilter($this->_createFilter(array("\r\n", "\r"), "\n"), 'allToLF');
+ $file->write('');
+ $file->flushBuffers();
+ $this->assertEquals('', file_get_contents($this->_testFile));
+ }
+
+ public function testBindingOtherStreamsMirrorsWriteOperations()
+ {
+ $file = $this->_createFileStream($this->_testFile, true);
+ $is1 = $this->_createMockInputStream();
+ $is2 = $this->_createMockInputStream();
+
+ $is1->expects($this->at(0))
+ ->method('write')
+ ->with('x');
+ $is1->expects($this->at(1))
+ ->method('write')
+ ->with('y');
+ $is2->expects($this->at(0))
+ ->method('write')
+ ->with('x');
+ $is2->expects($this->at(1))
+ ->method('write')
+ ->with('y');
+
+ $file->bind($is1);
+ $file->bind($is2);
+
+ $file->write('x');
+ $file->write('y');
+ }
+
+ public function testBindingOtherStreamsMirrorsFlushOperations()
+ {
+ $file = $this->_createFileStream(
+ $this->_testFile, true
+ );
+ $is1 = $this->_createMockInputStream();
+ $is2 = $this->_createMockInputStream();
+
+ $is1->expects($this->once())
+ ->method('flushBuffers');
+ $is2->expects($this->once())
+ ->method('flushBuffers');
+
+ $file->bind($is1);
+ $file->bind($is2);
+
+ $file->flushBuffers();
+ }
+
+ public function testUnbindingStreamPreventsFurtherWrites()
+ {
+ $file = $this->_createFileStream($this->_testFile, true);
+ $is1 = $this->_createMockInputStream();
+ $is2 = $this->_createMockInputStream();
+
+ $is1->expects($this->at(0))
+ ->method('write')
+ ->with('x');
+ $is1->expects($this->at(1))
+ ->method('write')
+ ->with('y');
+ $is2->expects($this->once())
+ ->method('write')
+ ->with('x');
+
+ $file->bind($is1);
+ $file->bind($is2);
+
+ $file->write('x');
+
+ $file->unbind($is2);
+
+ $file->write('y');
+ }
+
+ private function _createFilter($search, $replace)
+ {
+ return new Swift_StreamFilters_StringReplacementFilter($search, $replace);
+ }
+
+ private function _createMockInputStream()
+ {
+ return $this->getMockBuilder('Swift_InputByteStream')->getMock();
+ }
+
+ private function _createFileStream($file, $writable = false)
+ {
+ return new Swift_ByteStream_FileByteStream($file, $writable);
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php
new file mode 100644
index 0000000..c13e570
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php
@@ -0,0 +1,179 @@
+<?php
+
+class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest extends \PHPUnit_Framework_TestCase
+{
+ private $_factory;
+ private $_prefix = 'Swift_CharacterReader_';
+
+ protected function setUp()
+ {
+ $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
+ }
+
+ public function testCreatingUtf8Reader()
+ {
+ foreach (array('utf8', 'utf-8', 'UTF-8', 'UTF8') as $utf8) {
+ $reader = $this->_factory->getReaderFor($utf8);
+ $this->assertInstanceOf($this->_prefix.'Utf8Reader', $reader);
+ }
+ }
+
+ public function testCreatingIso8859XReaders()
+ {
+ $charsets = array();
+ foreach (range(1, 16) as $number) {
+ foreach (array('iso', 'iec') as $body) {
+ $charsets[] = $body.'-8859-'.$number;
+ $charsets[] = $body.'8859-'.$number;
+ $charsets[] = strtoupper($body).'-8859-'.$number;
+ $charsets[] = strtoupper($body).'8859-'.$number;
+ }
+ }
+
+ foreach ($charsets as $charset) {
+ $reader = $this->_factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ $this->assertEquals(1, $reader->getInitialByteSize());
+ }
+ }
+
+ public function testCreatingWindows125XReaders()
+ {
+ $charsets = array();
+ foreach (range(0, 8) as $number) {
+ $charsets[] = 'windows-125'.$number;
+ $charsets[] = 'windows125'.$number;
+ $charsets[] = 'WINDOWS-125'.$number;
+ $charsets[] = 'WINDOWS125'.$number;
+ }
+
+ foreach ($charsets as $charset) {
+ $reader = $this->_factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ $this->assertEquals(1, $reader->getInitialByteSize());
+ }
+ }
+
+ public function testCreatingCodePageReaders()
+ {
+ $charsets = array();
+ foreach (range(0, 8) as $number) {
+ $charsets[] = 'cp-125'.$number;
+ $charsets[] = 'cp125'.$number;
+ $charsets[] = 'CP-125'.$number;
+ $charsets[] = 'CP125'.$number;
+ }
+
+ foreach (array(437, 737, 850, 855, 857, 858, 860,
+ 861, 863, 865, 866, 869, ) as $number) {
+ $charsets[] = 'cp-'.$number;
+ $charsets[] = 'cp'.$number;
+ $charsets[] = 'CP-'.$number;
+ $charsets[] = 'CP'.$number;
+ }
+
+ foreach ($charsets as $charset) {
+ $reader = $this->_factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ $this->assertEquals(1, $reader->getInitialByteSize());
+ }
+ }
+
+ public function testCreatingAnsiReader()
+ {
+ foreach (array('ansi', 'ANSI') as $ansi) {
+ $reader = $this->_factory->getReaderFor($ansi);
+ $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ $this->assertEquals(1, $reader->getInitialByteSize());
+ }
+ }
+
+ public function testCreatingMacintoshReader()
+ {
+ foreach (array('macintosh', 'MACINTOSH') as $mac) {
+ $reader = $this->_factory->getReaderFor($mac);
+ $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ $this->assertEquals(1, $reader->getInitialByteSize());
+ }
+ }
+
+ public function testCreatingKOIReaders()
+ {
+ $charsets = array();
+ foreach (array('7', '8-r', '8-u', '8u', '8r') as $end) {
+ $charsets[] = 'koi-'.$end;
+ $charsets[] = 'koi'.$end;
+ $charsets[] = 'KOI-'.$end;
+ $charsets[] = 'KOI'.$end;
+ }
+
+ foreach ($charsets as $charset) {
+ $reader = $this->_factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ $this->assertEquals(1, $reader->getInitialByteSize());
+ }
+ }
+
+ public function testCreatingIsciiReaders()
+ {
+ foreach (array('iscii', 'ISCII', 'viscii', 'VISCII') as $charset) {
+ $reader = $this->_factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ $this->assertEquals(1, $reader->getInitialByteSize());
+ }
+ }
+
+ public function testCreatingMIKReader()
+ {
+ foreach (array('mik', 'MIK') as $charset) {
+ $reader = $this->_factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ $this->assertEquals(1, $reader->getInitialByteSize());
+ }
+ }
+
+ public function testCreatingCorkReader()
+ {
+ foreach (array('cork', 'CORK', 't1', 'T1') as $charset) {
+ $reader = $this->_factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ $this->assertEquals(1, $reader->getInitialByteSize());
+ }
+ }
+
+ public function testCreatingUcs2Reader()
+ {
+ foreach (array('ucs-2', 'UCS-2', 'ucs2', 'UCS2') as $charset) {
+ $reader = $this->_factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ $this->assertEquals(2, $reader->getInitialByteSize());
+ }
+ }
+
+ public function testCreatingUtf16Reader()
+ {
+ foreach (array('utf-16', 'UTF-16', 'utf16', 'UTF16') as $charset) {
+ $reader = $this->_factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ $this->assertEquals(2, $reader->getInitialByteSize());
+ }
+ }
+
+ public function testCreatingUcs4Reader()
+ {
+ foreach (array('ucs-4', 'UCS-4', 'ucs4', 'UCS4') as $charset) {
+ $reader = $this->_factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ $this->assertEquals(4, $reader->getInitialByteSize());
+ }
+ }
+
+ public function testCreatingUtf32Reader()
+ {
+ foreach (array('utf-32', 'UTF-32', 'utf32', 'UTF32') as $charset) {
+ $reader = $this->_factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ $this->assertEquals(4, $reader->getInitialByteSize());
+ }
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php
new file mode 100644
index 0000000..e83c2bf
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php
@@ -0,0 +1,24 @@
+<?php
+
+require_once 'swift_required.php';
+
+//This is more of a "cross your fingers and hope it works" test!
+
+class Swift_DependencyContainerAcceptanceTest extends \PHPUnit_Framework_TestCase
+{
+ public function testNoLookupsFail()
+ {
+ $di = Swift_DependencyContainer::getInstance();
+ foreach ($di->listItems() as $itemName) {
+ try {
+ // to be removed in 6.0
+ if ('transport.mail' === $itemName) {
+ continue;
+ }
+ $di->lookup($itemName);
+ } catch (Swift_DependencyException $e) {
+ $this->fail($e->getMessage());
+ }
+ }
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EmbeddedFileAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EmbeddedFileAcceptanceTest.php
new file mode 100644
index 0000000..fc5a814
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EmbeddedFileAcceptanceTest.php
@@ -0,0 +1,12 @@
+<?php
+
+require_once 'swift_required.php';
+require_once __DIR__.'/Mime/EmbeddedFileAcceptanceTest.php';
+
+class Swift_EmbeddedFileAcceptanceTest extends Swift_Mime_EmbeddedFileAcceptanceTest
+{
+ protected function _createEmbeddedFile()
+ {
+ return Swift_EmbeddedFile::newInstance();
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Base64EncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Base64EncoderAcceptanceTest.php
new file mode 100644
index 0000000..bada509
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Base64EncoderAcceptanceTest.php
@@ -0,0 +1,45 @@
+<?php
+
+class Swift_Encoder_Base64EncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
+{
+ private $_samplesDir;
+ private $_encoder;
+
+ protected function setUp()
+ {
+ $this->_samplesDir = realpath(__DIR__.'/../../../_samples/charsets');
+ $this->_encoder = new Swift_Encoder_Base64Encoder();
+ }
+
+ public function testEncodingAndDecodingSamples()
+ {
+ $sampleFp = opendir($this->_samplesDir);
+ while (false !== $encodingDir = readdir($sampleFp)) {
+ if (substr($encodingDir, 0, 1) == '.') {
+ continue;
+ }
+
+ $sampleDir = $this->_samplesDir.'/'.$encodingDir;
+
+ if (is_dir($sampleDir)) {
+ $fileFp = opendir($sampleDir);
+ while (false !== $sampleFile = readdir($fileFp)) {
+ if (substr($sampleFile, 0, 1) == '.') {
+ continue;
+ }
+
+ $text = file_get_contents($sampleDir.'/'.$sampleFile);
+ $encodedText = $this->_encoder->encodeString($text);
+
+ $this->assertEquals(
+ base64_decode($encodedText), $text,
+ '%s: Encoded string should decode back to original string for sample '.
+ $sampleDir.'/'.$sampleFile
+ );
+ }
+ closedir($fileFp);
+ }
+ }
+ closedir($sampleFp);
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php
new file mode 100644
index 0000000..442d9a9
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php
@@ -0,0 +1,54 @@
+<?php
+
+class Swift_Encoder_QpEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
+{
+ private $_samplesDir;
+ private $_factory;
+
+ protected function setUp()
+ {
+ $this->_samplesDir = realpath(__DIR__.'/../../../_samples/charsets');
+ $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
+ }
+
+ public function testEncodingAndDecodingSamples()
+ {
+ $sampleFp = opendir($this->_samplesDir);
+ while (false !== $encodingDir = readdir($sampleFp)) {
+ if (substr($encodingDir, 0, 1) == '.') {
+ continue;
+ }
+
+ $encoding = $encodingDir;
+ $charStream = new Swift_CharacterStream_ArrayCharacterStream(
+ $this->_factory, $encoding);
+ $encoder = new Swift_Encoder_QpEncoder($charStream);
+
+ $sampleDir = $this->_samplesDir.'/'.$encodingDir;
+
+ if (is_dir($sampleDir)) {
+ $fileFp = opendir($sampleDir);
+ while (false !== $sampleFile = readdir($fileFp)) {
+ if (substr($sampleFile, 0, 1) == '.') {
+ continue;
+ }
+
+ $text = file_get_contents($sampleDir.'/'.$sampleFile);
+ $encodedText = $encoder->encodeString($text);
+
+ foreach (explode("\r\n", $encodedText) as $line) {
+ $this->assertLessThanOrEqual(76, strlen($line));
+ }
+
+ $this->assertEquals(
+ quoted_printable_decode($encodedText), $text,
+ '%s: Encoded string should decode back to original string for sample '.
+ $sampleDir.'/'.$sampleFile
+ );
+ }
+ closedir($fileFp);
+ }
+ }
+ closedir($sampleFp);
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php
new file mode 100644
index 0000000..bcb6b95
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php
@@ -0,0 +1,50 @@
+<?php
+
+class Swift_Encoder_Rfc2231EncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
+{
+ private $_samplesDir;
+ private $_factory;
+
+ protected function setUp()
+ {
+ $this->_samplesDir = realpath(__DIR__.'/../../../_samples/charsets');
+ $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
+ }
+
+ public function testEncodingAndDecodingSamples()
+ {
+ $sampleFp = opendir($this->_samplesDir);
+ while (false !== $encodingDir = readdir($sampleFp)) {
+ if (substr($encodingDir, 0, 1) == '.') {
+ continue;
+ }
+
+ $encoding = $encodingDir;
+ $charStream = new Swift_CharacterStream_ArrayCharacterStream(
+ $this->_factory, $encoding);
+ $encoder = new Swift_Encoder_Rfc2231Encoder($charStream);
+
+ $sampleDir = $this->_samplesDir.'/'.$encodingDir;
+
+ if (is_dir($sampleDir)) {
+ $fileFp = opendir($sampleDir);
+ while (false !== $sampleFile = readdir($fileFp)) {
+ if (substr($sampleFile, 0, 1) == '.') {
+ continue;
+ }
+
+ $text = file_get_contents($sampleDir.'/'.$sampleFile);
+ $encodedText = $encoder->encodeString($text);
+
+ $this->assertEquals(
+ urldecode(implode('', explode("\r\n", $encodedText))), $text,
+ '%s: Encoded string should decode back to original string for sample '.
+ $sampleDir.'/'.$sampleFile
+ );
+ }
+ closedir($fileFp);
+ }
+ }
+ closedir($sampleFp);
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EncodingAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EncodingAcceptanceTest.php
new file mode 100644
index 0000000..6a4d05d
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EncodingAcceptanceTest.php
@@ -0,0 +1,30 @@
+<?php
+
+require_once 'swift_required.php';
+
+class Swift_EncodingAcceptanceTest extends \PHPUnit_Framework_TestCase
+{
+ public function testGet7BitEncodingReturns7BitEncoder()
+ {
+ $encoder = Swift_Encoding::get7BitEncoding();
+ $this->assertEquals('7bit', $encoder->getName());
+ }
+
+ public function testGet8BitEncodingReturns8BitEncoder()
+ {
+ $encoder = Swift_Encoding::get8BitEncoding();
+ $this->assertEquals('8bit', $encoder->getName());
+ }
+
+ public function testGetQpEncodingReturnsQpEncoder()
+ {
+ $encoder = Swift_Encoding::getQpEncoding();
+ $this->assertEquals('quoted-printable', $encoder->getName());
+ }
+
+ public function testGetBase64EncodingReturnsBase64Encoder()
+ {
+ $encoder = Swift_Encoding::getBase64Encoding();
+ $this->assertEquals('base64', $encoder->getName());
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php
new file mode 100644
index 0000000..5fab14c
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php
@@ -0,0 +1,173 @@
+<?php
+
+class Swift_KeyCache_ArrayKeyCacheAcceptanceTest extends \PHPUnit_Framework_TestCase
+{
+ private $_cache;
+ private $_key1 = 'key1';
+ private $_key2 = 'key2';
+
+ protected function setUp()
+ {
+ $this->_cache = new Swift_KeyCache_ArrayKeyCache(
+ new Swift_KeyCache_SimpleKeyCacheInputStream()
+ );
+ }
+
+ public function testStringDataCanBeSetAndFetched()
+ {
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ );
+ $this->assertEquals('test', $this->_cache->getString($this->_key1, 'foo'));
+ }
+
+ public function testStringDataCanBeOverwritten()
+ {
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ );
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'whatever', Swift_KeyCache::MODE_WRITE
+ );
+ $this->assertEquals('whatever', $this->_cache->getString($this->_key1, 'foo'));
+ }
+
+ public function testStringDataCanBeAppended()
+ {
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ );
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'ing', Swift_KeyCache::MODE_APPEND
+ );
+ $this->assertEquals('testing', $this->_cache->getString($this->_key1, 'foo'));
+ }
+
+ public function testHasKeyReturnValue()
+ {
+ $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo'));
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ );
+ $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo'));
+ }
+
+ public function testNsKeyIsWellPartitioned()
+ {
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ );
+ $this->_cache->setString(
+ $this->_key2, 'foo', 'ing', Swift_KeyCache::MODE_WRITE
+ );
+ $this->assertEquals('test', $this->_cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('ing', $this->_cache->getString($this->_key2, 'foo'));
+ }
+
+ public function testItemKeyIsWellPartitioned()
+ {
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ );
+ $this->_cache->setString(
+ $this->_key1, 'bar', 'ing', Swift_KeyCache::MODE_WRITE
+ );
+ $this->assertEquals('test', $this->_cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('ing', $this->_cache->getString($this->_key1, 'bar'));
+ }
+
+ public function testByteStreamCanBeImported()
+ {
+ $os = new Swift_ByteStream_ArrayByteStream();
+ $os->write('abcdef');
+
+ $this->_cache->importFromByteStream(
+ $this->_key1, 'foo', $os, Swift_KeyCache::MODE_WRITE
+ );
+ $this->assertEquals('abcdef', $this->_cache->getString($this->_key1, 'foo'));
+ }
+
+ public function testByteStreamCanBeAppended()
+ {
+ $os1 = new Swift_ByteStream_ArrayByteStream();
+ $os1->write('abcdef');
+
+ $os2 = new Swift_ByteStream_ArrayByteStream();
+ $os2->write('xyzuvw');
+
+ $this->_cache->importFromByteStream(
+ $this->_key1, 'foo', $os1, Swift_KeyCache::MODE_APPEND
+ );
+ $this->_cache->importFromByteStream(
+ $this->_key1, 'foo', $os2, Swift_KeyCache::MODE_APPEND
+ );
+
+ $this->assertEquals('abcdefxyzuvw', $this->_cache->getString($this->_key1, 'foo'));
+ }
+
+ public function testByteStreamAndStringCanBeAppended()
+ {
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_APPEND
+ );
+
+ $os = new Swift_ByteStream_ArrayByteStream();
+ $os->write('abcdef');
+
+ $this->_cache->importFromByteStream(
+ $this->_key1, 'foo', $os, Swift_KeyCache::MODE_APPEND
+ );
+ $this->assertEquals('testabcdef', $this->_cache->getString($this->_key1, 'foo'));
+ }
+
+ public function testDataCanBeExportedToByteStream()
+ {
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ );
+
+ $is = new Swift_ByteStream_ArrayByteStream();
+
+ $this->_cache->exportToByteStream($this->_key1, 'foo', $is);
+
+ $string = '';
+ while (false !== $bytes = $is->read(8192)) {
+ $string .= $bytes;
+ }
+
+ $this->assertEquals('test', $string);
+ }
+
+ public function testKeyCanBeCleared()
+ {
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ );
+ $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo'));
+ $this->_cache->clearKey($this->_key1, 'foo');
+ $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo'));
+ }
+
+ public function testNsKeyCanBeCleared()
+ {
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ );
+ $this->_cache->setString(
+ $this->_key1, 'bar', 'xyz', Swift_KeyCache::MODE_WRITE
+ );
+ $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo'));
+ $this->assertTrue($this->_cache->hasKey($this->_key1, 'bar'));
+ $this->_cache->clearAll($this->_key1);
+ $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo'));
+ $this->assertFalse($this->_cache->hasKey($this->_key1, 'bar'));
+ }
+
+ public function testKeyCacheInputStream()
+ {
+ $is = $this->_cache->getInputByteStream($this->_key1, 'foo');
+ $is->write('abc');
+ $is->write('xyz');
+ $this->assertEquals('abcxyz', $this->_cache->getString($this->_key1, 'foo'));
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php
new file mode 100644
index 0000000..0e027c2
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php
@@ -0,0 +1,173 @@
+<?php
+
+class Swift_KeyCache_DiskKeyCacheAcceptanceTest extends \PHPUnit_Framework_TestCase
+{
+ private $_cache;
+ private $_key1;
+ private $_key2;
+
+ protected function setUp()
+ {
+ $this->_key1 = uniqid(microtime(true), true);
+ $this->_key2 = uniqid(microtime(true), true);
+ $this->_cache = new Swift_KeyCache_DiskKeyCache(new Swift_KeyCache_SimpleKeyCacheInputStream(), sys_get_temp_dir());
+ }
+
+ public function testStringDataCanBeSetAndFetched()
+ {
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ );
+ $this->assertEquals('test', $this->_cache->getString($this->_key1, 'foo'));
+ }
+
+ public function testStringDataCanBeOverwritten()
+ {
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ );
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'whatever', Swift_KeyCache::MODE_WRITE
+ );
+ $this->assertEquals('whatever', $this->_cache->getString($this->_key1, 'foo'));
+ }
+
+ public function testStringDataCanBeAppended()
+ {
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ );
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'ing', Swift_KeyCache::MODE_APPEND
+ );
+ $this->assertEquals('testing', $this->_cache->getString($this->_key1, 'foo'));
+ }
+
+ public function testHasKeyReturnValue()
+ {
+ $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo'));
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ );
+ $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo'));
+ }
+
+ public function testNsKeyIsWellPartitioned()
+ {
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ );
+ $this->_cache->setString(
+ $this->_key2, 'foo', 'ing', Swift_KeyCache::MODE_WRITE
+ );
+ $this->assertEquals('test', $this->_cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('ing', $this->_cache->getString($this->_key2, 'foo'));
+ }
+
+ public function testItemKeyIsWellPartitioned()
+ {
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ );
+ $this->_cache->setString(
+ $this->_key1, 'bar', 'ing', Swift_KeyCache::MODE_WRITE
+ );
+ $this->assertEquals('test', $this->_cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('ing', $this->_cache->getString($this->_key1, 'bar'));
+ }
+
+ public function testByteStreamCanBeImported()
+ {
+ $os = new Swift_ByteStream_ArrayByteStream();
+ $os->write('abcdef');
+
+ $this->_cache->importFromByteStream(
+ $this->_key1, 'foo', $os, Swift_KeyCache::MODE_WRITE
+ );
+ $this->assertEquals('abcdef', $this->_cache->getString($this->_key1, 'foo'));
+ }
+
+ public function testByteStreamCanBeAppended()
+ {
+ $os1 = new Swift_ByteStream_ArrayByteStream();
+ $os1->write('abcdef');
+
+ $os2 = new Swift_ByteStream_ArrayByteStream();
+ $os2->write('xyzuvw');
+
+ $this->_cache->importFromByteStream(
+ $this->_key1, 'foo', $os1, Swift_KeyCache::MODE_APPEND
+ );
+ $this->_cache->importFromByteStream(
+ $this->_key1, 'foo', $os2, Swift_KeyCache::MODE_APPEND
+ );
+
+ $this->assertEquals('abcdefxyzuvw', $this->_cache->getString($this->_key1, 'foo'));
+ }
+
+ public function testByteStreamAndStringCanBeAppended()
+ {
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_APPEND
+ );
+
+ $os = new Swift_ByteStream_ArrayByteStream();
+ $os->write('abcdef');
+
+ $this->_cache->importFromByteStream(
+ $this->_key1, 'foo', $os, Swift_KeyCache::MODE_APPEND
+ );
+ $this->assertEquals('testabcdef', $this->_cache->getString($this->_key1, 'foo'));
+ }
+
+ public function testDataCanBeExportedToByteStream()
+ {
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ );
+
+ $is = new Swift_ByteStream_ArrayByteStream();
+
+ $this->_cache->exportToByteStream($this->_key1, 'foo', $is);
+
+ $string = '';
+ while (false !== $bytes = $is->read(8192)) {
+ $string .= $bytes;
+ }
+
+ $this->assertEquals('test', $string);
+ }
+
+ public function testKeyCanBeCleared()
+ {
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ );
+ $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo'));
+ $this->_cache->clearKey($this->_key1, 'foo');
+ $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo'));
+ }
+
+ public function testNsKeyCanBeCleared()
+ {
+ $this->_cache->setString(
+ $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ );
+ $this->_cache->setString(
+ $this->_key1, 'bar', 'xyz', Swift_KeyCache::MODE_WRITE
+ );
+ $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo'));
+ $this->assertTrue($this->_cache->hasKey($this->_key1, 'bar'));
+ $this->_cache->clearAll($this->_key1);
+ $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo'));
+ $this->assertFalse($this->_cache->hasKey($this->_key1, 'bar'));
+ }
+
+ public function testKeyCacheInputStream()
+ {
+ $is = $this->_cache->getInputByteStream($this->_key1, 'foo');
+ $is->write('abc');
+ $is->write('xyz');
+ $this->assertEquals('abcxyz', $this->_cache->getString($this->_key1, 'foo'));
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php
new file mode 100644
index 0000000..5f4e983
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php
@@ -0,0 +1,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();
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php
new file mode 100644
index 0000000..7353d9d
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php
@@ -0,0 +1,123 @@
+<?php
+
+class Swift_Mime_AttachmentAcceptanceTest extends \PHPUnit_Framework_TestCase
+{
+ private $_contentEncoder;
+ private $_cache;
+ private $_grammar;
+ private $_headers;
+
+ protected function setUp()
+ {
+ $this->_cache = new Swift_KeyCache_ArrayKeyCache(
+ new Swift_KeyCache_SimpleKeyCacheInputStream()
+ );
+ $factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
+ $this->_contentEncoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();
+
+ $headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(
+ new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
+ );
+ $paramEncoder = new Swift_Encoder_Rfc2231Encoder(
+ new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
+ );
+ $this->_grammar = new Swift_Mime_Grammar();
+ $this->_headers = new Swift_Mime_SimpleHeaderSet(
+ new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $this->_grammar)
+ );
+ }
+
+ public function testDispositionIsSetInHeader()
+ {
+ $attachment = $this->_createAttachment();
+ $attachment->setContentType('application/pdf');
+ $attachment->setDisposition('inline');
+ $this->assertEquals(
+ 'Content-Type: application/pdf'."\r\n".
+ 'Content-Transfer-Encoding: base64'."\r\n".
+ 'Content-Disposition: inline'."\r\n",
+ $attachment->toString()
+ );
+ }
+
+ public function testDispositionIsAttachmentByDefault()
+ {
+ $attachment = $this->_createAttachment();
+ $attachment->setContentType('application/pdf');
+ $this->assertEquals(
+ 'Content-Type: application/pdf'."\r\n".
+ 'Content-Transfer-Encoding: base64'."\r\n".
+ 'Content-Disposition: attachment'."\r\n",
+ $attachment->toString()
+ );
+ }
+
+ public function testFilenameIsSetInHeader()
+ {
+ $attachment = $this->_createAttachment();
+ $attachment->setContentType('application/pdf');
+ $attachment->setFilename('foo.pdf');
+ $this->assertEquals(
+ 'Content-Type: application/pdf; name=foo.pdf'."\r\n".
+ 'Content-Transfer-Encoding: base64'."\r\n".
+ 'Content-Disposition: attachment; filename=foo.pdf'."\r\n",
+ $attachment->toString()
+ );
+ }
+
+ public function testSizeIsSetInHeader()
+ {
+ $attachment = $this->_createAttachment();
+ $attachment->setContentType('application/pdf');
+ $attachment->setSize(12340);
+ $this->assertEquals(
+ 'Content-Type: application/pdf'."\r\n".
+ 'Content-Transfer-Encoding: base64'."\r\n".
+ 'Content-Disposition: attachment; size=12340'."\r\n",
+ $attachment->toString()
+ );
+ }
+
+ public function testMultipleParametersInHeader()
+ {
+ $attachment = $this->_createAttachment();
+ $attachment->setContentType('application/pdf');
+ $attachment->setFilename('foo.pdf');
+ $attachment->setSize(12340);
+ $this->assertEquals(
+ 'Content-Type: application/pdf; name=foo.pdf'."\r\n".
+ 'Content-Transfer-Encoding: base64'."\r\n".
+ 'Content-Disposition: attachment; filename=foo.pdf; size=12340'."\r\n",
+ $attachment->toString()
+ );
+ }
+
+ public function testEndToEnd()
+ {
+ $attachment = $this->_createAttachment();
+ $attachment->setContentType('application/pdf');
+ $attachment->setFilename('foo.pdf');
+ $attachment->setSize(12340);
+ $attachment->setBody('abcd');
+ $this->assertEquals(
+ 'Content-Type: application/pdf; name=foo.pdf'."\r\n".
+ 'Content-Transfer-Encoding: base64'."\r\n".
+ 'Content-Disposition: attachment; filename=foo.pdf; size=12340'."\r\n".
+ "\r\n".
+ base64_encode('abcd'),
+ $attachment->toString()
+ );
+ }
+
+ protected function _createAttachment()
+ {
+ $entity = new Swift_Mime_Attachment(
+ $this->_headers,
+ $this->_contentEncoder,
+ $this->_cache,
+ $this->_grammar
+ );
+
+ return $entity;
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/Base64ContentEncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/Base64ContentEncoderAcceptanceTest.php
new file mode 100644
index 0000000..a72f5ff
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/Base64ContentEncoderAcceptanceTest.php
@@ -0,0 +1,56 @@
+<?php
+
+class Swift_Mime_ContentEncoder_Base64ContentEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
+{
+ private $_samplesDir;
+ private $_encoder;
+
+ protected function setUp()
+ {
+ $this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets');
+ $this->_encoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();
+ }
+
+ public function testEncodingAndDecodingSamples()
+ {
+ $sampleFp = opendir($this->_samplesDir);
+ while (false !== $encodingDir = readdir($sampleFp)) {
+ if (substr($encodingDir, 0, 1) == '.') {
+ continue;
+ }
+
+ $sampleDir = $this->_samplesDir.'/'.$encodingDir;
+
+ if (is_dir($sampleDir)) {
+ $fileFp = opendir($sampleDir);
+ while (false !== $sampleFile = readdir($fileFp)) {
+ if (substr($sampleFile, 0, 1) == '.') {
+ continue;
+ }
+
+ $text = file_get_contents($sampleDir.'/'.$sampleFile);
+
+ $os = new Swift_ByteStream_ArrayByteStream();
+ $os->write($text);
+
+ $is = new Swift_ByteStream_ArrayByteStream();
+
+ $this->_encoder->encodeByteStream($os, $is);
+
+ $encoded = '';
+ while (false !== $bytes = $is->read(8192)) {
+ $encoded .= $bytes;
+ }
+
+ $this->assertEquals(
+ base64_decode($encoded), $text,
+ '%s: Encoded string should decode back to original string for sample '.
+ $sampleDir.'/'.$sampleFile
+ );
+ }
+ closedir($fileFp);
+ }
+ }
+ closedir($sampleFp);
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php
new file mode 100644
index 0000000..0dfc4e2
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php
@@ -0,0 +1,88 @@
+<?php
+
+class Swift_Mime_ContentEncoder_NativeQpContentEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
+{
+ protected $_samplesDir;
+
+ /**
+ * @var Swift_Mime_ContentEncoder_NativeQpContentEncoder
+ */
+ protected $_encoder;
+
+ protected function setUp()
+ {
+ $this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets');
+ $this->_encoder = new Swift_Mime_ContentEncoder_NativeQpContentEncoder();
+ }
+
+ public function testEncodingAndDecodingSamples()
+ {
+ $sampleFp = opendir($this->_samplesDir);
+ while (false !== $encodingDir = readdir($sampleFp)) {
+ if (substr($encodingDir, 0, 1) == '.') {
+ continue;
+ }
+
+ $sampleDir = $this->_samplesDir.'/'.$encodingDir;
+
+ if (is_dir($sampleDir)) {
+ $fileFp = opendir($sampleDir);
+ while (false !== $sampleFile = readdir($fileFp)) {
+ if (substr($sampleFile, 0, 1) == '.') {
+ continue;
+ }
+
+ $text = file_get_contents($sampleDir.'/'.$sampleFile);
+
+ $os = new Swift_ByteStream_ArrayByteStream();
+ $os->write($text);
+
+ $is = new Swift_ByteStream_ArrayByteStream();
+ $this->_encoder->encodeByteStream($os, $is);
+
+ $encoded = '';
+ while (false !== $bytes = $is->read(8192)) {
+ $encoded .= $bytes;
+ }
+
+ $this->assertEquals(
+ quoted_printable_decode($encoded),
+ // CR and LF are converted to CRLF
+ preg_replace('~\r(?!\n)|(?<!\r)\n~', "\r\n", $text),
+ '%s: Encoded string should decode back to original string for sample '.$sampleDir.'/'.$sampleFile
+ );
+ }
+ closedir($fileFp);
+ }
+ }
+ closedir($sampleFp);
+ }
+
+ public function testEncodingAndDecodingSamplesFromDiConfiguredInstance()
+ {
+ $encoder = $this->_createEncoderFromContainer();
+ $this->assertSame('=C3=A4=C3=B6=C3=BC=C3=9F', $encoder->encodeString('äöüß'));
+ }
+
+ /**
+ * @expectedException \RuntimeException
+ */
+ public function testCharsetChangeNotImplemented()
+ {
+ $this->_encoder->charsetChanged('utf-8');
+ $this->_encoder->charsetChanged('charset');
+ $this->_encoder->encodeString('foo');
+ }
+
+ public function testGetName()
+ {
+ $this->assertSame('quoted-printable', $this->_encoder->getName());
+ }
+
+ private function _createEncoderFromContainer()
+ {
+ return Swift_DependencyContainer::getInstance()
+ ->lookup('mime.nativeqpcontentencoder')
+ ;
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/PlainContentEncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/PlainContentEncoderAcceptanceTest.php
new file mode 100644
index 0000000..5eff4e2
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/PlainContentEncoderAcceptanceTest.php
@@ -0,0 +1,88 @@
+<?php
+
+class Swift_Mime_ContentEncoder_PlainContentEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
+{
+ private $_samplesDir;
+ private $_encoder;
+
+ protected function setUp()
+ {
+ $this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets');
+ $this->_encoder = new Swift_Mime_ContentEncoder_PlainContentEncoder('8bit');
+ }
+
+ public function testEncodingAndDecodingSamplesString()
+ {
+ $sampleFp = opendir($this->_samplesDir);
+ while (false !== $encodingDir = readdir($sampleFp)) {
+ if (substr($encodingDir, 0, 1) == '.') {
+ continue;
+ }
+
+ $sampleDir = $this->_samplesDir.'/'.$encodingDir;
+
+ if (is_dir($sampleDir)) {
+ $fileFp = opendir($sampleDir);
+ while (false !== $sampleFile = readdir($fileFp)) {
+ if (substr($sampleFile, 0, 1) == '.') {
+ continue;
+ }
+
+ $text = file_get_contents($sampleDir.'/'.$sampleFile);
+ $encodedText = $this->_encoder->encodeString($text);
+
+ $this->assertEquals(
+ $encodedText, $text,
+ '%s: Encoded string should be identical to original string for sample '.
+ $sampleDir.'/'.$sampleFile
+ );
+ }
+ closedir($fileFp);
+ }
+ }
+ closedir($sampleFp);
+ }
+
+ public function testEncodingAndDecodingSamplesByteStream()
+ {
+ $sampleFp = opendir($this->_samplesDir);
+ while (false !== $encodingDir = readdir($sampleFp)) {
+ if (substr($encodingDir, 0, 1) == '.') {
+ continue;
+ }
+
+ $sampleDir = $this->_samplesDir.'/'.$encodingDir;
+
+ if (is_dir($sampleDir)) {
+ $fileFp = opendir($sampleDir);
+ while (false !== $sampleFile = readdir($fileFp)) {
+ if (substr($sampleFile, 0, 1) == '.') {
+ continue;
+ }
+
+ $text = file_get_contents($sampleDir.'/'.$sampleFile);
+
+ $os = new Swift_ByteStream_ArrayByteStream();
+ $os->write($text);
+
+ $is = new Swift_ByteStream_ArrayByteStream();
+
+ $this->_encoder->encodeByteStream($os, $is);
+
+ $encoded = '';
+ while (false !== $bytes = $is->read(8192)) {
+ $encoded .= $bytes;
+ }
+
+ $this->assertEquals(
+ $encoded, $text,
+ '%s: Encoded string should be identical to original string for sample '.
+ $sampleDir.'/'.$sampleFile
+ );
+ }
+ closedir($fileFp);
+ }
+ }
+ closedir($sampleFp);
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php
new file mode 100644
index 0000000..a383b58
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php
@@ -0,0 +1,160 @@
+<?php
+
+class Swift_Mime_ContentEncoder_QpContentEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
+{
+ private $_samplesDir;
+ private $_factory;
+
+ protected function setUp()
+ {
+ $this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets');
+ $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
+ }
+
+ protected function tearDown()
+ {
+ Swift_Preferences::getInstance()->setQPDotEscape(false);
+ }
+
+ public function testEncodingAndDecodingSamples()
+ {
+ $sampleFp = opendir($this->_samplesDir);
+ while (false !== $encodingDir = readdir($sampleFp)) {
+ if (substr($encodingDir, 0, 1) == '.') {
+ continue;
+ }
+
+ $encoding = $encodingDir;
+ $charStream = new Swift_CharacterStream_NgCharacterStream(
+ $this->_factory, $encoding);
+ $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream);
+
+ $sampleDir = $this->_samplesDir.'/'.$encodingDir;
+
+ if (is_dir($sampleDir)) {
+ $fileFp = opendir($sampleDir);
+ while (false !== $sampleFile = readdir($fileFp)) {
+ if (substr($sampleFile, 0, 1) == '.') {
+ continue;
+ }
+
+ $text = file_get_contents($sampleDir.'/'.$sampleFile);
+
+ $os = new Swift_ByteStream_ArrayByteStream();
+ $os->write($text);
+
+ $is = new Swift_ByteStream_ArrayByteStream();
+ $encoder->encodeByteStream($os, $is);
+
+ $encoded = '';
+ while (false !== $bytes = $is->read(8192)) {
+ $encoded .= $bytes;
+ }
+
+ $this->assertEquals(
+ quoted_printable_decode($encoded), $text,
+ '%s: Encoded string should decode back to original string for sample '.
+ $sampleDir.'/'.$sampleFile
+ );
+ }
+ closedir($fileFp);
+ }
+ }
+ closedir($sampleFp);
+ }
+
+ public function testEncodingAndDecodingSamplesFromDiConfiguredInstance()
+ {
+ $sampleFp = opendir($this->_samplesDir);
+ while (false !== $encodingDir = readdir($sampleFp)) {
+ if (substr($encodingDir, 0, 1) == '.') {
+ continue;
+ }
+
+ $encoding = $encodingDir;
+ $encoder = $this->_createEncoderFromContainer();
+
+ $sampleDir = $this->_samplesDir.'/'.$encodingDir;
+
+ if (is_dir($sampleDir)) {
+ $fileFp = opendir($sampleDir);
+ while (false !== $sampleFile = readdir($fileFp)) {
+ if (substr($sampleFile, 0, 1) == '.') {
+ continue;
+ }
+
+ $text = file_get_contents($sampleDir.'/'.$sampleFile);
+
+ $os = new Swift_ByteStream_ArrayByteStream();
+ $os->write($text);
+
+ $is = new Swift_ByteStream_ArrayByteStream();
+ $encoder->encodeByteStream($os, $is);
+
+ $encoded = '';
+ while (false !== $bytes = $is->read(8192)) {
+ $encoded .= $bytes;
+ }
+
+ $this->assertEquals(
+ str_replace("\r\n", "\n", quoted_printable_decode($encoded)), str_replace("\r\n", "\n", $text),
+ '%s: Encoded string should decode back to original string for sample '.
+ $sampleDir.'/'.$sampleFile
+ );
+ }
+ closedir($fileFp);
+ }
+ }
+ closedir($sampleFp);
+ }
+
+ public function testEncodingLFTextWithDiConfiguredInstance()
+ {
+ $encoder = $this->_createEncoderFromContainer();
+ $this->assertEquals("a\r\nb\r\nc", $encoder->encodeString("a\nb\nc"));
+ }
+
+ public function testEncodingCRTextWithDiConfiguredInstance()
+ {
+ $encoder = $this->_createEncoderFromContainer();
+ $this->assertEquals("a\r\nb\r\nc", $encoder->encodeString("a\rb\rc"));
+ }
+
+ public function testEncodingLFCRTextWithDiConfiguredInstance()
+ {
+ $encoder = $this->_createEncoderFromContainer();
+ $this->assertEquals("a\r\n\r\nb\r\n\r\nc", $encoder->encodeString("a\n\rb\n\rc"));
+ }
+
+ public function testEncodingCRLFTextWithDiConfiguredInstance()
+ {
+ $encoder = $this->_createEncoderFromContainer();
+ $this->assertEquals("a\r\nb\r\nc", $encoder->encodeString("a\r\nb\r\nc"));
+ }
+
+ public function testEncodingDotStuffingWithDiConfiguredInstance()
+ {
+ // Enable DotEscaping
+ Swift_Preferences::getInstance()->setQPDotEscape(true);
+ $encoder = $this->_createEncoderFromContainer();
+ $this->assertEquals("a=2E\r\n=2E\r\n=2Eb\r\nc", $encoder->encodeString("a.\r\n.\r\n.b\r\nc"));
+ // Return to default
+ Swift_Preferences::getInstance()->setQPDotEscape(false);
+ $encoder = $this->_createEncoderFromContainer();
+ $this->assertEquals("a.\r\n.\r\n.b\r\nc", $encoder->encodeString("a.\r\n.\r\n.b\r\nc"));
+ }
+
+ public function testDotStuffingEncodingAndDecodingSamplesFromDiConfiguredInstance()
+ {
+ // Enable DotEscaping
+ Swift_Preferences::getInstance()->setQPDotEscape(true);
+ $this->testEncodingAndDecodingSamplesFromDiConfiguredInstance();
+ }
+
+ private function _createEncoderFromContainer()
+ {
+ return Swift_DependencyContainer::getInstance()
+ ->lookup('mime.qpcontentencoder')
+ ;
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php
new file mode 100644
index 0000000..0f7aa72
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php
@@ -0,0 +1,136 @@
+<?php
+
+class Swift_Mime_EmbeddedFileAcceptanceTest extends \PHPUnit_Framework_TestCase
+{
+ private $_contentEncoder;
+ private $_cache;
+ private $_grammar;
+ private $_headers;
+
+ protected function setUp()
+ {
+ $this->_cache = new Swift_KeyCache_ArrayKeyCache(
+ new Swift_KeyCache_SimpleKeyCacheInputStream()
+ );
+ $factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
+ $this->_contentEncoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();
+
+ $headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(
+ new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
+ );
+ $paramEncoder = new Swift_Encoder_Rfc2231Encoder(
+ new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
+ );
+ $this->_grammar = new Swift_Mime_Grammar();
+ $this->_headers = new Swift_Mime_SimpleHeaderSet(
+ new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $this->_grammar)
+ );
+ }
+
+ public function testContentIdIsSetInHeader()
+ {
+ $file = $this->_createEmbeddedFile();
+ $file->setContentType('application/pdf');
+ $file->setId('foo@bar');
+ $this->assertEquals(
+ 'Content-Type: application/pdf'."\r\n".
+ 'Content-Transfer-Encoding: base64'."\r\n".
+ 'Content-ID: <foo@bar>'."\r\n".
+ 'Content-Disposition: inline'."\r\n",
+ $file->toString()
+ );
+ }
+
+ public function testDispositionIsSetInHeader()
+ {
+ $file = $this->_createEmbeddedFile();
+ $id = $file->getId();
+ $file->setContentType('application/pdf');
+ $file->setDisposition('attachment');
+ $this->assertEquals(
+ 'Content-Type: application/pdf'."\r\n".
+ 'Content-Transfer-Encoding: base64'."\r\n".
+ 'Content-ID: <'.$id.'>'."\r\n".
+ 'Content-Disposition: attachment'."\r\n",
+ $file->toString()
+ );
+ }
+
+ public function testFilenameIsSetInHeader()
+ {
+ $file = $this->_createEmbeddedFile();
+ $id = $file->getId();
+ $file->setContentType('application/pdf');
+ $file->setFilename('foo.pdf');
+ $this->assertEquals(
+ 'Content-Type: application/pdf; name=foo.pdf'."\r\n".
+ 'Content-Transfer-Encoding: base64'."\r\n".
+ 'Content-ID: <'.$id.'>'."\r\n".
+ 'Content-Disposition: inline; filename=foo.pdf'."\r\n",
+ $file->toString()
+ );
+ }
+
+ public function testSizeIsSetInHeader()
+ {
+ $file = $this->_createEmbeddedFile();
+ $id = $file->getId();
+ $file->setContentType('application/pdf');
+ $file->setSize(12340);
+ $this->assertEquals(
+ 'Content-Type: application/pdf'."\r\n".
+ 'Content-Transfer-Encoding: base64'."\r\n".
+ 'Content-ID: <'.$id.'>'."\r\n".
+ 'Content-Disposition: inline; size=12340'."\r\n",
+ $file->toString()
+ );
+ }
+
+ public function testMultipleParametersInHeader()
+ {
+ $file = $this->_createEmbeddedFile();
+ $id = $file->getId();
+ $file->setContentType('application/pdf');
+ $file->setFilename('foo.pdf');
+ $file->setSize(12340);
+
+ $this->assertEquals(
+ 'Content-Type: application/pdf; name=foo.pdf'."\r\n".
+ 'Content-Transfer-Encoding: base64'."\r\n".
+ 'Content-ID: <'.$id.'>'."\r\n".
+ 'Content-Disposition: inline; filename=foo.pdf; size=12340'."\r\n",
+ $file->toString()
+ );
+ }
+
+ public function testEndToEnd()
+ {
+ $file = $this->_createEmbeddedFile();
+ $id = $file->getId();
+ $file->setContentType('application/pdf');
+ $file->setFilename('foo.pdf');
+ $file->setSize(12340);
+ $file->setBody('abcd');
+ $this->assertEquals(
+ 'Content-Type: application/pdf; name=foo.pdf'."\r\n".
+ 'Content-Transfer-Encoding: base64'."\r\n".
+ 'Content-ID: <'.$id.'>'."\r\n".
+ 'Content-Disposition: inline; filename=foo.pdf; size=12340'."\r\n".
+ "\r\n".
+ base64_encode('abcd'),
+ $file->toString()
+ );
+ }
+
+ protected function _createEmbeddedFile()
+ {
+ $entity = new Swift_Mime_EmbeddedFile(
+ $this->_headers,
+ $this->_contentEncoder,
+ $this->_cache,
+ $this->_grammar
+ );
+
+ return $entity;
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php
new file mode 100644
index 0000000..e3fad6d
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php
@@ -0,0 +1,32 @@
+<?php
+
+class Swift_Mime_HeaderEncoder_Base64HeaderEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
+{
+ private $_encoder;
+
+ protected function setUp()
+ {
+ $this->_encoder = new Swift_Mime_HeaderEncoder_Base64HeaderEncoder();
+ }
+
+ public function testEncodingJIS()
+ {
+ if (function_exists('mb_convert_encoding')) {
+ // base64_encode and split cannot handle long JIS text to fold
+ $subject = '長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い件名';
+
+ $encodedWrapperLength = strlen('=?iso-2022-jp?'.$this->_encoder->getName().'??=');
+
+ $old = mb_internal_encoding();
+ mb_internal_encoding('utf-8');
+ $newstring = mb_encode_mimeheader($subject, 'iso-2022-jp', 'B', "\r\n");
+ mb_internal_encoding($old);
+
+ $encoded = $this->_encoder->encodeString($subject, 0, 75 - $encodedWrapperLength, 'iso-2022-jp');
+ $this->assertEquals(
+ $encoded, $newstring,
+ 'Encoded string should decode back to original string for sample '
+ );
+ }
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php
new file mode 100644
index 0000000..a7f6fc5
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php
@@ -0,0 +1,127 @@
+<?php
+
+class Swift_Mime_MimePartAcceptanceTest extends \PHPUnit_Framework_TestCase
+{
+ private $_contentEncoder;
+ private $_cache;
+ private $_grammar;
+ private $_headers;
+
+ protected function setUp()
+ {
+ $this->_cache = new Swift_KeyCache_ArrayKeyCache(
+ new Swift_KeyCache_SimpleKeyCacheInputStream()
+ );
+ $factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
+ $this->_contentEncoder = new Swift_Mime_ContentEncoder_QpContentEncoder(
+ new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'),
+ new Swift_StreamFilters_ByteArrayReplacementFilter(
+ array(array(0x0D, 0x0A), array(0x0D), array(0x0A)),
+ array(array(0x0A), array(0x0A), array(0x0D, 0x0A))
+ )
+ );
+
+ $headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(
+ new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
+ );
+ $paramEncoder = new Swift_Encoder_Rfc2231Encoder(
+ new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
+ );
+ $this->_grammar = new Swift_Mime_Grammar();
+ $this->_headers = new Swift_Mime_SimpleHeaderSet(
+ new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $this->_grammar)
+ );
+ }
+
+ public function testCharsetIsSetInHeader()
+ {
+ $part = $this->_createMimePart();
+ $part->setContentType('text/plain');
+ $part->setCharset('utf-8');
+ $part->setBody('foobar');
+ $this->assertEquals(
+ 'Content-Type: text/plain; charset=utf-8'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n".
+ "\r\n".
+ 'foobar',
+ $part->toString()
+ );
+ }
+
+ public function testFormatIsSetInHeaders()
+ {
+ $part = $this->_createMimePart();
+ $part->setContentType('text/plain');
+ $part->setFormat('flowed');
+ $part->setBody('> foobar');
+ $this->assertEquals(
+ 'Content-Type: text/plain; format=flowed'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n".
+ "\r\n".
+ '> foobar',
+ $part->toString()
+ );
+ }
+
+ public function testDelSpIsSetInHeaders()
+ {
+ $part = $this->_createMimePart();
+ $part->setContentType('text/plain');
+ $part->setDelSp(true);
+ $part->setBody('foobar');
+ $this->assertEquals(
+ 'Content-Type: text/plain; delsp=yes'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n".
+ "\r\n".
+ 'foobar',
+ $part->toString()
+ );
+ }
+
+ public function testAll3ParamsInHeaders()
+ {
+ $part = $this->_createMimePart();
+ $part->setContentType('text/plain');
+ $part->setCharset('utf-8');
+ $part->setFormat('fixed');
+ $part->setDelSp(true);
+ $part->setBody('foobar');
+ $this->assertEquals(
+ 'Content-Type: text/plain; charset=utf-8; format=fixed; delsp=yes'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n".
+ "\r\n".
+ 'foobar',
+ $part->toString()
+ );
+ }
+
+ public function testBodyIsCanonicalized()
+ {
+ $part = $this->_createMimePart();
+ $part->setContentType('text/plain');
+ $part->setCharset('utf-8');
+ $part->setBody("foobar\r\rtest\ning\r");
+ $this->assertEquals(
+ 'Content-Type: text/plain; charset=utf-8'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n".
+ "\r\n".
+ "foobar\r\n".
+ "\r\n".
+ "test\r\n".
+ "ing\r\n",
+ $part->toString()
+ );
+ }
+
+ protected function _createMimePart()
+ {
+ $entity = new Swift_Mime_MimePart(
+ $this->_headers,
+ $this->_contentEncoder,
+ $this->_cache,
+ $this->_grammar
+ );
+
+ return $entity;
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php
new file mode 100644
index 0000000..912768e
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php
@@ -0,0 +1,1249 @@
+<?php
+
+class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
+{
+ protected function setUp()
+ {
+ Swift_Preferences::getInstance()->setCharset(null); //TODO: Test with the charset defined
+ }
+
+ public function testBasicHeaders()
+ {
+ /* -- RFC 2822, 3.6.
+ */
+
+ $message = $this->_createMessage();
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.date('r', $date)."\r\n".
+ 'From: '."\r\n".
+ 'MIME-Version: 1.0'."\r\n".
+ 'Content-Type: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString(),
+ '%s: Only required headers, and non-empty headers should be displayed'
+ );
+ }
+
+ public function testSubjectIsDisplayedIfSet()
+ {
+ $message = $this->_createMessage();
+ $message->setSubject('just a test subject');
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.date('r', $date)."\r\n".
+ 'Subject: just a test subject'."\r\n".
+ 'From: '."\r\n".
+ 'MIME-Version: 1.0'."\r\n".
+ 'Content-Type: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testDateCanBeSet()
+ {
+ $message = $this->_createMessage();
+ $message->setSubject('just a test subject');
+ $id = $message->getId();
+ $message->setDate(1234);
+ $this->assertEquals(
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.date('r', 1234)."\r\n".
+ 'Subject: just a test subject'."\r\n".
+ 'From: '."\r\n".
+ 'MIME-Version: 1.0'."\r\n".
+ 'Content-Type: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testMessageIdCanBeSet()
+ {
+ $message = $this->_createMessage();
+ $message->setSubject('just a test subject');
+ $message->setId('foo@bar');
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Message-ID: <foo@bar>'."\r\n".
+ 'Date: '.date('r', $date)."\r\n".
+ 'Subject: just a test subject'."\r\n".
+ 'From: '."\r\n".
+ 'MIME-Version: 1.0'."\r\n".
+ 'Content-Type: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testContentTypeCanBeChanged()
+ {
+ $message = $this->_createMessage();
+ $message->setSubject('just a test subject');
+ $message->setContentType('text/html');
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.date('r', $date)."\r\n".
+ 'Subject: just a test subject'."\r\n".
+ 'From: '."\r\n".
+ 'MIME-Version: 1.0'."\r\n".
+ 'Content-Type: text/html'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testCharsetCanBeSet()
+ {
+ $message = $this->_createMessage();
+ $message->setSubject('just a test subject');
+ $message->setContentType('text/html');
+ $message->setCharset('iso-8859-1');
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.date('r', $date)."\r\n".
+ 'Subject: just a test subject'."\r\n".
+ 'From: '."\r\n".
+ 'MIME-Version: 1.0'."\r\n".
+ 'Content-Type: text/html; charset=iso-8859-1'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testFormatCanBeSet()
+ {
+ $message = $this->_createMessage();
+ $message->setSubject('just a test subject');
+ $message->setFormat('flowed');
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.date('r', $date)."\r\n".
+ 'Subject: just a test subject'."\r\n".
+ 'From: '."\r\n".
+ 'MIME-Version: 1.0'."\r\n".
+ 'Content-Type: text/plain; format=flowed'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testEncoderCanBeSet()
+ {
+ $message = $this->_createMessage();
+ $message->setSubject('just a test subject');
+ $message->setContentType('text/html');
+ $message->setEncoder(
+ new Swift_Mime_ContentEncoder_PlainContentEncoder('7bit')
+ );
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.date('r', $date)."\r\n".
+ 'Subject: just a test subject'."\r\n".
+ 'From: '."\r\n".
+ 'MIME-Version: 1.0'."\r\n".
+ 'Content-Type: text/html'."\r\n".
+ 'Content-Transfer-Encoding: 7bit'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testFromAddressCanBeSet()
+ {
+ $message = $this->_createMessage();
+ $message->setSubject('just a test subject');
+ $message->setFrom('chris.corbyn@swiftmailer.org');
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.date('r', $date)."\r\n".
+ 'Subject: just a test subject'."\r\n".
+ 'From: chris.corbyn@swiftmailer.org'."\r\n".
+ 'MIME-Version: 1.0'."\r\n".
+ 'Content-Type: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testFromAddressCanBeSetWithName()
+ {
+ $message = $this->_createMessage();
+ $message->setSubject('just a test subject');
+ $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris Corbyn'));
+ $id = $message->getId();
+ $date = $message->getDate();
+ $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: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testMultipleFromAddressesCanBeSet()
+ {
+ $message = $this->_createMessage();
+ $message->setSubject('just a test subject');
+ $message->setFrom(array(
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn',
+ 'mark@swiftmailer.org',
+ ));
+ $id = $message->getId();
+ $date = $message->getDate();
+ $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>, mark@swiftmailer.org'."\r\n".
+ 'MIME-Version: 1.0'."\r\n".
+ 'Content-Type: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testReturnPathAddressCanBeSet()
+ {
+ $message = $this->_createMessage();
+ $message->setReturnPath('chris@w3style.co.uk');
+ $message->setSubject('just a test subject');
+ $message->setFrom(array(
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Return-Path: <chris@w3style.co.uk>'."\r\n".
+ '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: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testEmptyReturnPathHeaderCanBeUsed()
+ {
+ $message = $this->_createMessage();
+ $message->setReturnPath('');
+ $message->setSubject('just a test subject');
+ $message->setFrom(array(
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Return-Path: <>'."\r\n".
+ '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: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testSenderCanBeSet()
+ {
+ $message = $this->_createMessage();
+ $message->setSubject('just a test subject');
+ $message->setSender('chris.corbyn@swiftmailer.org');
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Sender: chris.corbyn@swiftmailer.org'."\r\n".
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.date('r', $date)."\r\n".
+ 'Subject: just a test subject'."\r\n".
+ 'From: '."\r\n".
+ 'MIME-Version: 1.0'."\r\n".
+ 'Content-Type: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testSenderCanBeSetWithName()
+ {
+ $message = $this->_createMessage();
+ $message->setSubject('just a test subject');
+ $message->setSender(array('chris.corbyn@swiftmailer.org' => 'Chris'));
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Sender: Chris <chris.corbyn@swiftmailer.org>'."\r\n".
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.date('r', $date)."\r\n".
+ 'Subject: just a test subject'."\r\n".
+ 'From: '."\r\n".
+ 'MIME-Version: 1.0'."\r\n".
+ 'Content-Type: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testReplyToCanBeSet()
+ {
+ $message = $this->_createMessage();
+ $message->setSubject('just a test subject');
+ $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));
+ $message->setReplyTo(array('chris@w3style.co.uk' => 'Myself'));
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.date('r', $date)."\r\n".
+ 'Subject: just a test subject'."\r\n".
+ 'From: Chris <chris.corbyn@swiftmailer.org>'."\r\n".
+ 'Reply-To: Myself <chris@w3style.co.uk>'."\r\n".
+ 'MIME-Version: 1.0'."\r\n".
+ 'Content-Type: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testMultipleReplyAddressCanBeUsed()
+ {
+ $message = $this->_createMessage();
+ $message->setSubject('just a test subject');
+ $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));
+ $message->setReplyTo(array(
+ 'chris@w3style.co.uk' => 'Myself',
+ 'my.other@address.com' => 'Me',
+ ));
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.date('r', $date)."\r\n".
+ 'Subject: just a test subject'."\r\n".
+ 'From: Chris <chris.corbyn@swiftmailer.org>'."\r\n".
+ 'Reply-To: Myself <chris@w3style.co.uk>, Me <my.other@address.com>'."\r\n".
+ 'MIME-Version: 1.0'."\r\n".
+ 'Content-Type: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testToAddressCanBeSet()
+ {
+ $message = $this->_createMessage();
+ $message->setSubject('just a test subject');
+ $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));
+ $message->setReplyTo(array(
+ 'chris@w3style.co.uk' => 'Myself',
+ 'my.other@address.com' => 'Me',
+ ));
+ $message->setTo('mark@swiftmailer.org');
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.date('r', $date)."\r\n".
+ 'Subject: just a test subject'."\r\n".
+ 'From: Chris <chris.corbyn@swiftmailer.org>'."\r\n".
+ 'Reply-To: Myself <chris@w3style.co.uk>, Me <my.other@address.com>'."\r\n".
+ 'To: mark@swiftmailer.org'."\r\n".
+ 'MIME-Version: 1.0'."\r\n".
+ 'Content-Type: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testMultipleToAddressesCanBeSet()
+ {
+ $message = $this->_createMessage();
+ $message->setSubject('just a test subject');
+ $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));
+ $message->setReplyTo(array(
+ 'chris@w3style.co.uk' => 'Myself',
+ 'my.other@address.com' => 'Me',
+ ));
+ $message->setTo(array(
+ 'mark@swiftmailer.org', 'chris@swiftmailer.org' => 'Chris Corbyn',
+ ));
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.date('r', $date)."\r\n".
+ 'Subject: just a test subject'."\r\n".
+ 'From: Chris <chris.corbyn@swiftmailer.org>'."\r\n".
+ 'Reply-To: Myself <chris@w3style.co.uk>, Me <my.other@address.com>'."\r\n".
+ 'To: mark@swiftmailer.org, Chris Corbyn <chris@swiftmailer.org>'."\r\n".
+ 'MIME-Version: 1.0'."\r\n".
+ 'Content-Type: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testCcAddressCanBeSet()
+ {
+ $message = $this->_createMessage();
+ $message->setSubject('just a test subject');
+ $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));
+ $message->setReplyTo(array(
+ 'chris@w3style.co.uk' => 'Myself',
+ 'my.other@address.com' => 'Me',
+ ));
+ $message->setTo(array(
+ 'mark@swiftmailer.org', 'chris@swiftmailer.org' => 'Chris Corbyn',
+ ));
+ $message->setCc('john@some-site.com');
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.date('r', $date)."\r\n".
+ 'Subject: just a test subject'."\r\n".
+ 'From: Chris <chris.corbyn@swiftmailer.org>'."\r\n".
+ 'Reply-To: Myself <chris@w3style.co.uk>, Me <my.other@address.com>'."\r\n".
+ 'To: mark@swiftmailer.org, Chris Corbyn <chris@swiftmailer.org>'."\r\n".
+ 'Cc: john@some-site.com'."\r\n".
+ 'MIME-Version: 1.0'."\r\n".
+ 'Content-Type: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testMultipleCcAddressesCanBeSet()
+ {
+ $message = $this->_createMessage();
+ $message->setSubject('just a test subject');
+ $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));
+ $message->setReplyTo(array(
+ 'chris@w3style.co.uk' => 'Myself',
+ 'my.other@address.com' => 'Me',
+ ));
+ $message->setTo(array(
+ 'mark@swiftmailer.org', 'chris@swiftmailer.org' => 'Chris Corbyn',
+ ));
+ $message->setCc(array(
+ 'john@some-site.com' => 'John West',
+ 'fred@another-site.co.uk' => 'Big Fred',
+ ));
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.date('r', $date)."\r\n".
+ 'Subject: just a test subject'."\r\n".
+ 'From: Chris <chris.corbyn@swiftmailer.org>'."\r\n".
+ 'Reply-To: Myself <chris@w3style.co.uk>, Me <my.other@address.com>'."\r\n".
+ 'To: mark@swiftmailer.org, Chris Corbyn <chris@swiftmailer.org>'."\r\n".
+ 'Cc: John West <john@some-site.com>, Big Fred <fred@another-site.co.uk>'."\r\n".
+ 'MIME-Version: 1.0'."\r\n".
+ 'Content-Type: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testBccAddressCanBeSet()
+ {
+ //Obviously Transports need to setBcc(array()) and send to each Bcc recipient
+ // separately in accordance with RFC 2822/2821
+ $message = $this->_createMessage();
+ $message->setSubject('just a test subject');
+ $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));
+ $message->setReplyTo(array(
+ 'chris@w3style.co.uk' => 'Myself',
+ 'my.other@address.com' => 'Me',
+ ));
+ $message->setTo(array(
+ 'mark@swiftmailer.org', 'chris@swiftmailer.org' => 'Chris Corbyn',
+ ));
+ $message->setCc(array(
+ 'john@some-site.com' => 'John West',
+ 'fred@another-site.co.uk' => 'Big Fred',
+ ));
+ $message->setBcc('x@alphabet.tld');
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.date('r', $date)."\r\n".
+ 'Subject: just a test subject'."\r\n".
+ 'From: Chris <chris.corbyn@swiftmailer.org>'."\r\n".
+ 'Reply-To: Myself <chris@w3style.co.uk>, Me <my.other@address.com>'."\r\n".
+ 'To: mark@swiftmailer.org, Chris Corbyn <chris@swiftmailer.org>'."\r\n".
+ 'Cc: John West <john@some-site.com>, Big Fred <fred@another-site.co.uk>'."\r\n".
+ 'Bcc: x@alphabet.tld'."\r\n".
+ 'MIME-Version: 1.0'."\r\n".
+ 'Content-Type: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testMultipleBccAddressesCanBeSet()
+ {
+ //Obviously Transports need to setBcc(array()) and send to each Bcc recipient
+ // separately in accordance with RFC 2822/2821
+ $message = $this->_createMessage();
+ $message->setSubject('just a test subject');
+ $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));
+ $message->setReplyTo(array(
+ 'chris@w3style.co.uk' => 'Myself',
+ 'my.other@address.com' => 'Me',
+ ));
+ $message->setTo(array(
+ 'mark@swiftmailer.org', 'chris@swiftmailer.org' => 'Chris Corbyn',
+ ));
+ $message->setCc(array(
+ 'john@some-site.com' => 'John West',
+ 'fred@another-site.co.uk' => 'Big Fred',
+ ));
+ $message->setBcc(array('x@alphabet.tld', 'a@alphabet.tld' => 'A'));
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.date('r', $date)."\r\n".
+ 'Subject: just a test subject'."\r\n".
+ 'From: Chris <chris.corbyn@swiftmailer.org>'."\r\n".
+ 'Reply-To: Myself <chris@w3style.co.uk>, Me <my.other@address.com>'."\r\n".
+ 'To: mark@swiftmailer.org, Chris Corbyn <chris@swiftmailer.org>'."\r\n".
+ 'Cc: John West <john@some-site.com>, Big Fred <fred@another-site.co.uk>'."\r\n".
+ 'Bcc: x@alphabet.tld, A <a@alphabet.tld>'."\r\n".
+ 'MIME-Version: 1.0'."\r\n".
+ 'Content-Type: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testStringBodyIsAppended()
+ {
+ $message = $this->_createMessage();
+ $message->setReturnPath('chris@w3style.co.uk');
+ $message->setSubject('just a test subject');
+ $message->setFrom(array(
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setBody(
+ 'just a test body'."\r\n".
+ 'with a new line'
+ );
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Return-Path: <chris@w3style.co.uk>'."\r\n".
+ '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: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n".
+ "\r\n".
+ 'just a test body'."\r\n".
+ 'with a new line',
+ $message->toString()
+ );
+ }
+
+ public function testStringBodyIsEncoded()
+ {
+ $message = $this->_createMessage();
+ $message->setReturnPath('chris@w3style.co.uk');
+ $message->setSubject('just a test subject');
+ $message->setFrom(array(
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setBody(
+ 'Just s'.pack('C*', 0xC2, 0x01, 0x01).'me multi-'."\r\n".
+ 'line message!'
+ );
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Return-Path: <chris@w3style.co.uk>'."\r\n".
+ '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: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n".
+ "\r\n".
+ 'Just s=C2=01=01me multi-'."\r\n".
+ 'line message!',
+ $message->toString()
+ );
+ }
+
+ public function testChildrenCanBeAttached()
+ {
+ $message = $this->_createMessage();
+ $message->setReturnPath('chris@w3style.co.uk');
+ $message->setSubject('just a test subject');
+ $message->setFrom(array(
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+
+ $id = $message->getId();
+ $date = $message->getDate();
+ $boundary = $message->getBoundary();
+
+ $part1 = $this->_createMimePart();
+ $part1->setContentType('text/plain');
+ $part1->setCharset('iso-8859-1');
+ $part1->setBody('foo');
+
+ $message->attach($part1);
+
+ $part2 = $this->_createMimePart();
+ $part2->setContentType('text/html');
+ $part2->setCharset('iso-8859-1');
+ $part2->setBody('test <b>foo</b>');
+
+ $message->attach($part2);
+
+ $this->assertEquals(
+ 'Return-Path: <chris@w3style.co.uk>'."\r\n".
+ '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()
+ );
+ }
+
+ public function testAttachmentsBeingAttached()
+ {
+ $message = $this->_createMessage();
+ $message->setReturnPath('chris@w3style.co.uk');
+ $message->setSubject('just a test subject');
+ $message->setFrom(array(
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+
+ $id = $message->getId();
+ $date = preg_quote(date('r', $message->getDate()), '~');
+ $boundary = $message->getBoundary();
+
+ $part = $this->_createMimePart();
+ $part->setContentType('text/plain');
+ $part->setCharset('iso-8859-1');
+ $part->setBody('foo');
+
+ $message->attach($part);
+
+ $attachment = $this->_createAttachment();
+ $attachment->setContentType('application/pdf');
+ $attachment->setFilename('foo.pdf');
+ $attachment->setBody('<pdf data>');
+
+ $message->attach($attachment);
+
+ $this->assertRegExp(
+ '~^'.
+ 'Return-Path: <chris@w3style.co.uk>'."\r\n".
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.$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/mixed;'."\r\n".
+ ' boundary="'.$boundary.'"'."\r\n".
+ "\r\n\r\n".
+ '--'.$boundary."\r\n".
+ 'Content-Type: multipart/alternative;'."\r\n".
+ ' boundary="(.*?)"'."\r\n".
+ "\r\n\r\n".
+ '--\\1'."\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".
+ '--\\1--'."\r\n".
+ "\r\n\r\n".
+ '--'.$boundary."\r\n".
+ 'Content-Type: application/pdf; name=foo.pdf'."\r\n".
+ 'Content-Transfer-Encoding: base64'."\r\n".
+ 'Content-Disposition: attachment; filename=foo.pdf'."\r\n".
+ "\r\n".
+ preg_quote(base64_encode('<pdf data>'), '~').
+ "\r\n\r\n".
+ '--'.$boundary.'--'."\r\n".
+ '$~D',
+ $message->toString()
+ );
+ }
+
+ public function testAttachmentsAndEmbeddedFilesBeingAttached()
+ {
+ $message = $this->_createMessage();
+ $message->setReturnPath('chris@w3style.co.uk');
+ $message->setSubject('just a test subject');
+ $message->setFrom(array(
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+
+ $id = $message->getId();
+ $date = preg_quote(date('r', $message->getDate()), '~');
+ $boundary = $message->getBoundary();
+
+ $part = $this->_createMimePart();
+ $part->setContentType('text/plain');
+ $part->setCharset('iso-8859-1');
+ $part->setBody('foo');
+
+ $message->attach($part);
+
+ $attachment = $this->_createAttachment();
+ $attachment->setContentType('application/pdf');
+ $attachment->setFilename('foo.pdf');
+ $attachment->setBody('<pdf data>');
+
+ $message->attach($attachment);
+
+ $file = $this->_createEmbeddedFile();
+ $file->setContentType('image/jpeg');
+ $file->setFilename('myimage.jpg');
+ $file->setBody('<image data>');
+
+ $message->attach($file);
+
+ $cid = $file->getId();
+
+ $this->assertRegExp(
+ '~^'.
+ 'Return-Path: <chris@w3style.co.uk>'."\r\n".
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.$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/mixed;'."\r\n".
+ ' boundary="'.$boundary.'"'."\r\n".
+ "\r\n\r\n".
+ '--'.$boundary."\r\n".
+ 'Content-Type: multipart/alternative;'."\r\n".
+ ' boundary="(.*?)"'."\r\n".
+ "\r\n\r\n".
+ '--\\1'."\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".
+ '--\\1'."\r\n".
+ 'Content-Type: multipart/related;'."\r\n".
+ ' boundary="(.*?)"'."\r\n".
+ "\r\n\r\n".
+ '--\\2'."\r\n".
+ 'Content-Type: image/jpeg; name=myimage.jpg'."\r\n".
+ 'Content-Transfer-Encoding: base64'."\r\n".
+ 'Content-ID: <'.$cid.'>'."\r\n".
+ 'Content-Disposition: inline; filename=myimage.jpg'."\r\n".
+ "\r\n".
+ preg_quote(base64_encode('<image data>'), '~').
+ "\r\n\r\n".
+ '--\\2--'."\r\n".
+ "\r\n\r\n".
+ '--\\1--'."\r\n".
+ "\r\n\r\n".
+ '--'.$boundary."\r\n".
+ 'Content-Type: application/pdf; name=foo.pdf'."\r\n".
+ 'Content-Transfer-Encoding: base64'."\r\n".
+ 'Content-Disposition: attachment; filename=foo.pdf'."\r\n".
+ "\r\n".
+ preg_quote(base64_encode('<pdf data>'), '~').
+ "\r\n\r\n".
+ '--'.$boundary.'--'."\r\n".
+ '$~D',
+ $message->toString()
+ );
+ }
+
+ public function testComplexEmbeddingOfContent()
+ {
+ $message = $this->_createMessage();
+ $message->setReturnPath('chris@w3style.co.uk');
+ $message->setSubject('just a test subject');
+ $message->setFrom(array(
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+
+ $id = $message->getId();
+ $date = preg_quote(date('r', $message->getDate()), '~');
+ $boundary = $message->getBoundary();
+
+ $attachment = $this->_createAttachment();
+ $attachment->setContentType('application/pdf');
+ $attachment->setFilename('foo.pdf');
+ $attachment->setBody('<pdf data>');
+
+ $message->attach($attachment);
+
+ $file = $this->_createEmbeddedFile();
+ $file->setContentType('image/jpeg');
+ $file->setFilename('myimage.jpg');
+ $file->setBody('<image data>');
+
+ $part = $this->_createMimePart();
+ $part->setContentType('text/html');
+ $part->setCharset('iso-8859-1');
+ $part->setBody('foo <img src="'.$message->embed($file).'" />');
+
+ $message->attach($part);
+
+ $cid = $file->getId();
+
+ $this->assertRegExp(
+ '~^'.
+ 'Return-Path: <chris@w3style.co.uk>'."\r\n".
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.$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/mixed;'."\r\n".
+ ' boundary="'.$boundary.'"'."\r\n".
+ "\r\n\r\n".
+ '--'.$boundary."\r\n".
+ 'Content-Type: multipart/related;'."\r\n".
+ ' boundary="(.*?)"'."\r\n".
+ "\r\n\r\n".
+ '--\\1'."\r\n".
+ 'Content-Type: text/html; charset=iso-8859-1'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n".
+ "\r\n".
+ 'foo <img src=3D"cid:'.$cid.'" />'.//=3D is just = in QP
+ "\r\n\r\n".
+ '--\\1'."\r\n".
+ 'Content-Type: image/jpeg; name=myimage.jpg'."\r\n".
+ 'Content-Transfer-Encoding: base64'."\r\n".
+ 'Content-ID: <'.$cid.'>'."\r\n".
+ 'Content-Disposition: inline; filename=myimage.jpg'."\r\n".
+ "\r\n".
+ preg_quote(base64_encode('<image data>'), '~').
+ "\r\n\r\n".
+ '--\\1--'."\r\n".
+ "\r\n\r\n".
+ '--'.$boundary."\r\n".
+ 'Content-Type: application/pdf; name=foo.pdf'."\r\n".
+ 'Content-Transfer-Encoding: base64'."\r\n".
+ 'Content-Disposition: attachment; filename=foo.pdf'."\r\n".
+ "\r\n".
+ preg_quote(base64_encode('<pdf data>'), '~').
+ "\r\n\r\n".
+ '--'.$boundary.'--'."\r\n".
+ '$~D',
+ $message->toString()
+ );
+ }
+
+ public function testAttachingAndDetachingContent()
+ {
+ $message = $this->_createMessage();
+ $message->setReturnPath('chris@w3style.co.uk');
+ $message->setSubject('just a test subject');
+ $message->setFrom(array(
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+
+ $id = $message->getId();
+ $date = preg_quote(date('r', $message->getDate()), '~');
+ $boundary = $message->getBoundary();
+
+ $part = $this->_createMimePart();
+ $part->setContentType('text/plain');
+ $part->setCharset('iso-8859-1');
+ $part->setBody('foo');
+
+ $message->attach($part);
+
+ $attachment = $this->_createAttachment();
+ $attachment->setContentType('application/pdf');
+ $attachment->setFilename('foo.pdf');
+ $attachment->setBody('<pdf data>');
+
+ $message->attach($attachment);
+
+ $file = $this->_createEmbeddedFile();
+ $file->setContentType('image/jpeg');
+ $file->setFilename('myimage.jpg');
+ $file->setBody('<image data>');
+
+ $message->attach($file);
+
+ $cid = $file->getId();
+
+ $message->detach($attachment);
+
+ $this->assertRegExp(
+ '~^'.
+ 'Return-Path: <chris@w3style.co.uk>'."\r\n".
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.$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: multipart/related;'."\r\n".
+ ' boundary="(.*?)"'."\r\n".
+ "\r\n\r\n".
+ '--\\1'."\r\n".
+ 'Content-Type: image/jpeg; name=myimage.jpg'."\r\n".
+ 'Content-Transfer-Encoding: base64'."\r\n".
+ 'Content-ID: <'.$cid.'>'."\r\n".
+ 'Content-Disposition: inline; filename=myimage.jpg'."\r\n".
+ "\r\n".
+ preg_quote(base64_encode('<image data>'), '~').
+ "\r\n\r\n".
+ '--\\1--'."\r\n".
+ "\r\n\r\n".
+ '--'.$boundary.'--'."\r\n".
+ '$~D',
+ $message->toString(),
+ '%s: Attachment should have been detached'
+ );
+ }
+
+ public function testBoundaryDoesNotAppearAfterAllPartsAreDetached()
+ {
+ $message = $this->_createMessage();
+ $message->setReturnPath('chris@w3style.co.uk');
+ $message->setSubject('just a test subject');
+ $message->setFrom(array(
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+
+ $id = $message->getId();
+ $date = $message->getDate();
+ $boundary = $message->getBoundary();
+
+ $part1 = $this->_createMimePart();
+ $part1->setContentType('text/plain');
+ $part1->setCharset('iso-8859-1');
+ $part1->setBody('foo');
+
+ $message->attach($part1);
+
+ $part2 = $this->_createMimePart();
+ $part2->setContentType('text/html');
+ $part2->setCharset('iso-8859-1');
+ $part2->setBody('test <b>foo</b>');
+
+ $message->attach($part2);
+
+ $message->detach($part1);
+ $message->detach($part2);
+
+ $this->assertEquals(
+ 'Return-Path: <chris@w3style.co.uk>'."\r\n".
+ '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: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n",
+ $message->toString(),
+ '%s: Message should be restored to orignal state after parts are detached'
+ );
+ }
+
+ public function testCharsetFormatOrDelSpAreNotShownWhenBoundaryIsSet()
+ {
+ $message = $this->_createMessage();
+ $message->setReturnPath('chris@w3style.co.uk');
+ $message->setSubject('just a test subject');
+ $message->setFrom(array(
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setCharset('utf-8');
+ $message->setFormat('flowed');
+ $message->setDelSp(true);
+
+ $id = $message->getId();
+ $date = $message->getDate();
+ $boundary = $message->getBoundary();
+
+ $part1 = $this->_createMimePart();
+ $part1->setContentType('text/plain');
+ $part1->setCharset('iso-8859-1');
+ $part1->setBody('foo');
+
+ $message->attach($part1);
+
+ $part2 = $this->_createMimePart();
+ $part2->setContentType('text/html');
+ $part2->setCharset('iso-8859-1');
+ $part2->setBody('test <b>foo</b>');
+
+ $message->attach($part2);
+
+ $this->assertEquals(
+ 'Return-Path: <chris@w3style.co.uk>'."\r\n".
+ '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()
+ );
+ }
+
+ public function testBodyCanBeSetWithAttachments()
+ {
+ $message = $this->_createMessage();
+ $message->setReturnPath('chris@w3style.co.uk');
+ $message->setSubject('just a test subject');
+ $message->setFrom(array(
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setContentType('text/html');
+ $message->setCharset('iso-8859-1');
+ $message->setBody('foo');
+
+ $id = $message->getId();
+ $date = date('r', $message->getDate());
+ $boundary = $message->getBoundary();
+
+ $attachment = $this->_createAttachment();
+ $attachment->setContentType('application/pdf');
+ $attachment->setFilename('foo.pdf');
+ $attachment->setBody('<pdf data>');
+
+ $message->attach($attachment);
+
+ $this->assertEquals(
+ 'Return-Path: <chris@w3style.co.uk>'."\r\n".
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.$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/mixed;'."\r\n".
+ ' boundary="'.$boundary.'"'."\r\n".
+ "\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".
+ 'foo'.
+ "\r\n\r\n".
+ '--'.$boundary."\r\n".
+ 'Content-Type: application/pdf; name=foo.pdf'."\r\n".
+ 'Content-Transfer-Encoding: base64'."\r\n".
+ 'Content-Disposition: attachment; filename=foo.pdf'."\r\n".
+ "\r\n".
+ base64_encode('<pdf data>').
+ "\r\n\r\n".
+ '--'.$boundary.'--'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testHtmlPartAlwaysAppearsLast()
+ {
+ $message = $this->_createMessage();
+ $message->setReturnPath('chris@w3style.co.uk');
+ $message->setSubject('just a test subject');
+ $message->setFrom(array(
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+
+ $id = $message->getId();
+ $date = date('r', $message->getDate());
+ $boundary = $message->getBoundary();
+
+ $part1 = $this->_createMimePart();
+ $part1->setContentType('text/html');
+ $part1->setBody('foo');
+
+ $part2 = $this->_createMimePart();
+ $part2->setContentType('text/plain');
+ $part2->setBody('bar');
+
+ $message->attach($part1);
+ $message->attach($part2);
+
+ $this->assertEquals(
+ 'Return-Path: <chris@w3style.co.uk>'."\r\n".
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.$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'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n".
+ "\r\n".
+ 'bar'.
+ "\r\n\r\n".
+ '--'.$boundary."\r\n".
+ 'Content-Type: text/html'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n".
+ "\r\n".
+ 'foo'.
+ "\r\n\r\n".
+ '--'.$boundary.'--'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testBodyBecomesPartIfOtherPartsAttached()
+ {
+ $message = $this->_createMessage();
+ $message->setReturnPath('chris@w3style.co.uk');
+ $message->setSubject('just a test subject');
+ $message->setFrom(array(
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setContentType('text/html');
+ $message->setBody('foo');
+
+ $id = $message->getId();
+ $date = date('r', $message->getDate());
+ $boundary = $message->getBoundary();
+
+ $part2 = $this->_createMimePart();
+ $part2->setContentType('text/plain');
+ $part2->setBody('bar');
+
+ $message->attach($part2);
+
+ $this->assertEquals(
+ 'Return-Path: <chris@w3style.co.uk>'."\r\n".
+ 'Message-ID: <'.$id.'>'."\r\n".
+ 'Date: '.$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'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n".
+ "\r\n".
+ 'bar'.
+ "\r\n\r\n".
+ '--'.$boundary."\r\n".
+ 'Content-Type: text/html'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n".
+ "\r\n".
+ 'foo'.
+ "\r\n\r\n".
+ '--'.$boundary.'--'."\r\n",
+ $message->toString()
+ );
+ }
+
+ public function testBodyIsCanonicalized()
+ {
+ $message = $this->_createMessage();
+ $message->setReturnPath('chris@w3style.co.uk');
+ $message->setSubject('just a test subject');
+ $message->setFrom(array(
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setBody(
+ 'just a test body'."\n".
+ 'with a new line'
+ );
+ $id = $message->getId();
+ $date = $message->getDate();
+ $this->assertEquals(
+ 'Return-Path: <chris@w3style.co.uk>'."\r\n".
+ '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: text/plain'."\r\n".
+ 'Content-Transfer-Encoding: quoted-printable'."\r\n".
+ "\r\n".
+ 'just a test body'."\r\n".
+ 'with a new line',
+ $message->toString()
+ );
+ }
+
+ protected function _createMessage()
+ {
+ return new Swift_Message();
+ }
+
+ protected function _createMimePart()
+ {
+ return new Swift_MimePart();
+ }
+
+ protected function _createAttachment()
+ {
+ return new Swift_Attachment();
+ }
+
+ protected function _createEmbeddedFile()
+ {
+ return new Swift_EmbeddedFile();
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MimePartAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MimePartAcceptanceTest.php
new file mode 100644
index 0000000..f42405d
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MimePartAcceptanceTest.php
@@ -0,0 +1,15 @@
+<?php
+
+require_once 'swift_required.php';
+require_once __DIR__.'/Mime/MimePartAcceptanceTest.php';
+
+class Swift_MimePartAcceptanceTest extends Swift_Mime_MimePartAcceptanceTest
+{
+ protected function _createMimePart()
+ {
+ Swift_DependencyContainer::getInstance()
+ ->register('properties.charset')->asValue(null);
+
+ return Swift_MimePart::newInstance();
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php
new file mode 100644
index 0000000..21abc13
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php
@@ -0,0 +1,131 @@
+<?php
+
+abstract class Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest extends \PHPUnit_Framework_TestCase
+{
+ protected $_buffer;
+
+ abstract protected function _initializeBuffer();
+
+ protected function setUp()
+ {
+ if (true == getenv('TRAVIS')) {
+ $this->markTestSkipped(
+ 'Will fail on travis-ci if not skipped due to travis blocking '.
+ 'socket mailing tcp connections.'
+ );
+ }
+
+ $this->_buffer = new Swift_Transport_StreamBuffer(
+ $this->getMockBuilder('Swift_ReplacementFilterFactory')->getMock()
+ );
+ }
+
+ public function testReadLine()
+ {
+ $this->_initializeBuffer();
+
+ $line = $this->_buffer->readLine(0);
+ $this->assertRegExp('/^[0-9]{3}.*?\r\n$/D', $line);
+ $seq = $this->_buffer->write("QUIT\r\n");
+ $this->assertTrue((bool) $seq);
+ $line = $this->_buffer->readLine($seq);
+ $this->assertRegExp('/^[0-9]{3}.*?\r\n$/D', $line);
+ $this->_buffer->terminate();
+ }
+
+ public function testWrite()
+ {
+ $this->_initializeBuffer();
+
+ $line = $this->_buffer->readLine(0);
+ $this->assertRegExp('/^[0-9]{3}.*?\r\n$/D', $line);
+
+ $seq = $this->_buffer->write("HELO foo\r\n");
+ $this->assertTrue((bool) $seq);
+ $line = $this->_buffer->readLine($seq);
+ $this->assertRegExp('/^[0-9]{3}.*?\r\n$/D', $line);
+
+ $seq = $this->_buffer->write("QUIT\r\n");
+ $this->assertTrue((bool) $seq);
+ $line = $this->_buffer->readLine($seq);
+ $this->assertRegExp('/^[0-9]{3}.*?\r\n$/D', $line);
+ $this->_buffer->terminate();
+ }
+
+ public function testBindingOtherStreamsMirrorsWriteOperations()
+ {
+ $this->_initializeBuffer();
+
+ $is1 = $this->_createMockInputStream();
+ $is2 = $this->_createMockInputStream();
+
+ $is1->expects($this->at(0))
+ ->method('write')
+ ->with('x');
+ $is1->expects($this->at(1))
+ ->method('write')
+ ->with('y');
+ $is2->expects($this->at(0))
+ ->method('write')
+ ->with('x');
+ $is2->expects($this->at(1))
+ ->method('write')
+ ->with('y');
+
+ $this->_buffer->bind($is1);
+ $this->_buffer->bind($is2);
+
+ $this->_buffer->write('x');
+ $this->_buffer->write('y');
+ }
+
+ public function testBindingOtherStreamsMirrorsFlushOperations()
+ {
+ $this->_initializeBuffer();
+
+ $is1 = $this->_createMockInputStream();
+ $is2 = $this->_createMockInputStream();
+
+ $is1->expects($this->once())
+ ->method('flushBuffers');
+ $is2->expects($this->once())
+ ->method('flushBuffers');
+
+ $this->_buffer->bind($is1);
+ $this->_buffer->bind($is2);
+
+ $this->_buffer->flushBuffers();
+ }
+
+ public function testUnbindingStreamPreventsFurtherWrites()
+ {
+ $this->_initializeBuffer();
+
+ $is1 = $this->_createMockInputStream();
+ $is2 = $this->_createMockInputStream();
+
+ $is1->expects($this->at(0))
+ ->method('write')
+ ->with('x');
+ $is1->expects($this->at(1))
+ ->method('write')
+ ->with('y');
+ $is2->expects($this->once())
+ ->method('write')
+ ->with('x');
+
+ $this->_buffer->bind($is1);
+ $this->_buffer->bind($is2);
+
+ $this->_buffer->write('x');
+
+ $this->_buffer->unbind($is2);
+
+ $this->_buffer->write('y');
+ }
+
+ private function _createMockInputStream()
+ {
+ return $this->getMockBuilder('Swift_InputByteStream')->getMock();
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php
new file mode 100644
index 0000000..4c3c7d3
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php
@@ -0,0 +1,33 @@
+<?php
+
+require_once __DIR__.'/AbstractStreamBufferAcceptanceTest.php';
+
+class Swift_Transport_StreamBuffer_BasicSocketAcceptanceTest extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest
+{
+ protected function setUp()
+ {
+ if (!defined('SWIFT_SMTP_HOST')) {
+ $this->markTestSkipped(
+ 'Cannot run test without an SMTP host to connect to (define '.
+ 'SWIFT_SMTP_HOST in tests/acceptance.conf.php if you wish to run this test)'
+ );
+ }
+ parent::setUp();
+ }
+
+ protected function _initializeBuffer()
+ {
+ $parts = explode(':', SWIFT_SMTP_HOST);
+ $host = $parts[0];
+ $port = isset($parts[1]) ? $parts[1] : 25;
+
+ $this->_buffer->initialize(array(
+ 'type' => Swift_Transport_IoBuffer::TYPE_SOCKET,
+ 'host' => $host,
+ 'port' => $port,
+ 'protocol' => 'tcp',
+ 'blocking' => 1,
+ 'timeout' => 15,
+ ));
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php
new file mode 100644
index 0000000..a37439d
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php
@@ -0,0 +1,26 @@
+<?php
+
+require_once __DIR__.'/AbstractStreamBufferAcceptanceTest.php';
+
+class Swift_Transport_StreamBuffer_ProcessAcceptanceTest extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest
+{
+ protected function setUp()
+ {
+ if (!defined('SWIFT_SENDMAIL_PATH')) {
+ $this->markTestSkipped(
+ 'Cannot run test without a path to sendmail (define '.
+ 'SWIFT_SENDMAIL_PATH in tests/acceptance.conf.php if you wish to run this test)'
+ );
+ }
+
+ parent::setUp();
+ }
+
+ protected function _initializeBuffer()
+ {
+ $this->_buffer->initialize(array(
+ 'type' => Swift_Transport_IoBuffer::TYPE_PROCESS,
+ 'command' => SWIFT_SENDMAIL_PATH.' -bs',
+ ));
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php
new file mode 100644
index 0000000..59362b0
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php
@@ -0,0 +1,67 @@
+<?php
+
+class Swift_Transport_StreamBuffer_SocketTimeoutTest extends \PHPUnit_Framework_TestCase
+{
+ protected $_buffer;
+
+ protected $_randomHighPort;
+
+ protected $_server;
+
+ protected function setUp()
+ {
+ if (!defined('SWIFT_SMTP_HOST')) {
+ $this->markTestSkipped(
+ 'Cannot run test without an SMTP host to connect to (define '.
+ 'SWIFT_SMTP_HOST in tests/acceptance.conf.php if you wish to run this test)'
+ );
+ }
+
+ $serverStarted = false;
+ for ($i = 0; $i < 5; ++$i) {
+ $this->_randomHighPort = rand(50000, 65000);
+ $this->_server = stream_socket_server('tcp://127.0.0.1:'.$this->_randomHighPort);
+ if ($this->_server) {
+ $serverStarted = true;
+ }
+ }
+
+ $this->_buffer = new Swift_Transport_StreamBuffer(
+ $this->getMockBuilder('Swift_ReplacementFilterFactory')->getMock()
+ );
+ }
+
+ protected function _initializeBuffer()
+ {
+ $host = '127.0.0.1';
+ $port = $this->_randomHighPort;
+
+ $this->_buffer->initialize(array(
+ 'type' => Swift_Transport_IoBuffer::TYPE_SOCKET,
+ 'host' => $host,
+ 'port' => $port,
+ 'protocol' => 'tcp',
+ 'blocking' => 1,
+ 'timeout' => 1,
+ ));
+ }
+
+ public function testTimeoutException()
+ {
+ $this->_initializeBuffer();
+ $e = null;
+ try {
+ $line = $this->_buffer->readLine(0);
+ } catch (Exception $e) {
+ }
+ $this->assertInstanceOf('Swift_IoException', $e, 'IO Exception Not Thrown On Connection Timeout');
+ $this->assertRegExp('/Connection to .* Timed Out/', $e->getMessage());
+ }
+
+ protected function tearDown()
+ {
+ if ($this->_server) {
+ stream_socket_shutdown($this->_server, STREAM_SHUT_RDWR);
+ }
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php
new file mode 100644
index 0000000..32e0fe8
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php
@@ -0,0 +1,40 @@
+<?php
+
+require_once __DIR__.'/AbstractStreamBufferAcceptanceTest.php';
+
+class Swift_Transport_StreamBuffer_SslSocketAcceptanceTest extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest
+{
+ protected function setUp()
+ {
+ $streams = stream_get_transports();
+ if (!in_array('ssl', $streams)) {
+ $this->markTestSkipped(
+ 'SSL is not configured for your system. It is not possible to run this test'
+ );
+ }
+ if (!defined('SWIFT_SSL_HOST')) {
+ $this->markTestSkipped(
+ 'Cannot run test without an SSL enabled SMTP host to connect to (define '.
+ 'SWIFT_SSL_HOST in tests/acceptance.conf.php if you wish to run this test)'
+ );
+ }
+
+ parent::setUp();
+ }
+
+ protected function _initializeBuffer()
+ {
+ $parts = explode(':', SWIFT_SSL_HOST);
+ $host = $parts[0];
+ $port = isset($parts[1]) ? $parts[1] : 25;
+
+ $this->_buffer->initialize(array(
+ 'type' => Swift_Transport_IoBuffer::TYPE_SOCKET,
+ 'host' => $host,
+ 'port' => $port,
+ 'protocol' => 'ssl',
+ 'blocking' => 1,
+ 'timeout' => 15,
+ ));
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/TlsSocketAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/TlsSocketAcceptanceTest.php
new file mode 100644
index 0000000..1053a87
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/TlsSocketAcceptanceTest.php
@@ -0,0 +1,39 @@
+<?php
+
+require_once __DIR__.'/AbstractStreamBufferAcceptanceTest.php';
+
+class Swift_Transport_StreamBuffer_TlsSocketAcceptanceTest extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest
+{
+ protected function setUp()
+ {
+ $streams = stream_get_transports();
+ if (!in_array('tls', $streams)) {
+ $this->markTestSkipped(
+ 'TLS is not configured for your system. It is not possible to run this test'
+ );
+ }
+ if (!defined('SWIFT_TLS_HOST')) {
+ $this->markTestSkipped(
+ 'Cannot run test without a TLS enabled SMTP host to connect to (define '.
+ 'SWIFT_TLS_HOST in tests/acceptance.conf.php if you wish to run this test)'
+ );
+ }
+ parent::setUp();
+ }
+
+ protected function _initializeBuffer()
+ {
+ $parts = explode(':', SWIFT_TLS_HOST);
+ $host = $parts[0];
+ $port = isset($parts[1]) ? $parts[1] : 25;
+
+ $this->_buffer->initialize(array(
+ 'type' => Swift_Transport_IoBuffer::TYPE_SOCKET,
+ 'host' => $host,
+ 'port' => $port,
+ 'protocol' => 'tls',
+ 'blocking' => 1,
+ 'timeout' => 15,
+ ));
+ }
+}