namespaceMap[CalDAV\Plugin::NS_CALDAV] = 'cal';
$this->namespaceMap[CalDAV\Plugin::NS_CALENDARSERVER] = 'cs';
}
function testSimple() {
$prop = new SupportedCalendarComponentSet(['VEVENT']);
$this->assertEquals(
['VEVENT'],
$prop->getValue()
);
}
function testMultiple() {
$prop = new SupportedCalendarComponentSet(['VEVENT', 'VTODO']);
$this->assertEquals(
['VEVENT', 'VTODO'],
$prop->getValue()
);
}
/**
* @depends testSimple
* @depends testMultiple
*/
function testSerialize() {
$property = new SupportedCalendarComponentSet(['VEVENT', 'VTODO']);
$xml = $this->write(['{DAV:}root' => $property]);
$this->assertXmlStringEqualsXmlString(
'
', $xml);
}
function testUnserialize() {
$cal = CalDAV\Plugin::NS_CALDAV;
$cs = CalDAV\Plugin::NS_CALENDARSERVER;
$xml = <<
XML;
$result = $this->parse(
$xml,
['{DAV:}root' => 'Sabre\\CalDAV\\Xml\\Property\\SupportedCalendarComponentSet']
);
$this->assertEquals(
new SupportedCalendarComponentSet(['VEVENT', 'VTODO']),
$result['value']
);
}
/**
* @expectedException \Sabre\Xml\ParseException
*/
function testUnserializeEmpty() {
$cal = CalDAV\Plugin::NS_CALDAV;
$cs = CalDAV\Plugin::NS_CALENDARSERVER;
$xml = <<
XML;
$result = $this->parse(
$xml,
['{DAV:}root' => 'Sabre\\CalDAV\\Xml\\Property\\SupportedCalendarComponentSet']
);
$this->assertEquals(
new SupportedCalendarComponentSet([]),
$result['value']
);
}
}