Debian Codegraph @

lib/3rdParty/composer/webklex/php-imap/tests/fixtures/BooleanDecodedContentTest.php

raw symbols SCIP
1 <?php
2 /*
3 * File: BooleanDecodedContentTest.php
4 * Category: -
5 * Author: M.Goldenbaum
6 * Created: 09.03.23 02:24
7 * Updated: -
8 *
9 * Description:
10 * -
11 */
12
13 namespace Tests\fixtures;
14
15 use Webklex\PHPIMAP\Attachment;
16
17 /**
18 * Class BooleanDecodedContentTest
19 *
20 * @package Tests\fixtures
21 */
22 class BooleanDecodedContentTest extends FixtureTestCase {
23
24 /**
25 * Test the fixture boolean_decoded_content.eml
26 *
27 * @return void
28 */
29 public function testFixture() : void {
30 $message = $this->getFixture("boolean_decoded_content.eml");
31
32 self::assertEquals("Nuu", $message->subject);
33 self::assertEquals("Here is the problem mail\r\n \r\nBody text", $message->getTextBody());
34 self::assertEquals("Here is the problem mail\r\n \r\nBody text", $message->getHTMLBody());
35
36 self::assertEquals("2017-09-13 11:05:45", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
37 self::assertEquals("[email protected]", $message->from);
38 self::assertEquals("[email protected]", $message->to);
39
40 $attachments = $message->getAttachments();
41 self::assertCount(1, $attachments);
42
43 $attachment = $attachments[0];
44 self::assertInstanceOf(Attachment::class, $attachment);
45 self::assertEquals("Example Domain.pdf", $attachment->name);
46 self::assertEquals('text', $attachment->type);
47 self::assertEquals('pdf', $attachment->getExtension());
48 self::assertEquals("application/pdf", $attachment->content_type);
49 self::assertEquals("1c449aaab4f509012fa5eaa180fd017eb7724ccacabdffc1c6066d3756dcde5c", hash("sha256", $attachment->content));
50 self::assertEquals(53, $attachment->size);
51 self::assertEquals(2, $attachment->part_number);
52 self::assertEquals("attachment", $attachment->disposition);
53 self::assertNotEmpty($attachment->id);
54 }
55 }