Debian Codegraph @

lib/3rdParty/composer/webklex/php-imap/tests/AddressTest.php

raw symbols SCIP
1 <?php
2 /*
3 * File: AddressTest.php
4 * Category: -
5 * Author: M.Goldenbaum
6 * Created: 28.12.22 18:11
7 * Updated: -
8 *
9 * Description:
10 * -
11 */
12
13 namespace Tests;
14
15 use PHPUnit\Framework\TestCase;
16 use Webklex\PHPIMAP\Address;
17
18 class AddressTest extends TestCase {
19
20 /**
21 * Test data
22 *
23 * @var array|string[] $data
24 */
25 protected array $data = [
26 "personal" => "Username",
27 "mailbox" => "info",
28 "host" => "domain.tld",
29 "mail" => "[email protected]",
30 "full" => "Username <[email protected]>",
31 ];
32
33 /**
34 * Address test
35 *
36 * @return void
37 */
38 public function testAddress(): void {
39 $address = new Address((object)$this->data);
40
41 self::assertSame("Username", $address->personal);
42 self::assertSame("info", $address->mailbox);
43 self::assertSame("domain.tld", $address->host);
44 self::assertSame("[email protected]", $address->mail);
45 self::assertSame("Username <[email protected]>", $address->full);
46 }
47
48 /**
49 * Test Address to string conversion
50 *
51 * @return void
52 */
53 public function testAddressToStringConversion(): void {
54 $address = new Address((object)$this->data);
55
56 self::assertSame("Username <[email protected]>", (string)$address);
57 }
58
59 /**
60 * Test Address serialization
61 *
62 * @return void
63 */
64 public function testAddressSerialization(): void {
65 $address = new Address((object)$this->data);
66
67 foreach($address as $key => $value) {
68 self::assertSame($this->data[$key], $value);
69 }
70
71 }
72 }