-
Notifications
You must be signed in to change notification settings - Fork 1
/
BounceMsgSpecTest.php
53 lines (45 loc) · 1.54 KB
/
BounceMsgSpecTest.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
<?php
namespace Zimbra\Mail\Tests\Struct;
use Zimbra\Mail\Tests\ZimbraMailTestCase;
use Zimbra\Enum\AddressType;
use Zimbra\Mail\Struct\EmailAddrInfo;
use Zimbra\Mail\Struct\BounceMsgSpec;
/**
* Testcase class for BounceMsgSpec.
*/
class BounceMsgSpecTest extends ZimbraMailTestCase
{
public function testBounceMsgSpec()
{
$id = $this->faker->uuid;
$address = $this->faker->word;
$personal = $this->faker->word;
$e = new EmailAddrInfo($address, AddressType::FROM(), $personal);
$m = new BounceMsgSpec($id, [$e]);
$this->assertSame($id, $m->getId());
$this->assertSame([$e], $m->getEmailAddresses()->all());
$m->setId($id)
->addEmailAddresses($e);
$this->assertSame($id, $m->getId());
$this->assertSame([$e, $e], $m->getEmailAddresses()->all());
$m->getEmailAddresses()->remove(1);
$xml = '<?xml version="1.0"?>' . "\n"
.'<m id="' . $id . '">'
.'<e a="' . $address . '" t="' . AddressType::FROM() . '" p="' . $personal . '" />'
.'</m>';
$this->assertXmlStringEqualsXmlString($xml, (string) $m);
$array = array(
'm' => array(
'id' => $id,
'e' => array(
array(
'a' => $address,
't' => AddressType::FROM()->value(),
'p' => $personal,
),
),
),
);
$this->assertEquals($array, $m->toArray());
}
}