1<?php
2
3namespace Sabre\CalDAV\Xml\Property;
4
5use Sabre\DAV\Xml\XmlTest;
6
7class EmailAddressSetTest extends XmlTest {
8
9    protected $namespaceMap = [
10        \Sabre\CalDAV\Plugin::NS_CALENDARSERVER => 'cs',
11        'DAV:' => 'd',
12    ];
13
14    function testSimple() {
15
16        $eas = new EmailAddressSet(['foo@example.org']);
17        $this->assertEquals(['foo@example.org'], $eas->getValue());
18
19    }
20
21    /**
22     * @depends testSimple
23     */
24    function testSerialize() {
25
26        $property = new EmailAddressSet(['foo@example.org']);
27
28        $xml = $this->write([
29            '{DAV:}root' => $property
30        ]);
31
32        $this->assertXmlStringEqualsXmlString(
33'<?xml version="1.0"?>
34<d:root xmlns:d="DAV:" xmlns:cs="' . \Sabre\CalDAV\Plugin::NS_CALENDARSERVER . '">
35<cs:email-address>foo@example.org</cs:email-address>
36</d:root>', $xml);
37
38    }
39
40}
41