3 class Sabre_CalDAV_Property_SupportedCalendarComponentSetTest extends PHPUnit_Framework_TestCase {
5 function testSimple() {
7 $sccs = new Sabre_CalDAV_Property_SupportedCalendarComponentSet(array('VEVENT'));
8 $this->assertEquals(array('VEVENT'), $sccs->getValue());
15 function testSerialize() {
17 $property = new Sabre_CalDAV_Property_SupportedCalendarComponentSet(array('VEVENT','VJOURNAL'));
19 $doc = new DOMDocument();
20 $root = $doc->createElement('d:root');
21 $root->setAttribute('xmlns:d','DAV:');
22 $root->setAttribute('xmlns:cal',Sabre_CalDAV_Plugin::NS_CALDAV);
24 $doc->appendChild($root);
25 $objectTree = new Sabre_DAV_ObjectTree(new Sabre_DAV_SimpleCollection('rootdir'));
26 $server = new Sabre_DAV_Server($objectTree);
28 $property->serialize($server, $root);
30 $xml = $doc->saveXML();
33 '<?xml version="1.0"?>
34 <d:root xmlns:d="DAV:" xmlns:cal="' . Sabre_CalDAV_Plugin::NS_CALDAV . '">' .
35 '<cal:comp name="VEVENT"/>' .
36 '<cal:comp name="VJOURNAL"/>' .
45 function testUnserializer() {
47 $xml = '<?xml version="1.0"?>
48 <d:root xmlns:d="DAV:" xmlns:cal="' . Sabre_CalDAV_Plugin::NS_CALDAV . '">' .
49 '<cal:comp name="VEVENT"/>' .
50 '<cal:comp name="VJOURNAL"/>' .
53 $dom = Sabre_DAV_XMLUtil::loadDOMDocument($xml);
55 $property = Sabre_CalDAV_Property_SupportedCalendarComponentSet::unserialize($dom->firstChild);
57 $this->assertTrue($property instanceof Sabre_CalDAV_Property_SupportedCalendarComponentSet);
58 $this->assertEquals(array(
62 $property->getValue());