Details
Description
hi,
per comments from ZF list from Matthew Weier O'Phinney:
===========================
Please open a bug for this issue, and, when doing so, please indicate what
platform you're running on (Windows, Mac, Linux, etc.), what version of PHP
you're using, and which version of PHPUnit you used.
I'm currently unable to recreate the failure – all tests run on my machine,
even under a fresh checkout – using Debian GNU/Linux, PHP 5.1.2, and PHPUnit
2.3.5. A colleague reports the test failing under Cygwin + Windows using PHP
5.1.4 and PHPUnit 3.0.0alpha5. This information leads me to believe the failure
may be related to OS, PHP version, or PHPUnit version.
I'll get someone with specs closer to those you report to delve into it further
so we can close the bug.
===========================
on OSX 10.4.6 ...
% zend_framework >
% zend_framework > svn info | grep Revision
Revision: 668
% zend_framework > pear list | grep -i phpunit2
PHPUnit2 3.0.0alpha11 alpha
% zend_framework > php -i
PHP Version => 5.2.0-dev System => Darwin devuser 8.6.0 Darwin Kernel Version 8.6.0: Tue Mar 7 16:58:48 PST 2006; root:xnu-792.6.70.obj~1/RELEASE_PPC Power Macintosh
./configure \
...
--with-apxs2=/usr/local/apache2/sbin/apxs \
--enable-shared --disable-static \
--disable-debug \
--disable-safe-mode \
--disable-dmalloc \
--enable-inline-optimization \
--enable-session \
--with-tsrm-pthreads \
--enable-maintainer-zts \
...
% httpd -V
Server version: Apache/2.2.3-dev Server built: Jun 8 2006 17:00:58 Server's Module Magic Number: 20051115:2 Server loaded: APR 1.2.8-dev, APR-Util 1.2.8-dev Compiled using: APR 1.2.8-dev, APR-Util 1.2.8-dev Architecture: 32-bit Server MPM: Worker
threaded: yes (fixed thread count)
forked: yes (variable process count)
% zend_framework > cd tests
% zend_framework/tests > php Zend/Mime/AllTests.php
Time: 00:00
There was 1 failure:
1) testStreamEncoding(Zend_Mime_PartTest)
failed asserting that <'<?php
/**
- @package Zend_Mime
- @subpackage UnitTests
*/
/**
- Zend_Mime_Part
*/
require_once \'Zend/Mime/Part.php\';
/**
- PHPUnit2 test case
*/
require_once \'PHPUnit2/Framework/TestCase.php\';
/**
- @package Zend_Mime
- @subpackage UnitTests
*/
class Zend_Mime_PartTest extends PHPUnit2_Framework_TestCase
{
/** - MIME part test object
* - @var Zend_Mime_Part
*/
protected $_part = null;
protected $_testText;
protected function setUp()
{ $this->_testText = \'safdsafsaˆlg ˆˆgdˆˆ sdˆjgˆsdjgˆldˆgksdˆgjˆsdfgˆdsjˆgjsdˆgjˆdfsjgˆdsfjˆdjsˆg kjhdkj \' . \'fgaskjfdh gksjhgjkdh gjhfsdghdhgksdjhg\'; $this->part = new Zend_Mime_Part($this->_testText); $this->part->encoding = Zend_Mime::ENCODING_BASE64; $this->part->type = "text/plain"; $this->part->filename = \'test.txt\'; $this->part->disposition = \'attachment\'; $this->part->charset = \'iso8859-1\'; $this->part->id = \'4711\'; } public function testHeaders()
{
$expectedHeaders = array(\'Content-Type: text/plain\',
\'Content-Transfer-Encoding: \' . Zend_Mime::ENCODING_BASE64,
\'Content-Disposition: attachment\',
\'filename="test.txt"\',
\'charset="iso8859-1"\',
\'Content-ID: <4711>\');
$actual = $this->part->getHeaders();
foreach ($expectedHeaders as $expected) {
$this->assertContains($expected, $actual);
}
}
public function testContentEncoding()
{
// Test with base64 encoding
$content = $this->part->getContent();
$this->assertEquals($this->_testText, base64_decode($content));
// Test with quotedPrintable Encoding:
$this->part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE;
$content = $this->part->getContent();
$this->assertEquals($this->_testText, quoted_printable_decode($content));
// Test with 8Bit encoding
$this->part->encoding = Zend_Mime::ENCODING_8BIT;
$content = $this->part->getContent();
$this->assertEquals($this->_testText, $content);
}
public function testStreamEncoding()
{
$testfile = realpath(__FILE__);
$original = file_get_contents($testfile);
// Test Base64
$fp = fopen($testfile,\'rb\');
$this->assertTrue(is_resource($fp));
$part = new Zend_Mime_Part($fp);
$part->encoding = Zend_Mime::ENCODING_BASE64;
$fp2 = $part->getEncodedStream();
$this->assertTrue(is_resource($fp2));
$encoded = stream_get_contents($fp2);
fclose($fp);
$this->assertEquals(base64_decode($encoded),$original);
// test QuotedPrintable
$fp = fopen($testfile,\'rb\');
$this->assertTrue(is_resource($fp));
$part = new Zend_Mime_Part($fp);
$part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE;
$fp2 = $part->getEncodedStream();
$this->assertTrue(is_resource($fp2));
$encoded = stream_get_contents($fp2);
fclose($fp);
$this->assertEquals(quoted_printable_decode($encoded),$original);
}
}
'> is equal to <string:'<?php
/**
* @package Zend_Mime
* @subpackage UnitTests
*/
/**
* Zend_Mime_Part
*/
require_once \'Zend/Mime/Part.php\';
/**
* PHPUnit2 test case
*/
require_once \'PHPUnit2/Framework/TestCase.php\';
/**
* @package Zend_Mime
* @subpackage UnitTests
*/
class Zend_Mime_PartTest extends PHPUnit2_Framework_TestCase
{
/**
* MIME part test object
*
* @var Zend_Mime_Part
*/
protected $_part = null;
protected $_testText;
protected function setUp()
{
$this->_testText = \'safdsafsaˆlg ˆˆgdˆˆ sdˆjgˆsdjgˆldˆgksdˆgjˆsdfgˆdsjˆgjsdˆgjˆdfsjgˆdsfjˆdjsˆg kjhdkj \'
. \'fgaskjfdh gksjhgjkdh gjhfsdghdhgksdjhg\';
$this->part = new Zend_Mime_Part($this->_testText);
$this->part->encoding = Zend_Mime::ENCODING_BASE64;
$this->part->type = "text/plain";
$this->part->filename = \'test.txt\';
$this->part->disposition = \'attachment\';
$this->part->charset = \'iso8859-1\';
$this->part->id = \'4711\';
}
public function testHeaders()
{
$expectedHeaders = array(\'Content-Type: text/plain\',
\'Content-Transfer-Encoding: \' . Zend_Mime::ENCODING_BASE64,
\'Content-Disposition: attachment\',
\'filename="test.txt"\',
\'charset="iso8859-1"\',
\'Content-ID: <4711>\');
$actual = $this->part->getHeaders();
foreach ($expectedHeaders as $expected) { $this->assertContains($expected, $actual); } }
}
public function testContentEncoding()
{ // Test with base64 encoding $content = $this->part->getContent(); $this->assertEquals($this->_testText, base64_decode($content)); // Test with quotedPrintable Encoding: $this->part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE; $content = $this->part->getContent(); $this->assertEquals($this->_testText, quoted_printable_decode($content)); // Test with 8Bit encoding $this->part->encoding = Zend_Mime::ENCODING_8BIT; $content = $this->part->getContent(); $this->assertEquals($this->_testText, $content); } public function testStreamEncoding()
{
$testfile = realpath(_FILE_);
$original = file_get_contents($testfile);
// Test Base64
$fp = fopen($testfile,\'rb\');
$this->assertTrue(is_resource($fp));
$part = new Zend_Mime_Part($fp);
$part->encoding = Zend_Mime::ENCODING_BASE64;
$fp2 = $part->getEncodedStream();
$this->assertTrue(is_resource($fp2));
$encoded = stream_get_contents($fp2);
fclose($fp);
$this->assertEquals(base64_decode($encoded),$original);
// test QuotedPrintable
$fp = fopen($testfile,\'rb\');
$this->assertTrue(is_resource($fp));
$part = new Zend_Mime_Part($fp);
$part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE;
$fp2 = $part->getEncodedStream();
$this->assertTrue(is_resource($fp2));
$encoded = stream_get_contents($fp2);
fclose($fp);
$this->assertEquals(quoted_printable_decode($encoded),$o'>
expected string <<?php
/**
- @package Zend_Mime
- @subpackage UnitTests
*/
/**
- Zend_Mime_Part
*/
require_once 'Zend/Mime/Part.php';
/**
- PHPUnit2 test case
*/
require_once 'PHPUnit2/Framework/TestCase.php';
/**
- @package Zend_Mime
- @subpackage UnitTests
*/
class Zend_Mime_PartTest extends PHPUnit2_Framework_TestCase
{
/** - MIME part test object
* - @var Zend_Mime_Part
*/
protected $_part = null;
protected $_testText;
protected function setUp()
{ $this->_testText = 'safdsafsaˆlg ˆˆgdˆˆ sdˆjgˆsdjgˆldˆgksdˆgjˆsdfgˆdsjˆgjsdˆgjˆdfsjgˆdsfjˆdjsˆg kjhdkj ' . 'fgaskjfdh gksjhgjkdh gjhfsdghdhgksdjhg'; $this->part = new Zend_Mime_Part($this->_testText); $this->part->encoding = Zend_Mime::ENCODING_BASE64; $this->part->type = "text/plain"; $this->part->filename = 'test.txt'; $this->part->disposition = 'attachment'; $this->part->charset = 'iso8859-1'; $this->part->id = '4711'; } public function testHeaders()
{
$expectedHeaders = array('Content-Type: text/plain',
'Content-Transfer-Encoding: ' . Zend_Mime::ENCODING_BASE64,
'Content-Disposition: attachment',
'filename="test.txt"',
'charset="iso8859-1"',
'Content-ID: <4711>');
$actual = $this->part->getHeaders();
foreach ($expectedHeaders as $expected) {
$this->assertContains($expected, $actual);
}
}
public function testContentEncoding()
{
// Test with base64 encoding
$content = $this->part->getContent();
$this->assertEquals($this->_testText, base64_decode($content));
// Test with quotedPrintable Encoding:
$this->part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE;
$content = $this->part->getContent();
$this->assertEquals($this->_testText, quoted_printable_decode($content));
// Test with 8Bit encoding
$this->part->encoding = Zend_Mime::ENCODING_8BIT;
$content = $this->part->getContent();
$this->assertEquals($this->_testText, $content);
}
public function testStreamEncoding()
{
$testfile = realpath(_FILE_);
$original = file_get_contents($testfile);
// Test Base64
$fp = fopen($testfile,'rb');
$this->assertTrue(is_resource($fp));
$part = new Zend_Mime_Part($fp);
$part->encoding = Zend_Mime::ENCODING_BASE64;
$fp2 = $part->getEncodedStream();
$this->assertTrue(is_resource($fp2));
$encoded = stream_get_contents($fp2);
fclose($fp);
$this->assertEquals(base64_decode($encoded),$original);
// test QuotedPrintable
$fp = fopen($testfile,'rb');
$this->assertTrue(is_resource($fp));
$part = new Zend_Mime_Part($fp);
$part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE;
$fp2 = $part->getEncodedStream();
$this->assertTrue(is_resource($fp2));
$encoded = stream_get_contents($fp2);
fclose($fp);
$this->assertEquals(quoted_printable_decode($encoded),$o>
difference < ??????????????????>
got string <<?php
/**
* @package Zend_Mime
* @subpackage UnitTests
*/
/**
* Zend_Mime_Part
*/
require_once 'Zend/Mime/Part.php';
/**
* PHPUnit2 test case
*/
require_once 'PHPUnit2/Framework/TestCase.php';
/**
* @package Zend_Mime
* @subpackage UnitTests
*/
class Zend_Mime_PartTest extends PHPUnit2_Framework_TestCase
{
/**
* MIME part test object
*
* @var Zend_Mime_Part
*/
protected $_part = null;
protected $_testText;
protected function setUp()
{
$this->_testText = 'safdsafsaˆlg ˆˆgdˆˆ sdˆjgˆsdjgˆldˆgksdˆgjˆsdfgˆdsjˆgjsdˆgjˆdfsjgˆdsfjˆdjsˆg kjhdkj '
. 'fgaskjfdh gksjhgjkdh gjhfsdghdhgksdjhg';
$this->part = new Zend_Mime_Part($this->_testText);
$this->part->encoding = Zend_Mime::ENCODING_BASE64;
$this->part->type = "text/plain";
$this->part->filename = 'test.txt';
$this->part->disposition = 'attachment';
$this->part->charset = 'iso8859-1';
$this->part->id = '4711';
}
public function testHeaders()
{
$expectedHeaders = array('Content-Type: text/plain',
'Content-Transfer-Encoding: ' . Zend_Mime::ENCODING_BASE64,
'Content-Disposition: attachment',
'filename="test.txt"',
'charset="iso8859-1"',
'Content-ID: <4711>');
$actual = $this->part->getHeaders();
foreach ($expectedHeaders as $expected) { $this->assertContains($expected, $actual); } }
}
public function testContentEncoding()
{ // Test with base64 encoding $content = $this->part->getContent(); $this->assertEquals($this->_testText, base64_decode($content)); // Test with quotedPrintable Encoding: $this->part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE; $content = $this->part->getContent(); $this->assertEquals($this->_testText, quoted_printable_decode($content)); // Test with 8Bit encoding $this->part->encoding = Zend_Mime::ENCODING_8BIT; $content = $this->part->getContent(); $this->assertEquals($this->_testText, $content); }public function testStreamEncoding()
{ $testfile = realpath(__FILE__); $original = file_get_contents($testfile); // Test Base64 $fp = fopen($testfile,'rb'); $this->assertTrue(is_resource($fp)); $part = new Zend_Mime_Part($fp); $part->encoding = Zend_Mime::ENCODING_BASE64; $fp2 = $part->getEncodedStream(); $this->assertTrue(is_resource($fp2)); $encoded = stream_get_contents($fp2); fclose($fp); $this->assertEquals(base64_decode($encoded),$original); // test QuotedPrintable $fp = fopen($testfile,'rb'); $this->assertTrue(is_resource($fp)); $part = new Zend_Mime_Part($fp); $part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE; $fp2 = $part->getEncodedStream(); $this->assertTrue(is_resource($fp2)); $encoded = stream_get_contents($fp2); fclose($fp); $this->assertEquals(quoted_printable_decode($encoded),$original); }}
>
/webapps/tools/zend_framework/tests/Zend/Mime/PartTest.php:90
/webapps/tools/zend_framework/tests/Zend/Mime/AllTests.php:16
/webapps/tools/zend_framework/tests/Zend/Mime/AllTests.php:31
FAILURES!
Tests: 8, Failures: 1.
w/ ZF svn r650 php 52-dev OSX 10.4.6 upgrade to PHPUnit 300a11 % php Zend/Mime/AllTests.php PHPUnit 3.0.0alpha11 by Sebastian Bergmann. ..F..... Time: 00:00 There was 1 failure: 1) testStreamEncoding(Zend_Mime_PartTest) failed asserting that <'<?php /** * @package Zend_Mime * @subpackage UnitTests */ /** * Zend_Mime_Part */ require_once \'Zend/Mime/Part.php\'; /** * PHPUnit2 test case */ require_once \'PHPUnit2/Framework/TestCase.php\'; /** * @package Zend_Mime * @subpackage UnitTests */ class Zend_Mime_PartTest extends PHPUnit2_Framework_TestCase { /** * MIME part test object * * @var Zend_Mime_Part */ protected $_part = null; protected $_testText; protected function setUp() { $this->_testText = \'safdsafsaˆlg ˆˆgdˆˆ sdˆjgˆsdjgˆldˆgksdˆgjˆsdfgˆdsjˆgjsdˆgjˆdfsjgˆdsfjˆdjsˆg kjhdkj \' . \'fgaskjfdh gksjhgjkdh gjhfsdghdhgksdjhg\'; $this->part = new Zend_Mime_Part($this->_testText); $this->part->encoding = Zend_Mime::ENCODING_BASE64; $this->part->type = "text/plain"; $this->part->filename = \'test.txt\'; $this->part->disposition = \'attachment\'; $this->part->charset = \'iso8859-1\'; $this->part->id = \'4711\'; } public function testHeaders() { $expectedHeaders = array(\'Content-Type: text/plain\', \'Content-Transfer-Encoding: \' . Zend_Mime::ENCODING_BASE64, \'Content-Disposition: attachment\', \'filename="test.txt"\', \'charset="iso8859-1"\', \'Content-ID: <4711>\'); $actual = $this->part->getHeaders(); foreach ($expectedHeaders as $expected) { $this->assertContains($expected, $actual); } } public function testContentEncoding() { // Test with base64 encoding $content = $this->part->getContent(); $this->assertEquals($this->_testText, base64_decode($content)); // Test with quotedPrintable Encoding: $this->part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE; $content = $this->part->getContent(); $this->assertEquals($this->_testText, quoted_printable_decode($content)); // Test with 8Bit encoding $this->part->encoding = Zend_Mime::ENCODING_8BIT; $content = $this->part->getContent(); $this->assertEquals($this->_testText, $content); } public function testStreamEncoding() { $testfile = realpath(__FILE__); $original = file_get_contents($testfile); // Test Base64 $fp = fopen($testfile,\'rb\'); $this->assertTrue(is_resource($fp)); $part = new Zend_Mime_Part($fp); $part->encoding = Zend_Mime::ENCODING_BASE64; $fp2 = $part->getEncodedStream(); $this->assertTrue(is_resource($fp2)); $encoded = stream_get_contents($fp2); fclose($fp); $this->assertEquals(base64_decode($encoded),$original); // test QuotedPrintable $fp = fopen($testfile,\'rb\'); $this->assertTrue(is_resource($fp)); $part = new Zend_Mime_Part($fp); $part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE; $fp2 = $part->getEncodedStream(); $this->assertTrue(is_resource($fp2)); $encoded = stream_get_contents($fp2); fclose($fp); $this->assertEquals(quoted_printable_decode($encoded),$original); } } '> is equal to <string:'<?php /** * @package Zend_Mime * @subpackage UnitTests */ /** * Zend_Mime_Part */ require_once \'Zend/Mime/Part.php\'; /** * PHPUnit2 test case */ require_once \'PHPUnit2/Framework/TestCase.php\'; /** * @package Zend_Mime * @subpackage UnitTests */ class Zend_Mime_PartTest extends PHPUnit2_Framework_TestCase { /** * MIME part test object * * @var Zend_Mime_Part */ protected $_part = null; protected $_testText; protected function setUp() { $this->_testText = \'safdsafsaˆlg ˆˆgdˆˆ sdˆjgˆsdjgˆldˆgksdˆgjˆsdfgˆdsjˆgjsdˆgjˆdfsjgˆdsfjˆdjsˆg kjhdkj \' . \'fgaskjfdh gksjhgjkdh gjhfsdghdhgksdjhg\'; $this->part = new Zend_Mime_Part($this->_testText); $this->part->encoding = Zend_Mime::ENCODING_BASE64; $this->part->type = "text/plain"; $this->part->filename = \'test.txt\'; $this->part->disposition = \'attachment\'; $this->part->charset = \'iso8859-1\'; $this->part->id = \'4711\'; } public function testHeaders() { $expectedHeaders = array(\'Content-Type: text/plain\', \'Content-Transfer-Encoding: \' . Zend_Mime::ENCODING_BASE64, \'Content-Disposition: attachment\', \'filename="test.txt"\', \'charset="iso8859-1"\', \'Content-ID: <4711>\'); $actual = $this->part->getHeaders(); foreach ($expectedHeaders as $expected) { $this->assertContains($expected, $actual); } } public function testContentEncoding() { // Test with base64 encoding $content = $this->part->getContent(); $this->assertEquals($this->_testText, base64_decode($content)); // Test with quotedPrintable Encoding: $this->part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE; $content = $this->part->getContent(); $this->assertEquals($this->_testText, quoted_printable_decode($content)); // Test with 8Bit encoding $this->part->encoding = Zend_Mime::ENCODING_8BIT; $content = $this->part->getContent(); $this->assertEquals($this->_testText, $content); } public function testStreamEncoding() { $testfile = realpath(__FILE__); $original = file_get_contents($testfile); // Test Base64 $fp = fopen($testfile,\'rb\'); $this->assertTrue(is_resource($fp)); $part = new Zend_Mime_Part($fp); $part->encoding = Zend_Mime::ENCODING_BASE64; $fp2 = $part->getEncodedStream(); $this->assertTrue(is_resource($fp2)); $encoded = stream_get_contents($fp2); fclose($fp); $this->assertEquals(base64_decode($encoded),$original); // test QuotedPrintable $fp = fopen($testfile,\'rb\'); $this->assertTrue(is_resource($fp)); $part = new Zend_Mime_Part($fp); $part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE; $fp2 = $part->getEncodedStream(); $this->assertTrue(is_resource($fp2)); $encoded = stream_get_contents($fp2); fclose($fp); $this->assertEquals(quoted_printable_decode($encoded),$o'> expected string <<?php /** * @package Zend_Mime * @subpackage UnitTests */ /** * Zend_Mime_Part */ require_once 'Zend/Mime/Part.php'; /** * PHPUnit2 test case */ require_once 'PHPUnit2/Framework/TestCase.php'; /** * @package Zend_Mime * @subpackage UnitTests */ class Zend_Mime_PartTest extends PHPUnit2_Framework_TestCase { /** * MIME part test object * * @var Zend_Mime_Part */ protected $_part = null; protected $_testText; protected function setUp() { $this->_testText = 'safdsafsaˆlg ˆˆgdˆˆ sdˆjgˆsdjgˆldˆgksdˆgjˆsdfgˆdsjˆgjsdˆgjˆdfsjgˆdsfjˆdjsˆg kjhdkj ' . 'fgaskjfdh gksjhgjkdh gjhfsdghdhgksdjhg'; $this->part = new Zend_Mime_Part($this->_testText); $this->part->encoding = Zend_Mime::ENCODING_BASE64; $this->part->type = "text/plain"; $this->part->filename = 'test.txt'; $this->part->disposition = 'attachment'; $this->part->charset = 'iso8859-1'; $this->part->id = '4711'; } public function testHeaders() { $expectedHeaders = array('Content-Type: text/plain', 'Content-Transfer-Encoding: ' . Zend_Mime::ENCODING_BASE64, 'Content-Disposition: attachment', 'filename="test.txt"', 'charset="iso8859-1"', 'Content-ID: <4711>'); $actual = $this->part->getHeaders(); foreach ($expectedHeaders as $expected) { $this->assertContains($expected, $actual); } } public function testContentEncoding() { // Test with base64 encoding $content = $this->part->getContent(); $this->assertEquals($this->_testText, base64_decode($content)); // Test with quotedPrintable Encoding: $this->part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE; $content = $this->part->getContent(); $this->assertEquals($this->_testText, quoted_printable_decode($content)); // Test with 8Bit encoding $this->part->encoding = Zend_Mime::ENCODING_8BIT; $content = $this->part->getContent(); $this->assertEquals($this->_testText, $content); } public function testStreamEncoding() { $testfile = realpath(__FILE__); $original = file_get_contents($testfile); // Test Base64 $fp = fopen($testfile,'rb'); $this->assertTrue(is_resource($fp)); $part = new Zend_Mime_Part($fp); $part->encoding = Zend_Mime::ENCODING_BASE64; $fp2 = $part->getEncodedStream(); $this->assertTrue(is_resource($fp2)); $encoded = stream_get_contents($fp2); fclose($fp); $this->assertEquals(base64_decode($encoded),$original); // test QuotedPrintable $fp = fopen($testfile,'rb'); $this->assertTrue(is_resource($fp)); $part = new Zend_Mime_Part($fp); $part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE; $fp2 = $part->getEncodedStream(); $this->assertTrue(is_resource($fp2)); $encoded = stream_get_contents($fp2); fclose($fp); $this->assertEquals(quoted_printable_decode($encoded),$o> difference < ??????????????????> got string <<?php /** * @package Zend_Mime * @subpackage UnitTests */ /** * Zend_Mime_Part */ require_once 'Zend/Mime/Part.php'; /** * PHPUnit2 test case */ require_once 'PHPUnit2/Framework/TestCase.php'; /** * @package Zend_Mime * @subpackage UnitTests */ class Zend_Mime_PartTest extends PHPUnit2_Framework_TestCase { /** * MIME part test object * * @var Zend_Mime_Part */ protected $_part = null; protected $_testText; protected function setUp() { $this->_testText = 'safdsafsaˆlg ˆˆgdˆˆ sdˆjgˆsdjgˆldˆgksdˆgjˆsdfgˆdsjˆgjsdˆgjˆdfsjgˆdsfjˆdjsˆg kjhdkj ' . 'fgaskjfdh gksjhgjkdh gjhfsdghdhgksdjhg'; $this->part = new Zend_Mime_Part($this->_testText); $this->part->encoding = Zend_Mime::ENCODING_BASE64; $this->part->type = "text/plain"; $this->part->filename = 'test.txt'; $this->part->disposition = 'attachment'; $this->part->charset = 'iso8859-1'; $this->part->id = '4711'; } public function testHeaders() { $expectedHeaders = array('Content-Type: text/plain', 'Content-Transfer-Encoding: ' . Zend_Mime::ENCODING_BASE64, 'Content-Disposition: attachment', 'filename="test.txt"', 'charset="iso8859-1"', 'Content-ID: <4711>'); $actual = $this->part->getHeaders(); foreach ($expectedHeaders as $expected) { $this->assertContains($expected, $actual); } } public function testContentEncoding() { // Test with base64 encoding $content = $this->part->getContent(); $this->assertEquals($this->_testText, base64_decode($content)); // Test with quotedPrintable Encoding: $this->part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE; $content = $this->part->getContent(); $this->assertEquals($this->_testText, quoted_printable_decode($content)); // Test with 8Bit encoding $this->part->encoding = Zend_Mime::ENCODING_8BIT; $content = $this->part->getContent(); $this->assertEquals($this->_testText, $content); } public function testStreamEncoding() { $testfile = realpath(__FILE__); $original = file_get_contents($testfile); // Test Base64 $fp = fopen($testfile,'rb'); $this->assertTrue(is_resource($fp)); $part = new Zend_Mime_Part($fp); $part->encoding = Zend_Mime::ENCODING_BASE64; $fp2 = $part->getEncodedStream(); $this->assertTrue(is_resource($fp2)); $encoded = stream_get_contents($fp2); fclose($fp); $this->assertEquals(base64_decode($encoded),$original); // test QuotedPrintable $fp = fopen($testfile,'rb'); $this->assertTrue(is_resource($fp)); $part = new Zend_Mime_Part($fp); $part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE; $fp2 = $part->getEncodedStream(); $this->assertTrue(is_resource($fp2)); $encoded = stream_get_contents($fp2); fclose($fp); $this->assertEquals(quoted_printable_decode($encoded),$original); } } > /webapps/tools/zend_framework/tests/Zend/Mime/PartTest.php:90 /webapps/tools/zend_framework/tests/Zend/Mime/AllTests.php:16 /webapps/tools/zend_framework/tests/Zend/Mime/AllTests.php:31 FAILURES! Tests: 8, Failures: 1.w/ ZF svn r650 php 52-dev OSX 10.4.6 upgrade to PHPUnit 300a11 % php Zend/Mime/AllTests.php PHPUnit 3.0.0alpha11 by Sebastian Bergmann. ..F..... Time: 00:00 There was 1 failure: 1) testStreamEncoding(Zend_Mime_PartTest) failed asserting that <'<?php /** * @package Zend_Mime * @subpackage UnitTests */ /** * Zend_Mime_Part */ require_once \'Zend/Mime/Part.php\'; /** * PHPUnit2 test case */ require_once \'PHPUnit2/Framework/TestCase.php\'; /** * @package Zend_Mime * @subpackage UnitTests */ class Zend_Mime_PartTest extends PHPUnit2_Framework_TestCase { /** * MIME part test object * * @var Zend_Mime_Part */ protected $_part = null; protected $_testText; protected function setUp() { $this->_testText = \'safdsafsaˆlg ˆˆgdˆˆ sdˆjgˆsdjgˆldˆgksdˆgjˆsdfgˆdsjˆgjsdˆgjˆdfsjgˆdsfjˆdjsˆg kjhdkj \' . \'fgaskjfdh gksjhgjkdh gjhfsdghdhgksdjhg\'; $this->part = new Zend_Mime_Part($this->_testText); $this->part->encoding = Zend_Mime::ENCODING_BASE64; $this->part->type = "text/plain"; $this->part->filename = \'test.txt\'; $this->part->disposition = \'attachment\'; $this->part->charset = \'iso8859-1\'; $this->part->id = \'4711\'; } public function testHeaders() { $expectedHeaders = array(\'Content-Type: text/plain\', \'Content-Transfer-Encoding: \' . Zend_Mime::ENCODING_BASE64, \'Content-Disposition: attachment\', \'filename="test.txt"\', \'charset="iso8859-1"\', \'Content-ID: <4711>\'); $actual = $this->part->getHeaders(); foreach ($expectedHeaders as $expected) { $this->assertContains($expected, $actual); } } public function testContentEncoding() { // Test with base64 encoding $content = $this->part->getContent(); $this->assertEquals($this->_testText, base64_decode($content)); // Test with quotedPrintable Encoding: $this->part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE; $content = $this->part->getContent(); $this->assertEquals($this->_testText, quoted_printable_decode($content)); // Test with 8Bit encoding $this->part->encoding = Zend_Mime::ENCODING_8BIT; $content = $this->part->getContent(); $this->assertEquals($this->_testText, $content); } public function testStreamEncoding() { $testfile = realpath(__FILE__); $original = file_get_contents($testfile); // Test Base64 $fp = fopen($testfile,\'rb\'); $this->assertTrue(is_resource($fp)); $part = new Zend_Mime_Part($fp); $part->encoding = Zend_Mime::ENCODING_BASE64; $fp2 = $part->getEncodedStream(); $this->assertTrue(is_resource($fp2)); $encoded = stream_get_contents($fp2); fclose($fp); $this->assertEquals(base64_decode($encoded),$original); // test QuotedPrintable $fp = fopen($testfile,\'rb\'); $this->assertTrue(is_resource($fp)); $part = new Zend_Mime_Part($fp); $part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE; $fp2 = $part->getEncodedStream(); $this->assertTrue(is_resource($fp2)); $encoded = stream_get_contents($fp2); fclose($fp); $this->assertEquals(quoted_printable_decode($encoded),$original); } } '> is equal to <string:'<?php /** * @package Zend_Mime * @subpackage UnitTests */ /** * Zend_Mime_Part */ require_once \'Zend/Mime/Part.php\'; /** * PHPUnit2 test case */ require_once \'PHPUnit2/Framework/TestCase.php\'; /** * @package Zend_Mime * @subpackage UnitTests */ class Zend_Mime_PartTest extends PHPUnit2_Framework_TestCase { /** * MIME part test object * * @var Zend_Mime_Part */ protected $_part = null; protected $_testText; protected function setUp() { $this->_testText = \'safdsafsaˆlg ˆˆgdˆˆ sdˆjgˆsdjgˆldˆgksdˆgjˆsdfgˆdsjˆgjsdˆgjˆdfsjgˆdsfjˆdjsˆg kjhdkj \' . \'fgaskjfdh gksjhgjkdh gjhfsdghdhgksdjhg\'; $this->part = new Zend_Mime_Part($this->_testText); $this->part->encoding = Zend_Mime::ENCODING_BASE64; $this->part->type = "text/plain"; $this->part->filename = \'test.txt\'; $this->part->disposition = \'attachment\'; $this->part->charset = \'iso8859-1\'; $this->part->id = \'4711\'; } public function testHeaders() { $expectedHeaders = array(\'Content-Type: text/plain\', \'Content-Transfer-Encoding: \' . Zend_Mime::ENCODING_BASE64, \'Content-Disposition: attachment\', \'filename="test.txt"\', \'charset="iso8859-1"\', \'Content-ID: <4711>\'); $actual = $this->part->getHeaders(); foreach ($expectedHeaders as $expected) { $this->assertContains($expected, $actual); } } public function testContentEncoding() { // Test with base64 encoding $content = $this->part->getContent(); $this->assertEquals($this->_testText, base64_decode($content)); // Test with quotedPrintable Encoding: $this->part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE; $content = $this->part->getContent(); $this->assertEquals($this->_testText, quoted_printable_decode($content)); // Test with 8Bit encoding $this->part->encoding = Zend_Mime::ENCODING_8BIT; $content = $this->part->getContent(); $this->assertEquals($this->_testText, $content); } public function testStreamEncoding() { $testfile = realpath(__FILE__); $original = file_get_contents($testfile); // Test Base64 $fp = fopen($testfile,\'rb\'); $this->assertTrue(is_resource($fp)); $part = new Zend_Mime_Part($fp); $part->encoding = Zend_Mime::ENCODING_BASE64; $fp2 = $part->getEncodedStream(); $this->assertTrue(is_resource($fp2)); $encoded = stream_get_contents($fp2); fclose($fp); $this->assertEquals(base64_decode($encoded),$original); // test QuotedPrintable $fp = fopen($testfile,\'rb\'); $this->assertTrue(is_resource($fp)); $part = new Zend_Mime_Part($fp); $part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE; $fp2 = $part->getEncodedStream(); $this->assertTrue(is_resource($fp2)); $encoded = stream_get_contents($fp2); fclose($fp); $this->assertEquals(quoted_printable_decode($encoded),$o'> expected string <<?php /** * @package Zend_Mime * @subpackage UnitTests */ /** * Zend_Mime_Part */ require_once 'Zend/Mime/Part.php'; /** * PHPUnit2 test case */ require_once 'PHPUnit2/Framework/TestCase.php'; /** * @package Zend_Mime * @subpackage UnitTests */ class Zend_Mime_PartTest extends PHPUnit2_Framework_TestCase { /** * MIME part test object * * @var Zend_Mime_Part */ protected $_part = null; protected $_testText; protected function setUp() { $this->_testText = 'safdsafsaˆlg ˆˆgdˆˆ sdˆjgˆsdjgˆldˆgksdˆgjˆsdfgˆdsjˆgjsdˆgjˆdfsjgˆdsfjˆdjsˆg kjhdkj ' . 'fgaskjfdh gksjhgjkdh gjhfsdghdhgksdjhg'; $this->part = new Zend_Mime_Part($this->_testText); $this->part->encoding = Zend_Mime::ENCODING_BASE64; $this->part->type = "text/plain"; $this->part->filename = 'test.txt'; $this->part->disposition = 'attachment'; $this->part->charset = 'iso8859-1'; $this->part->id = '4711'; } public function testHeaders() { $expectedHeaders = array('Content-Type: text/plain', 'Content-Transfer-Encoding: ' . Zend_Mime::ENCODING_BASE64, 'Content-Disposition: attachment', 'filename="test.txt"', 'charset="iso8859-1"', 'Content-ID: <4711>'); $actual = $this->part->getHeaders(); foreach ($expectedHeaders as $expected) { $this->assertContains($expected, $actual); } } public function testContentEncoding() { // Test with base64 encoding $content = $this->part->getContent(); $this->assertEquals($this->_testText, base64_decode($content)); // Test with quotedPrintable Encoding: $this->part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE; $content = $this->part->getContent(); $this->assertEquals($this->_testText, quoted_printable_decode($content)); // Test with 8Bit encoding $this->part->encoding = Zend_Mime::ENCODING_8BIT; $content = $this->part->getContent(); $this->assertEquals($this->_testText, $content); } public function testStreamEncoding() { $testfile = realpath(__FILE__); $original = file_get_contents($testfile); // Test Base64 $fp = fopen($testfile,'rb'); $this->assertTrue(is_resource($fp)); $part = new Zend_Mime_Part($fp); $part->encoding = Zend_Mime::ENCODING_BASE64; $fp2 = $part->getEncodedStream(); $this->assertTrue(is_resource($fp2)); $encoded = stream_get_contents($fp2); fclose($fp); $this->assertEquals(base64_decode($encoded),$original); // test QuotedPrintable $fp = fopen($testfile,'rb'); $this->assertTrue(is_resource($fp)); $part = new Zend_Mime_Part($fp); $part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE; $fp2 = $part->getEncodedStream(); $this->assertTrue(is_resource($fp2)); $encoded = stream_get_contents($fp2); fclose($fp); $this->assertEquals(quoted_printable_decode($encoded),$o> difference < ??????????????????> got string <<?php /** * @package Zend_Mime * @subpackage UnitTests */ /** * Zend_Mime_Part */ require_once 'Zend/Mime/Part.php'; /** * PHPUnit2 test case */ require_once 'PHPUnit2/Framework/TestCase.php'; /** * @package Zend_Mime * @subpackage UnitTests */ class Zend_Mime_PartTest extends PHPUnit2_Framework_TestCase { /** * MIME part test object * * @var Zend_Mime_Part */ protected $_part = null; protected $_testText; protected function setUp() { $this->_testText = 'safdsafsaˆlg ˆˆgdˆˆ sdˆjgˆsdjgˆldˆgksdˆgjˆsdfgˆdsjˆgjsdˆgjˆdfsjgˆdsfjˆdjsˆg kjhdkj ' . 'fgaskjfdh gksjhgjkdh gjhfsdghdhgksdjhg'; $this->part = new Zend_Mime_Part($this->_testText); $this->part->encoding = Zend_Mime::ENCODING_BASE64; $this->part->type = "text/plain"; $this->part->filename = 'test.txt'; $this->part->disposition = 'attachment'; $this->part->charset = 'iso8859-1'; $this->part->id = '4711'; } public function testHeaders() { $expectedHeaders = array('Content-Type: text/plain', 'Content-Transfer-Encoding: ' . Zend_Mime::ENCODING_BASE64, 'Content-Disposition: attachment', 'filename="test.txt"', 'charset="iso8859-1"', 'Content-ID: <4711>'); $actual = $this->part->getHeaders(); foreach ($expectedHeaders as $expected) { $this->assertContains($expected, $actual); } } public function testContentEncoding() { // Test with base64 encoding $content = $this->part->getContent(); $this->assertEquals($this->_testText, base64_decode($content)); // Test with quotedPrintable Encoding: $this->part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE; $content = $this->part->getContent(); $this->assertEquals($this->_testText, quoted_printable_decode($content)); // Test with 8Bit encoding $this->part->encoding = Zend_Mime::ENCODING_8BIT; $content = $this->part->getContent(); $this->assertEquals($this->_testText, $content); } public function testStreamEncoding() { $testfile = realpath(__FILE__); $original = file_get_contents($testfile); // Test Base64 $fp = fopen($testfile,'rb'); $this->assertTrue(is_resource($fp)); $part = new Zend_Mime_Part($fp); $part->encoding = Zend_Mime::ENCODING_BASE64; $fp2 = $part->getEncodedStream(); $this->assertTrue(is_resource($fp2)); $encoded = stream_get_contents($fp2); fclose($fp); $this->assertEquals(base64_decode($encoded),$original); // test QuotedPrintable $fp = fopen($testfile,'rb'); $this->assertTrue(is_resource($fp)); $part = new Zend_Mime_Part($fp); $part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE; $fp2 = $part->getEncodedStream(); $this->assertTrue(is_resource($fp2)); $encoded = stream_get_contents($fp2); fclose($fp); $this->assertEquals(quoted_printable_decode($encoded),$original); } } > /webapps/tools/zend_framework/tests/Zend/Mime/PartTest.php:90 /webapps/tools/zend_framework/tests/Zend/Mime/AllTests.php:16 /webapps/tools/zend_framework/tests/Zend/Mime/AllTests.php:31 FAILURES! Tests: 8, Failures: 1.