Debian Codegraph @

lib/3rdParty/composer/webklex/php-imap/tests/issues/Issue413Test.php

raw symbols SCIP
1 <?php
2 /*
3 * File: Issue413Test.php
4 * Category: Test
5 * Author: M.Goldenbaum
6 * Created: 23.06.23 21:09
7 * Updated: -
8 *
9 * Description:
10 * -
11 */
12
13 namespace Tests\issues;
14
15 use PHPUnit\Framework\TestCase;
16 use Tests\live\LiveMailboxTestCase;
17 use Webklex\PHPIMAP\Config;
18 use Webklex\PHPIMAP\Folder;
19 use Webklex\PHPIMAP\Message;
20
21 class Issue413Test extends LiveMailboxTestCase {
22
23 /**
24 * Live server test
25 *
26 * @return void
27 * @throws \Webklex\PHPIMAP\Exceptions\AuthFailedException
28 * @throws \Webklex\PHPIMAP\Exceptions\ConnectionFailedException
29 * @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException
30 * @throws \Webklex\PHPIMAP\Exceptions\FolderFetchingException
31 * @throws \Webklex\PHPIMAP\Exceptions\GetMessagesFailedException
32 * @throws \Webklex\PHPIMAP\Exceptions\ImapBadRequestException
33 * @throws \Webklex\PHPIMAP\Exceptions\ImapServerErrorException
34 * @throws \Webklex\PHPIMAP\Exceptions\InvalidMessageDateException
35 * @throws \Webklex\PHPIMAP\Exceptions\MaskNotFoundException
36 * @throws \Webklex\PHPIMAP\Exceptions\MessageContentFetchingException
37 * @throws \Webklex\PHPIMAP\Exceptions\MessageFlagException
38 * @throws \Webklex\PHPIMAP\Exceptions\MessageHeaderFetchingException
39 * @throws \Webklex\PHPIMAP\Exceptions\MessageNotFoundException
40 * @throws \Webklex\PHPIMAP\Exceptions\ResponseException
41 * @throws \Webklex\PHPIMAP\Exceptions\RuntimeException
42 */
43 public function testLiveIssueEmail() {
44 $folder = $this->getFolder('INBOX');
45 self::assertInstanceOf(Folder::class, $folder);
46
47 /** @var Message $message */
48 $_message = $this->appendMessageTemplate($folder, 'issue-413.eml');
49
50 $message = $folder->messages()->getMessageByMsgn($_message->msgn);
51 self::assertEquals($message->uid, $_message->uid);
52
53 self::assertSame("Test Message", (string)$message->subject);
54 self::assertSame("This is just a test, so ignore it (if you can!)\r\n\r\nTony Marston", $message->getTextBody());
55
56 $message->delete();
57 }
58
59 /**
60 * Static parsing test
61 *
62 * @return void
63 * @throws \ReflectionException
64 * @throws \Webklex\PHPIMAP\Exceptions\AuthFailedException
65 * @throws \Webklex\PHPIMAP\Exceptions\ConnectionFailedException
66 * @throws \Webklex\PHPIMAP\Exceptions\ImapBadRequestException
67 * @throws \Webklex\PHPIMAP\Exceptions\ImapServerErrorException
68 * @throws \Webklex\PHPIMAP\Exceptions\InvalidMessageDateException
69 * @throws \Webklex\PHPIMAP\Exceptions\MaskNotFoundException
70 * @throws \Webklex\PHPIMAP\Exceptions\MessageContentFetchingException
71 * @throws \Webklex\PHPIMAP\Exceptions\ResponseException
72 * @throws \Webklex\PHPIMAP\Exceptions\RuntimeException
73 */
74 public function testIssueEmail() {
75 $filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-413.eml"]);
76 $message = Message::fromFile($filename);
77
78 self::assertSame("Test Message", (string)$message->subject);
79 self::assertSame("This is just a test, so ignore it (if you can!)\r\n\r\nTony Marston", $message->getTextBody());
80 }
81
82 }