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