mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-09 09:58:49 +00:00
Initial Release of the calendar plugin
This commit is contained in:
parent
45cc9885fc
commit
7115197a33
561 changed files with 189494 additions and 0 deletions
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
class Sabre_CalDAV_Property_SupportedCalendarComponentSetTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
function testSimple() {
|
||||
|
||||
$sccs = new Sabre_CalDAV_Property_SupportedCalendarComponentSet(array('VEVENT'));
|
||||
$this->assertEquals(array('VEVENT'), $sccs->getValue());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSimple
|
||||
*/
|
||||
function testSerialize() {
|
||||
|
||||
$property = new Sabre_CalDAV_Property_SupportedCalendarComponentSet(array('VEVENT','VJOURNAL'));
|
||||
|
||||
$doc = new DOMDocument();
|
||||
$root = $doc->createElement('d:root');
|
||||
$root->setAttribute('xmlns:d','DAV:');
|
||||
$root->setAttribute('xmlns:cal',Sabre_CalDAV_Plugin::NS_CALDAV);
|
||||
|
||||
$doc->appendChild($root);
|
||||
$objectTree = new Sabre_DAV_ObjectTree(new Sabre_DAV_SimpleCollection('rootdir'));
|
||||
$server = new Sabre_DAV_Server($objectTree);
|
||||
|
||||
$property->serialize($server, $root);
|
||||
|
||||
$xml = $doc->saveXML();
|
||||
|
||||
$this->assertEquals(
|
||||
'<?xml version="1.0"?>
|
||||
<d:root xmlns:d="DAV:" xmlns:cal="' . Sabre_CalDAV_Plugin::NS_CALDAV . '">' .
|
||||
'<cal:comp name="VEVENT"/>' .
|
||||
'<cal:comp name="VJOURNAL"/>' .
|
||||
'</d:root>
|
||||
', $xml);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSimple
|
||||
*/
|
||||
function testUnserializer() {
|
||||
|
||||
$xml = '<?xml version="1.0"?>
|
||||
<d:root xmlns:d="DAV:" xmlns:cal="' . Sabre_CalDAV_Plugin::NS_CALDAV . '">' .
|
||||
'<cal:comp name="VEVENT"/>' .
|
||||
'<cal:comp name="VJOURNAL"/>' .
|
||||
'</d:root>';
|
||||
|
||||
$dom = Sabre_DAV_XMLUtil::loadDOMDocument($xml);
|
||||
|
||||
$property = Sabre_CalDAV_Property_SupportedCalendarComponentSet::unserialize($dom->firstChild);
|
||||
|
||||
$this->assertTrue($property instanceof Sabre_CalDAV_Property_SupportedCalendarComponentSet);
|
||||
$this->assertEquals(array(
|
||||
'VEVENT',
|
||||
'VJOURNAL',
|
||||
),
|
||||
$property->getValue());
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue