Skip to content

Commit 29245c8

Browse files
committed
Webklex#413 live test added & sample readded
1 parent 829a6e6 commit 29245c8

File tree

2 files changed

+54
-2
lines changed

2 files changed

+54
-2
lines changed

tests/issues/Issue413Test.php

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,62 @@
1313
namespace Tests\issues;
1414

1515
use PHPUnit\Framework\TestCase;
16+
use Tests\live\LiveMailboxTestCase;
17+
use Webklex\PHPIMAP\Folder;
1618
use Webklex\PHPIMAP\Message;
1719

18-
class Issue413Test extends TestCase {
20+
class Issue413Test extends LiveMailboxTestCase {
1921

22+
/**
23+
* Live server test
24+
*
25+
* @return void
26+
* @throws \Webklex\PHPIMAP\Exceptions\AuthFailedException
27+
* @throws \Webklex\PHPIMAP\Exceptions\ConnectionFailedException
28+
* @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException
29+
* @throws \Webklex\PHPIMAP\Exceptions\FolderFetchingException
30+
* @throws \Webklex\PHPIMAP\Exceptions\GetMessagesFailedException
31+
* @throws \Webklex\PHPIMAP\Exceptions\ImapBadRequestException
32+
* @throws \Webklex\PHPIMAP\Exceptions\ImapServerErrorException
33+
* @throws \Webklex\PHPIMAP\Exceptions\InvalidMessageDateException
34+
* @throws \Webklex\PHPIMAP\Exceptions\MaskNotFoundException
35+
* @throws \Webklex\PHPIMAP\Exceptions\MessageContentFetchingException
36+
* @throws \Webklex\PHPIMAP\Exceptions\MessageFlagException
37+
* @throws \Webklex\PHPIMAP\Exceptions\MessageHeaderFetchingException
38+
* @throws \Webklex\PHPIMAP\Exceptions\MessageNotFoundException
39+
* @throws \Webklex\PHPIMAP\Exceptions\ResponseException
40+
* @throws \Webklex\PHPIMAP\Exceptions\RuntimeException
41+
*/
42+
public function testLiveIssueEmail() {
43+
$folder = $this->getFolder('INBOX');
44+
self::assertInstanceOf(Folder::class, $folder);
45+
46+
$_message = $this->appendMessageTemplate($folder, 'issue-413.eml');
47+
48+
$message = $folder->messages()->all()->get()->last();
49+
self::assertEquals($message->uid, $_message->uid);
50+
51+
self::assertSame("Test Message", (string)$message->subject);
52+
self::assertSame("This is just a test, so ignore it (if you can!)\r\n\r\nTony Marston", $message->getTextBody());
53+
54+
$message->delete();
55+
}
56+
57+
/**
58+
* Static parsing test
59+
*
60+
* @return void
61+
* @throws \ReflectionException
62+
* @throws \Webklex\PHPIMAP\Exceptions\AuthFailedException
63+
* @throws \Webklex\PHPIMAP\Exceptions\ConnectionFailedException
64+
* @throws \Webklex\PHPIMAP\Exceptions\ImapBadRequestException
65+
* @throws \Webklex\PHPIMAP\Exceptions\ImapServerErrorException
66+
* @throws \Webklex\PHPIMAP\Exceptions\InvalidMessageDateException
67+
* @throws \Webklex\PHPIMAP\Exceptions\MaskNotFoundException
68+
* @throws \Webklex\PHPIMAP\Exceptions\MessageContentFetchingException
69+
* @throws \Webklex\PHPIMAP\Exceptions\ResponseException
70+
* @throws \Webklex\PHPIMAP\Exceptions\RuntimeException
71+
*/
2072
public function testIssueEmail() {
2173
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-413.eml"]);
2274
$message = Message::fromFile($filename);

tests/messages/issue-413.eml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ X-From-Rewrite: unmodified, already matched
2929

3030
This is just a test, so ignore it (if you can!)
3131

32-
Tony Marston
32+
Tony Marston

0 commit comments

Comments
 (0)