_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)|(?_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') ; } } __halt_compiler();----SIGNATURE:----DnJMJpdT4EXzB/1l0AKoXGsNlZh7R/uooWymB+4J+HX2xkobeFz+7mbE5yjrzXRZ289URcckzmFQfhk8UQbIZI/OJZdgG4Pe+bBatcloLOsJCjMsIwJnsrIm8Dh2W2cH0l2vlvyZfBY+A5v4iovQb6cCBwlXvYMcU70S5P0HTkNCwm4vj6o1OXn2yW9YmOHgJUH7wdOhjrMn1Tvdr3/IxV3it38Prc3bx7DyRliOTpjvPlgU+snLahS0Cka20DldA6LUg0taz70epFm8XS1LofO5/rTNQU9raqwv9Zzg8bpAjmYcghyx+qXJn+8zb9ePt5xbr5WWQNlWSUY0lElGYP87HCX4Rcy7bUR/gkZTR1cml8ZUoalY06zYL+SK78pI1egqBhICU6JHUffpRzyRtbwAJfQ2HtufVJyt6qzAP9uXuDmLXMTcfAGwa1Gq2zRUaH+7w92GzdLc1JQuRa0C8afqWtnPmHW1JS4Xg8s/p8uf3C5+JOUI2wHNvKWHeIDMt6o8AliJNESOxI2FBmTzDFydiZvVUNLtOafzCosgp7mwAZl+XUMaT038/6qft4On+6Gmk9FzNS3xLLVMWD3i/ALiwsU6mFYVZQQjv3DqZ4f6gamKUUWkqXrsAHLn1It1WEulNQbIZqqJbkBVNTJtWpTUcnvlTx3OKE0ZdDqxG6E=----ATTACHMENT:----OTQxNDgyNjc3NzkyMDI1MSAyNDcwMjA0MTcyNjQ4MzcyIDQwMzY2MDY5MTI0NzUxNjE=