mirror of
https://github.com/itflow-org/itflow
synced 2026-03-02 03:44:53 +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:
54
plugins/php-imap/tests/fixtures/PlainTextAttachmentTest.php
vendored
Normal file
54
plugins/php-imap/tests/fixtures/PlainTextAttachmentTest.php
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/*
|
||||
* File: PlainTextAttachmentTest.php
|
||||
* Category: -
|
||||
* Author: M.Goldenbaum
|
||||
* Created: 09.03.23 02:24
|
||||
* Updated: -
|
||||
*
|
||||
* Description:
|
||||
* -
|
||||
*/
|
||||
|
||||
namespace Tests\fixtures;
|
||||
|
||||
use Webklex\PHPIMAP\Attachment;
|
||||
|
||||
/**
|
||||
* Class PlainTextAttachmentTest
|
||||
*
|
||||
* @package Tests\fixtures
|
||||
*/
|
||||
class PlainTextAttachmentTest extends FixtureTestCase {
|
||||
|
||||
/**
|
||||
* Test the fixture plain_text_attachment.eml
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFixture() : void {
|
||||
$message = $this->getFixture("plain_text_attachment.eml");
|
||||
|
||||
self::assertEquals("Plain text attachment", $message->subject);
|
||||
self::assertEquals("Test", $message->getTextBody());
|
||||
self::assertFalse($message->hasHTMLBody());
|
||||
|
||||
self::assertEquals("2018-08-21 07:05:14", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
|
||||
self::assertEquals("from@there.com", $message->from->first()->mail);
|
||||
self::assertEquals("to@here.com", $message->to->first()->mail);
|
||||
|
||||
self::assertCount(1, $message->attachments());
|
||||
|
||||
$attachment = $message->attachments()->first();
|
||||
self::assertInstanceOf(Attachment::class, $attachment);
|
||||
self::assertEquals("a.txt", $attachment->name);
|
||||
self::assertEquals('txt', $attachment->getExtension());
|
||||
self::assertEquals('text', $attachment->type);
|
||||
self::assertNull($attachment->content_type);
|
||||
self::assertEquals("Hi!", $attachment->content);
|
||||
self::assertEquals(4, $attachment->size);
|
||||
self::assertEquals(2, $attachment->part_number);
|
||||
self::assertEquals("attachment", $attachment->disposition);
|
||||
self::assertNotEmpty($attachment->id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user