Created
May 21, 2012 05:38
-
-
Save k1LoW/2760672 to your computer and use it in GitHub Desktop.
CakeEmailTest.php.diff
This file contains hidden or 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
| diff --git a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php | |
| index 6d429af..82acb72 100644 | |
| --- a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php | |
| +++ b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php | |
| @@ -1451,6 +1451,54 @@ class CakeEmailTest extends CakeTestCase { | |
| $this->assertContains(mb_convert_encoding('ってテーブルを作ってやってたらう','ISO-2022-JP'), $result['message']); | |
| } | |
| +/** | |
| + * Tests that the body is encoded using the configured charset | |
| + * | |
| + * @return void | |
| + */ | |
| + public function testBodyEncodingIso2022Jp() { | |
| + $this->skipIf(!function_exists('mb_convert_encoding')); | |
| + $email = new CakeEmail(array( | |
| + 'charset' => 'iso-2022-jp', | |
| + 'headerCharset' => 'iso-2022-jp', | |
| + 'transport' => 'Debug' | |
| + )); | |
| + $email->subject('あれ?もしかしての前と'); | |
| + $headers = $email->getHeaders(array('subject')); | |
| + $expected = "?ISO-2022-JP?B?GyRCJCIkbCEpJGIkNyQrJDckRiROQTAkSBsoQg==?="; | |
| + $this->assertContains($expected, $headers['Subject']); | |
| + | |
| + $email->to('someone@example.com')->from('someone@example.com'); | |
| + $result = $email->send('①㈱'); | |
| + $this->assertTextContains("Content-Type: text/plain; charset=iso-2022-jp", $result['headers']); | |
| + $this->assertTextNotContains("Content-Type: text/plain; charset=iso-2022-jp-ms", $result['headers']); // not charset=iso-2022-jp-ms | |
| + $this->assertTextNotContains(mb_convert_encoding('①㈱','ISO-2022-JP-MS'), $result['message']); | |
| + } | |
| + | |
| +/** | |
| + * Tests that the body is encoded using the configured charset | |
| + * | |
| + * @return void | |
| + */ | |
| + public function testBodyEncodingIso2022JpMs() { | |
| + $this->skipIf(!function_exists('mb_convert_encoding')); | |
| + $email = new CakeEmail(array( | |
| + 'charset' => 'iso-2022-jp-ms', | |
| + 'headerCharset' => 'iso-2022-jp-ms', | |
| + 'transport' => 'Debug' | |
| + )); | |
| + $email->subject('あれ?もしかしての前と'); | |
| + $headers = $email->getHeaders(array('subject')); | |
| + $expected = "?ISO-2022-JP?B?GyRCJCIkbCEpJGIkNyQrJDckRiROQTAkSBsoQg==?="; | |
| + $this->assertContains($expected, $headers['Subject']); | |
| + | |
| + $email->to('someone@example.com')->from('someone@example.com'); | |
| + $result = $email->send('①㈱'); | |
| + $this->assertTextContains("Content-Type: text/plain; charset=iso-2022-jp", $result['headers']); | |
| + $this->assertTextNotContains("Content-Type: text/plain; charset=iso-2022-jp-ms", $result['headers']); // not charset=iso-2022-jp-ms | |
| + $this->assertContains(mb_convert_encoding('①㈱','ISO-2022-JP-MS'), $result['message']); | |
| + } | |
| + | |
| protected function _checkContentTransferEncoding($message, $charset) { | |
| $boundary = '--alt-' . $this->CakeEmail->getBoundary(); | |
| $result['text'] = false; |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
testBodyEncodingIso2022JpMs() line 53 Failed...