mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 19:04:52 +00:00
Migrated away from PHP Mail Parser to the new WebKlex PHP IMAP Mail Parser this will open the way to support OAUTH2 for Mail servers such as Microsoft 365 and Google Workspaces
This commit is contained in:
38
plugins/php-imap/tests/issues/Issue275Test.php
Normal file
38
plugins/php-imap/tests/issues/Issue275Test.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/*
|
||||
* File: Issue355Test.php
|
||||
* Category: -
|
||||
* Author: M.Goldenbaum
|
||||
* Created: 10.01.23 10:48
|
||||
* Updated: -
|
||||
*
|
||||
* Description:
|
||||
* -
|
||||
*/
|
||||
|
||||
namespace Tests\issues;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Webklex\PHPIMAP\Message;
|
||||
|
||||
class Issue275Test extends TestCase {
|
||||
|
||||
public function testIssueEmail1() {
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-275.eml"]);
|
||||
$message = Message::fromFile($filename);
|
||||
|
||||
self::assertSame("Testing 123", (string)$message->subject);
|
||||
self::assertSame("Asdf testing123 this is a body", $message->getTextBody());
|
||||
}
|
||||
|
||||
public function testIssueEmail2() {
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-275-2.eml"]);
|
||||
$message = Message::fromFile($filename);
|
||||
|
||||
$body = "Test\r\n\r\nMed venlig hilsen\r\nMartin Larsen\r\nFeline Holidays A/S\r\nTlf 78 77 04 12";
|
||||
|
||||
self::assertSame("Test 1017", (string)$message->subject);
|
||||
self::assertSame($body, $message->getTextBody());
|
||||
}
|
||||
|
||||
}
|
||||
30
plugins/php-imap/tests/issues/Issue355Test.php
Normal file
30
plugins/php-imap/tests/issues/Issue355Test.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/*
|
||||
* File: Issue355Test.php
|
||||
* Category: -
|
||||
* Author: M.Goldenbaum
|
||||
* Created: 10.01.23 10:48
|
||||
* Updated: -
|
||||
*
|
||||
* Description:
|
||||
* -
|
||||
*/
|
||||
|
||||
namespace Tests\issues;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Webklex\PHPIMAP\Config;
|
||||
use Webklex\PHPIMAP\Header;
|
||||
|
||||
class Issue355Test extends TestCase {
|
||||
|
||||
public function testIssue() {
|
||||
$raw_header = "Subject: =?UTF-8?Q?Re=3A_Uppdaterat_=C3=A4rende_=28447899=29=2C_kostnader_f=C3=B6r_hj=C3=A4?= =?UTF-8?Q?lp_med_stadge=C3=A4ndring_enligt_ny_lagstiftning?=\r\n";
|
||||
|
||||
$header = new Header($raw_header, Config::make());
|
||||
$subject = $header->get("subject");
|
||||
|
||||
$this->assertEquals("Re: Uppdaterat ärende (447899), kostnader för hjälp med stadgeändring enligt ny lagstiftning", $subject->toString());
|
||||
}
|
||||
|
||||
}
|
||||
61
plugins/php-imap/tests/issues/Issue379Test.php
Normal file
61
plugins/php-imap/tests/issues/Issue379Test.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/*
|
||||
* File: Issue355Test.php
|
||||
* Category: -
|
||||
* Author: M.Goldenbaum
|
||||
* Created: 10.01.23 10:48
|
||||
* Updated: -
|
||||
*
|
||||
* Description:
|
||||
* -
|
||||
*/
|
||||
|
||||
namespace Tests\issues;
|
||||
|
||||
use Tests\live\LiveMailboxTestCase;
|
||||
use Webklex\PHPIMAP\Exceptions\AuthFailedException;
|
||||
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
|
||||
use Webklex\PHPIMAP\Exceptions\EventNotFoundException;
|
||||
use Webklex\PHPIMAP\Exceptions\FolderFetchingException;
|
||||
use Webklex\PHPIMAP\Exceptions\ImapBadRequestException;
|
||||
use Webklex\PHPIMAP\Exceptions\ImapServerErrorException;
|
||||
use Webklex\PHPIMAP\Exceptions\InvalidMessageDateException;
|
||||
use Webklex\PHPIMAP\Exceptions\MaskNotFoundException;
|
||||
use Webklex\PHPIMAP\Exceptions\MessageContentFetchingException;
|
||||
use Webklex\PHPIMAP\Exceptions\MessageFlagException;
|
||||
use Webklex\PHPIMAP\Exceptions\MessageHeaderFetchingException;
|
||||
use Webklex\PHPIMAP\Exceptions\MessageNotFoundException;
|
||||
use Webklex\PHPIMAP\Exceptions\ResponseException;
|
||||
use Webklex\PHPIMAP\Exceptions\RuntimeException;
|
||||
|
||||
class Issue379Test extends LiveMailboxTestCase {
|
||||
|
||||
/**
|
||||
* Test issue #379 - Message::getSize() added
|
||||
* @return void
|
||||
* @throws AuthFailedException
|
||||
* @throws ConnectionFailedException
|
||||
* @throws EventNotFoundException
|
||||
* @throws FolderFetchingException
|
||||
* @throws ImapBadRequestException
|
||||
* @throws ImapServerErrorException
|
||||
* @throws InvalidMessageDateException
|
||||
* @throws MessageContentFetchingException
|
||||
* @throws MessageFlagException
|
||||
* @throws MessageHeaderFetchingException
|
||||
* @throws MessageNotFoundException
|
||||
* @throws ResponseException
|
||||
* @throws RuntimeException
|
||||
* @throws MaskNotFoundException
|
||||
*/
|
||||
public function testIssue(): void {
|
||||
$folder = $this->getFolder('INBOX');
|
||||
|
||||
$message = $this->appendMessageTemplate($folder, "plain.eml");
|
||||
$this->assertEquals(214, $message->getSize());
|
||||
|
||||
// Clean up
|
||||
$this->assertTrue($message->delete(true));
|
||||
}
|
||||
|
||||
}
|
||||
33
plugins/php-imap/tests/issues/Issue382Test.php
Normal file
33
plugins/php-imap/tests/issues/Issue382Test.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/*
|
||||
* File: Issue382Test.php
|
||||
* Category: Test
|
||||
* Author: M.Goldenbaum
|
||||
* Created: 24.06.23 00:41
|
||||
* Updated: -
|
||||
*
|
||||
* Description:
|
||||
* -
|
||||
*/
|
||||
|
||||
namespace Tests\issues;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Webklex\PHPIMAP\Message;
|
||||
|
||||
class Issue382Test extends TestCase {
|
||||
|
||||
public function testIssueEmail() {
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-382.eml"]);
|
||||
$message = Message::fromFile($filename);
|
||||
|
||||
$from = $message->from->first();
|
||||
|
||||
self::assertSame("Mail Delivery System", $from->personal);
|
||||
self::assertSame("MAILER-DAEMON", $from->mailbox);
|
||||
self::assertSame("mta-09.someserver.com", $from->host);
|
||||
self::assertSame("MAILER-DAEMON@mta-09.someserver.com", $from->mail);
|
||||
self::assertSame("Mail Delivery System <MAILER-DAEMON@mta-09.someserver.com>", $from->full);
|
||||
}
|
||||
|
||||
}
|
||||
69
plugins/php-imap/tests/issues/Issue383Test.php
Normal file
69
plugins/php-imap/tests/issues/Issue383Test.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/*
|
||||
* File: Issue355Test.php
|
||||
* Category: -
|
||||
* Author: M.Goldenbaum
|
||||
* Created: 10.01.23 10:48
|
||||
* Updated: -
|
||||
*
|
||||
* Description:
|
||||
* -
|
||||
*/
|
||||
|
||||
namespace Tests\issues;
|
||||
|
||||
use Tests\live\LiveMailboxTestCase;
|
||||
use Webklex\PHPIMAP\Exceptions\AuthFailedException;
|
||||
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
|
||||
use Webklex\PHPIMAP\Exceptions\EventNotFoundException;
|
||||
use Webklex\PHPIMAP\Exceptions\FolderFetchingException;
|
||||
use Webklex\PHPIMAP\Exceptions\ImapBadRequestException;
|
||||
use Webklex\PHPIMAP\Exceptions\ImapServerErrorException;
|
||||
use Webklex\PHPIMAP\Exceptions\MaskNotFoundException;
|
||||
use Webklex\PHPIMAP\Exceptions\ResponseException;
|
||||
use Webklex\PHPIMAP\Exceptions\RuntimeException;
|
||||
use Webklex\PHPIMAP\Folder;
|
||||
|
||||
class Issue383Test extends LiveMailboxTestCase {
|
||||
|
||||
/**
|
||||
* Test issue #383 - Does not work when a folder name contains umlauts: Entwürfe
|
||||
* @return void
|
||||
* @throws AuthFailedException
|
||||
* @throws ConnectionFailedException
|
||||
* @throws EventNotFoundException
|
||||
* @throws FolderFetchingException
|
||||
* @throws ImapBadRequestException
|
||||
* @throws ImapServerErrorException
|
||||
* @throws ResponseException
|
||||
* @throws RuntimeException
|
||||
* @throws MaskNotFoundException
|
||||
*/
|
||||
public function testIssue(): void {
|
||||
$client = $this->getClient();
|
||||
$client->connect();
|
||||
|
||||
$delimiter = $this->getManager()->getConfig()->get("options.delimiter");
|
||||
$folder_path = implode($delimiter, ['INBOX', 'Entwürfe+']);
|
||||
|
||||
$folder = $client->getFolder($folder_path);
|
||||
$this->deleteFolder($folder);
|
||||
|
||||
$folder = $client->createFolder($folder_path, false);
|
||||
self::assertInstanceOf(Folder::class, $folder);
|
||||
|
||||
$folder = $this->getFolder($folder_path);
|
||||
self::assertInstanceOf(Folder::class, $folder);
|
||||
|
||||
$this->assertEquals('Entwürfe+', $folder->name);
|
||||
$this->assertEquals($folder_path, $folder->full_name);
|
||||
|
||||
$folder_path = implode($delimiter, ['INBOX', 'Entw&APw-rfe+']);
|
||||
$this->assertEquals($folder_path, $folder->path);
|
||||
|
||||
// Clean up
|
||||
if ($this->deleteFolder($folder) === false) {
|
||||
$this->fail("Could not delete folder: " . $folder->path);
|
||||
}
|
||||
}
|
||||
}
|
||||
62
plugins/php-imap/tests/issues/Issue393Test.php
Normal file
62
plugins/php-imap/tests/issues/Issue393Test.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/*
|
||||
* File: Issue393Test.php
|
||||
* Category: -
|
||||
* Author: M.Goldenbaum
|
||||
* Created: 10.01.23 10:48
|
||||
* Updated: -
|
||||
*
|
||||
* Description:
|
||||
* -
|
||||
*/
|
||||
|
||||
namespace Tests\issues;
|
||||
|
||||
use Tests\live\LiveMailboxTestCase;
|
||||
use Webklex\PHPIMAP\Exceptions\AuthFailedException;
|
||||
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
|
||||
use Webklex\PHPIMAP\Exceptions\EventNotFoundException;
|
||||
use Webklex\PHPIMAP\Exceptions\FolderFetchingException;
|
||||
use Webklex\PHPIMAP\Exceptions\ImapBadRequestException;
|
||||
use Webklex\PHPIMAP\Exceptions\ImapServerErrorException;
|
||||
use Webklex\PHPIMAP\Exceptions\MaskNotFoundException;
|
||||
use Webklex\PHPIMAP\Exceptions\ResponseException;
|
||||
use Webklex\PHPIMAP\Exceptions\RuntimeException;
|
||||
use Webklex\PHPIMAP\Folder;
|
||||
|
||||
class Issue393Test extends LiveMailboxTestCase {
|
||||
|
||||
/**
|
||||
* Test issue #393 - "Empty response" when calling getFolders()
|
||||
* @return void
|
||||
* @throws AuthFailedException
|
||||
* @throws ConnectionFailedException
|
||||
* @throws EventNotFoundException
|
||||
* @throws FolderFetchingException
|
||||
* @throws ImapBadRequestException
|
||||
* @throws ImapServerErrorException
|
||||
* @throws ResponseException
|
||||
* @throws RuntimeException
|
||||
* @throws MaskNotFoundException
|
||||
*/
|
||||
public function testIssue(): void {
|
||||
$client = $this->getClient();
|
||||
$client->connect();
|
||||
|
||||
$delimiter = $this->getManager()->getConfig()->get("options.delimiter");
|
||||
$pattern = implode($delimiter, ['doesnt_exist', '%']);
|
||||
|
||||
$folder = $client->getFolder('doesnt_exist');
|
||||
$this->deleteFolder($folder);
|
||||
|
||||
$folders = $client->getFolders(true, $pattern, true);
|
||||
self::assertCount(0, $folders);
|
||||
|
||||
try {
|
||||
$client->getFolders(true, $pattern, false);
|
||||
$this->fail('Expected FolderFetchingException::class exception not thrown');
|
||||
} catch (FolderFetchingException $e) {
|
||||
self::assertInstanceOf(FolderFetchingException::class, $e);
|
||||
}
|
||||
}
|
||||
}
|
||||
27
plugins/php-imap/tests/issues/Issue401Test.php
Normal file
27
plugins/php-imap/tests/issues/Issue401Test.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/*
|
||||
* File: Issue401Test.php
|
||||
* Category: Test
|
||||
* Author: M.Goldenbaum
|
||||
* Created: 23.06.23 22:48
|
||||
* Updated: -
|
||||
*
|
||||
* Description:
|
||||
* -
|
||||
*/
|
||||
|
||||
namespace Tests\issues;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Webklex\PHPIMAP\Message;
|
||||
|
||||
class Issue401Test extends TestCase {
|
||||
|
||||
public function testIssueEmail() {
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-401.eml"]);
|
||||
$message = Message::fromFile($filename);
|
||||
|
||||
self::assertSame("1;00pm Client running few minutes late", (string)$message->subject);
|
||||
}
|
||||
|
||||
}
|
||||
57
plugins/php-imap/tests/issues/Issue407Test.php
Normal file
57
plugins/php-imap/tests/issues/Issue407Test.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/*
|
||||
* File: Issue407Test.php
|
||||
* Category: Test
|
||||
* Author: M.Goldenbaum
|
||||
* Created: 23.06.23 21:40
|
||||
* Updated: -
|
||||
*
|
||||
* Description:
|
||||
* -
|
||||
*/
|
||||
|
||||
namespace Tests\issues;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Tests\live\LiveMailboxTestCase;
|
||||
use Webklex\PHPIMAP\Folder;
|
||||
use Webklex\PHPIMAP\IMAP;
|
||||
use Webklex\PHPIMAP\Message;
|
||||
|
||||
class Issue407Test extends LiveMailboxTestCase {
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\AuthFailedException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\ConnectionFailedException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\FolderFetchingException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\ImapBadRequestException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\ImapServerErrorException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\InvalidMessageDateException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\MaskNotFoundException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\MessageContentFetchingException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\MessageFlagException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\MessageHeaderFetchingException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\ResponseException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\RuntimeException
|
||||
*/
|
||||
public function testIssue() {
|
||||
$folder = $this->getFolder('INBOX');
|
||||
self::assertInstanceOf(Folder::class, $folder);
|
||||
|
||||
$message = $this->appendMessageTemplate($folder, "plain.eml");
|
||||
self::assertInstanceOf(Message::class, $message);
|
||||
|
||||
$message->setFlag("Seen");
|
||||
|
||||
$flags = $this->getClient()->getConnection()->flags($message->uid, IMAP::ST_UID)->validatedData();
|
||||
|
||||
self::assertIsArray($flags);
|
||||
self::assertSame(1, count($flags));
|
||||
self::assertSame("\\Seen", $flags[$message->uid][0]);
|
||||
|
||||
$message->delete();
|
||||
}
|
||||
|
||||
}
|
||||
52
plugins/php-imap/tests/issues/Issue410Test.php
Normal file
52
plugins/php-imap/tests/issues/Issue410Test.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/*
|
||||
* File: Issue410Test.php
|
||||
* Category: -
|
||||
* Author: M.Goldenbaum
|
||||
* Created: 23.06.23 20:41
|
||||
* Updated: -
|
||||
*
|
||||
* Description:
|
||||
* -
|
||||
*/
|
||||
|
||||
namespace Tests\issues;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Webklex\PHPIMAP\ClientManager;
|
||||
use Webklex\PHPIMAP\Message;
|
||||
|
||||
class Issue410Test extends TestCase {
|
||||
|
||||
public function testIssueEmail() {
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-410.eml"]);
|
||||
$message = Message::fromFile($filename);
|
||||
|
||||
self::assertSame("☆第132号 「ガーデン&エクステリア」専門店のためのQ&Aサロン 【月刊エクステリア・ワーク】", (string)$message->subject);
|
||||
|
||||
$attachments = $message->getAttachments();
|
||||
|
||||
self::assertSame(1, $attachments->count());
|
||||
|
||||
$attachment = $attachments->first();
|
||||
self::assertSame("☆第132号 「ガーデン&エクステリア」専門店のためのQ&Aサロン 【月刊エクステリア・ワーク】", $attachment->filename);
|
||||
self::assertSame("☆第132号 「ガーデン&エクステリア」専門店のためのQ&Aサロン 【月刊エクステリア・ワーク】", $attachment->name);
|
||||
}
|
||||
|
||||
public function testIssueEmailB() {
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-410b.eml"]);
|
||||
$message = Message::fromFile($filename);
|
||||
|
||||
self::assertSame("386 - 400021804 - 19., Heiligenstädter Straße 80 - 0819306 - Anfrage Vergabevorschlag", (string)$message->subject);
|
||||
|
||||
$attachments = $message->getAttachments();
|
||||
|
||||
self::assertSame(1, $attachments->count());
|
||||
|
||||
$attachment = $attachments->first();
|
||||
self::assertSame("2021_Mängelliste_0819306.xlsx", $attachment->description);
|
||||
self::assertSame("2021_Mängelliste_0819306.xlsx", $attachment->filename);
|
||||
self::assertSame("2021_Mängelliste_0819306.xlsx", $attachment->name);
|
||||
}
|
||||
|
||||
}
|
||||
31
plugins/php-imap/tests/issues/Issue412Test.php
Normal file
31
plugins/php-imap/tests/issues/Issue412Test.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/*
|
||||
* File: Issue413Test.php
|
||||
* Category: Test
|
||||
* Author: M.Goldenbaum
|
||||
* Created: 23.06.23 21:09
|
||||
* Updated: -
|
||||
*
|
||||
* Description:
|
||||
* -
|
||||
*/
|
||||
|
||||
namespace Tests\issues;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Webklex\PHPIMAP\Config;
|
||||
use Webklex\PHPIMAP\Message;
|
||||
|
||||
class Issue412Test extends TestCase {
|
||||
|
||||
public function testIssueEmail() {
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-412.eml"]);
|
||||
$message = Message::fromFile($filename);
|
||||
|
||||
self::assertSame("RE: TEST MESSAGE", (string)$message->subject);
|
||||
self::assertSame("64254d63e92a36ee02c760676351e60a", md5($message->getTextBody()));
|
||||
self::assertSame("2e4de288f6a1ed658548ed11fcdb1d79", md5($message->getHTMLBody()));
|
||||
self::assertSame(0, $message->attachments()->count());
|
||||
}
|
||||
|
||||
}
|
||||
82
plugins/php-imap/tests/issues/Issue413Test.php
Normal file
82
plugins/php-imap/tests/issues/Issue413Test.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/*
|
||||
* File: Issue413Test.php
|
||||
* Category: Test
|
||||
* Author: M.Goldenbaum
|
||||
* Created: 23.06.23 21:09
|
||||
* Updated: -
|
||||
*
|
||||
* Description:
|
||||
* -
|
||||
*/
|
||||
|
||||
namespace Tests\issues;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Tests\live\LiveMailboxTestCase;
|
||||
use Webklex\PHPIMAP\Config;
|
||||
use Webklex\PHPIMAP\Folder;
|
||||
use Webklex\PHPIMAP\Message;
|
||||
|
||||
class Issue413Test extends LiveMailboxTestCase {
|
||||
|
||||
/**
|
||||
* Live server test
|
||||
*
|
||||
* @return void
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\AuthFailedException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\ConnectionFailedException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\FolderFetchingException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\GetMessagesFailedException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\ImapBadRequestException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\ImapServerErrorException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\InvalidMessageDateException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\MaskNotFoundException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\MessageContentFetchingException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\MessageFlagException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\MessageHeaderFetchingException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\MessageNotFoundException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\ResponseException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\RuntimeException
|
||||
*/
|
||||
public function testLiveIssueEmail() {
|
||||
$folder = $this->getFolder('INBOX');
|
||||
self::assertInstanceOf(Folder::class, $folder);
|
||||
|
||||
/** @var Message $message */
|
||||
$_message = $this->appendMessageTemplate($folder, 'issue-413.eml');
|
||||
|
||||
$message = $folder->messages()->getMessageByMsgn($_message->msgn);
|
||||
self::assertEquals($message->uid, $_message->uid);
|
||||
|
||||
self::assertSame("Test Message", (string)$message->subject);
|
||||
self::assertSame("This is just a test, so ignore it (if you can!)\r\n\r\nTony Marston", $message->getTextBody());
|
||||
|
||||
$message->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Static parsing test
|
||||
*
|
||||
* @return void
|
||||
* @throws \ReflectionException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\AuthFailedException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\ConnectionFailedException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\ImapBadRequestException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\ImapServerErrorException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\InvalidMessageDateException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\MaskNotFoundException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\MessageContentFetchingException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\ResponseException
|
||||
* @throws \Webklex\PHPIMAP\Exceptions\RuntimeException
|
||||
*/
|
||||
public function testIssueEmail() {
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-413.eml"]);
|
||||
$message = Message::fromFile($filename);
|
||||
|
||||
self::assertSame("Test Message", (string)$message->subject);
|
||||
self::assertSame("This is just a test, so ignore it (if you can!)\r\n\r\nTony Marston", $message->getTextBody());
|
||||
}
|
||||
|
||||
}
|
||||
43
plugins/php-imap/tests/issues/Issue414Test.php
Normal file
43
plugins/php-imap/tests/issues/Issue414Test.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*
|
||||
* File: Issue410Test.php
|
||||
* Category: -
|
||||
* Author: M.Goldenbaum
|
||||
* Created: 23.06.23 20:41
|
||||
* Updated: -
|
||||
*
|
||||
* Description:
|
||||
* -
|
||||
*/
|
||||
|
||||
namespace Tests\issues;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Webklex\PHPIMAP\Message;
|
||||
|
||||
class Issue414Test extends TestCase {
|
||||
|
||||
public function testIssueEmail() {
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-414.eml"]);
|
||||
$message = Message::fromFile($filename);
|
||||
|
||||
self::assertSame("Test", (string)$message->subject);
|
||||
|
||||
$attachments = $message->getAttachments();
|
||||
|
||||
self::assertSame(2, $attachments->count());
|
||||
|
||||
$attachment = $attachments->first();
|
||||
self::assertEmpty($attachment->description);
|
||||
self::assertSame("exampleMyFile.txt", $attachment->filename);
|
||||
self::assertSame("exampleMyFile.txt", $attachment->name);
|
||||
self::assertSame("be62f7e6", $attachment->id);
|
||||
|
||||
$attachment = $attachments->last();
|
||||
self::assertEmpty($attachment->description);
|
||||
self::assertSame("phpfoo", $attachment->filename);
|
||||
self::assertSame("phpfoo", $attachment->name);
|
||||
self::assertSame("12e1d38b", $attachment->hash);
|
||||
}
|
||||
|
||||
}
|
||||
31
plugins/php-imap/tests/issues/Issue420Test.php
Normal file
31
plugins/php-imap/tests/issues/Issue420Test.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/*
|
||||
* File: Issue355Test.php
|
||||
* Category: -
|
||||
* Author: M.Goldenbaum
|
||||
* Created: 10.01.23 10:48
|
||||
* Updated: -
|
||||
*
|
||||
* Description:
|
||||
* -
|
||||
*/
|
||||
|
||||
namespace Tests\issues;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Webklex\PHPIMAP\Config;
|
||||
use Webklex\PHPIMAP\Header;
|
||||
|
||||
class Issue420Test extends TestCase {
|
||||
|
||||
public function testIssue() {
|
||||
$raw_header = "Subject: =?UTF-8?B?VGlja2V0IE5vOiBb7aC97bOpMTddIE1haWxib3ggSW5ib3ggLSAoMTcpIEluY29taW5nIGZhaWxlZCBtZXNzYWdlcw==?=\r\n";
|
||||
|
||||
$header = new Header($raw_header, Config::make());
|
||||
$subject = $header->get("subject");
|
||||
|
||||
// Ticket No: [<5B><>17] Mailbox Inbox - (17) Incoming failed messages
|
||||
$this->assertEquals('Ticket No: [??17] Mailbox Inbox - (17) Incoming failed messages', utf8_decode($subject->toString()));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user