forked from ddeboer/imap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
34 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
use Ddeboer\Imap\Exception\InvalidDateHeaderException; | ||
use Ddeboer\Imap\Exception\MessageDoesNotExistException; | ||
use Ddeboer\Imap\Exception\UnsupportedCharsetException; | ||
use Ddeboer\Imap\Mailbox; | ||
use Ddeboer\Imap\Message; | ||
use Ddeboer\Imap\Message\EmailAddress; | ||
use Ddeboer\Imap\Message\Parameters; | ||
|
@@ -39,20 +40,24 @@ final class MessageTest extends AbstractTest | |
]; | ||
|
||
private static $charsets = [ | ||
'ASCII' => '! "#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~', | ||
'GB18030' => " 、。〃々〆〇〈〉《》「」『』【】〒〓〔〕〖〗〝〞〡〢〣〤〥〦〧〨〩〾一\u{200b}丁\u{200b}丂踰\u{200b}踱\u{200b}踲\u{200b}", | ||
'ISO-8859-6' => 'ءآأؤإئابةتثجحخدذرزسشصضطظعغـفقكلمنهوىي', | ||
'ISO-8859-7' => 'ΆΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟ2ΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ', | ||
'SJIS' => '。「」、・ヲァィゥェォャュョッBーアイウエオカキクケコサシスセソCタチツテトナニヌネノハヒフヘホマDミムメモヤユヨラリルレロワン゙゚', | ||
'UTF-8' => '€✔', | ||
'ASCII' => '! "#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~', | ||
'GB18030' => " 、。〃々〆〇〈〉《》「」『』【】〒〓〔〕〖〗〝〞〡〢〣〤〥〦〧〨〩〾一\u{200b}丁\u{200b}丂踰\u{200b}踱\u{200b}踲\u{200b}", | ||
'ISO-8859-6' => 'ءآأؤإئابةتثجحخدذرزسشصضطظعغـفقكلمنهوىي', | ||
'ISO-8859-7' => 'ΆΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟ2ΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ', | ||
'SJIS' => '。「」、・ヲァィゥェォャュョッBーアイウエオカキクケコサシスセソCタチツテトナニヌネノハヒフヘホマDミムメモヤユヨラリルレロワン゙゚', | ||
'UTF-8' => '€✔', | ||
'Windows-1251' => 'ЂЃѓЉЊЌЋЏђљњќћџЎўЈҐЁЄЇІіґёєјЅѕїАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя', | ||
'Windows-1252' => 'ƒŠŒŽšœžŸªºÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ', | ||
]; | ||
|
||
private static $iconvOnlyCharsets = [ | ||
'macintosh' => '†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈«»…ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ', | ||
'macintosh' => '†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈«»…ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ', | ||
'Windows-1250' => 'ŚŤŹśťźˇ˘ŁĄŞŻ˛łąşĽ˝ľż', | ||
]; | ||
/** | ||
* @var Mailbox | ||
*/ | ||
protected $mailbox; | ||
|
||
protected function setUp() | ||
{ | ||
|
@@ -65,7 +70,7 @@ public function testCustomNonExistentMessageFetch() | |
$messageNumber = 98765; | ||
|
||
$this->expectException(MessageDoesNotExistException::class); | ||
$this->expectExceptionMessageRegExp(\sprintf('/E_WARNING.+%s/s', \preg_quote((string) $messageNumber))); | ||
$this->expectExceptionMessageRegExp(\sprintf('/E_WARNING.+%s/s', \preg_quote((string)$messageNumber))); | ||
|
||
new Message($connection->getResource(), $messageNumber); | ||
} | ||
|
@@ -236,6 +241,12 @@ public function provideIconvCharsets(): array | |
return $provider; | ||
} | ||
|
||
public function testAppendedMessageUid() | ||
{ | ||
$uid = $this->mailbox->addMessage($this->getFixture('email_address')); | ||
$this->assertEquals(1, $uid); | ||
} | ||
|
||
public function testEmailAddress() | ||
{ | ||
$this->mailbox->addMessage($this->getFixture('email_address')); | ||
|
@@ -473,8 +484,7 @@ public function testRawHeaders() | |
{ | ||
$headers = 'From: [email protected]' . "\r\n" | ||
. 'To: [email protected]' . "\n" | ||
. "\r\n" | ||
; | ||
. "\r\n"; | ||
$originalMessage = $headers . 'Content' . "\n"; | ||
|
||
$this->mailbox->addMessage($originalMessage); | ||
|
@@ -643,9 +653,9 @@ public function testSignedMessage() | |
$this->assertCount(3, $attachments); | ||
|
||
$expected = [ | ||
'data.xml' => 'PHhtbC8+', | ||
'data.xml' => 'PHhtbC8+', | ||
'postacert.eml' => 'test-content', | ||
'smime.p7s' => 'MQ==', | ||
'smime.p7s' => 'MQ==', | ||
]; | ||
|
||
foreach ($attachments as $attachment) { | ||
|