This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into rfc/escaper
- Loading branch information
54 parents
af29b04
+
b12ad9d
+
8eb23ea
+
52feefb
+
972a9a6
+
212de55
+
2866041
+
7d1f90d
+
1f5cb72
+
221c254
+
d4f9d25
+
3b0e0d4
+
d488887
+
3c450c0
+
964d943
+
679904a
+
d7eb727
+
ea05ef8
+
431fead
+
fd64604
+
3581ced
+
c0932a7
+
41e40fd
+
3f58aba
+
e4adfe2
+
5098e2a
+
78fb9c8
+
97b778e
+
e99f479
+
b48227e
+
fc92b9d
+
d5f6e5e
+
4794336
+
1daeb27
+
c2a004d
+
1b82450
+
3e3dc89
+
861a016
+
86fe89b
+
935ccef
+
cb90274
+
58baa5d
+
e14016b
+
f4de487
+
4f34d57
+
0dcd117
+
54c204b
+
3022d9e
+
0227f1f
+
56bcb11
+
b4afbfa
+
736c546
+
6b6568d
+
8286d5b
commit 23843e6
Showing
9 changed files
with
25 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,13 +19,9 @@ | |
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
/** | ||
* @namespace | ||
*/ | ||
namespace Zend; | ||
use Zend\Mime; | ||
use Zend\Mail; | ||
namespace ZendTest\Mime; | ||
|
||
use Zend\Mime; | ||
|
||
/** | ||
* @category Zend | ||
|
@@ -39,6 +35,7 @@ class MimeTest extends \PHPUnit_Framework_TestCase | |
{ | ||
/** | ||
* Stores the original set timezone | ||
* | ||
* @var string | ||
*/ | ||
private $_originaltimezone; | ||
|
@@ -52,7 +49,7 @@ public function setUp() | |
} | ||
|
||
/** | ||
* Teardown environment | ||
* Tear down environment | ||
*/ | ||
public function tearDown() | ||
{ | ||
|
@@ -68,7 +65,7 @@ public function testBoundary() | |
|
||
// check instantiating with arbitrary boundary string | ||
$myBoundary = 'mySpecificBoundary'; | ||
$m3 = new Mime\Mime($myBoundary); | ||
$m3 = new Mime\Mime($myBoundary); | ||
$this->assertEquals($m3->boundary(), $myBoundary); | ||
|
||
} | ||
|
@@ -105,25 +102,13 @@ public function testBase64() | |
|
||
public function testZf1058WhitespaceAtEndOfBodyCausesInfiniteLoop() | ||
{ | ||
// Set timezone to avoid "date(): It is not safe to rely on the system's timezone settings." | ||
// message. | ||
date_default_timezone_set('GMT'); | ||
|
||
$mail = new \Zend\Mail\Mail(); | ||
$mail->setSubject('my subject'); | ||
$mail->setBodyText("my body\r\n\r\n...after two newlines\r\n "); | ||
$mail->setFrom('[email protected]'); | ||
$mail->addTo('[email protected]'); | ||
|
||
// test with generic transport | ||
$mock = new SendmailTransportMock(); | ||
$mail->send($mock); | ||
$body = quoted_printable_decode($mock->body); | ||
$this->assertContains("my body\r\n\r\n...after two newlines", $body, $body); | ||
$text = "my body\r\n\r\n...after two newlines\r\n "; | ||
$result = quoted_printable_decode(Mime\Mime::encodeQuotedPrintable($text)); | ||
$this->assertContains("my body\r\n\r\n...after two newlines", $result, $result); | ||
} | ||
|
||
/** | ||
* @group ZF-1688 | ||
* @group ZF-1688 | ||
* @dataProvider dataTestEncodeMailHeaderQuotedPrintable | ||
*/ | ||
public function testEncodeMailHeaderQuotedPrintable($str, $charset, $result) | ||
|
@@ -145,7 +130,7 @@ public static function dataTestEncodeMailHeaderQuotedPrintable() | |
} | ||
|
||
/** | ||
* @group ZF-1688 | ||
* @group ZF-1688 | ||
* @dataProvider dataTestEncodeMailHeaderBase64 | ||
*/ | ||
public function testEncodeMailHeaderBase64($str, $charset, $result) | ||
|
@@ -170,39 +155,16 @@ public function testLineLengthInQuotedPrintableHeaderEncoding() | |
{ | ||
$subject = "Alle meine Entchen schwimmen in dem See, schwimmen in dem See, Köpfchen in das Wasser, Schwänzchen in die Höh!"; | ||
$encoded = Mime\Mime::encodeQuotedPrintableHeader($subject, "UTF-8", 100); | ||
foreach(explode(Mime\Mime::LINEEND, $encoded) AS $line ) { | ||
if(strlen($line) > 100) { | ||
$this->fail("Line '".$line."' is ".strlen($line)." chars long, only 100 allowed."); | ||
foreach (explode(Mime\Mime::LINEEND, $encoded) AS $line) { | ||
if (strlen($line) > 100) { | ||
$this->fail("Line '" . $line . "' is " . strlen($line) . " chars long, only 100 allowed."); | ||
} | ||
} | ||
$encoded = Mime\Mime::encodeQuotedPrintableHeader($subject, "UTF-8", 40); | ||
foreach(explode(Mime\Mime::LINEEND, $encoded) AS $line ) { | ||
if(strlen($line) > 40) { | ||
$this->fail("Line '".$line."' is ".strlen($line)." chars long, only 40 allowed."); | ||
foreach (explode(Mime\Mime::LINEEND, $encoded) AS $line) { | ||
if (strlen($line) > 40) { | ||
$this->fail("Line '" . $line . "' is " . strlen($line) . " chars long, only 40 allowed."); | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
/** | ||
* Mock mail transport class for testing Sendmail transport | ||
*/ | ||
class SendmailTransportMock extends Mail\Transport\Sendmail | ||
{ | ||
/** | ||
* @var Zend_Mail | ||
*/ | ||
public $mail = null; | ||
public $from = null; | ||
public $subject = null; | ||
public $called = false; | ||
|
||
public function _sendMail() | ||
{ | ||
$this->mail = $this->_mail; | ||
$this->from = $this->_mail->getFrom(); | ||
$this->subject = $this->_mail->getSubject(); | ||
$this->called = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters