From b35122f7a6ad42756c35bb60ba1f06c3dcd45c77 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 21 Oct 2013 15:46:31 -0700 Subject: add sabre (1.8.x) via composer in the !@#$ place it wants to be --- .../CalDAV/Property/AllowedSharingModesTest.php | 46 +++++ .../dav/tests/Sabre/CalDAV/Property/InviteTest.php | 196 +++++++++++++++++++++ .../CalDAV/Property/ScheduleCalendarTranspTest.php | 99 +++++++++++ .../Property/SupportedCalendarComponentSetTest.php | 67 +++++++ .../CalDAV/Property/SupportedCalendarDataTest.php | 44 +++++ .../CalDAV/Property/SupportedCollationSetTest.php | 46 +++++ 6 files changed, 498 insertions(+) create mode 100644 vendor/sabre/dav/tests/Sabre/CalDAV/Property/AllowedSharingModesTest.php create mode 100644 vendor/sabre/dav/tests/Sabre/CalDAV/Property/InviteTest.php create mode 100644 vendor/sabre/dav/tests/Sabre/CalDAV/Property/ScheduleCalendarTranspTest.php create mode 100644 vendor/sabre/dav/tests/Sabre/CalDAV/Property/SupportedCalendarComponentSetTest.php create mode 100644 vendor/sabre/dav/tests/Sabre/CalDAV/Property/SupportedCalendarDataTest.php create mode 100644 vendor/sabre/dav/tests/Sabre/CalDAV/Property/SupportedCollationSetTest.php (limited to 'vendor/sabre/dav/tests/Sabre/CalDAV/Property') diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Property/AllowedSharingModesTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Property/AllowedSharingModesTest.php new file mode 100644 index 000000000..733ea1108 --- /dev/null +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Property/AllowedSharingModesTest.php @@ -0,0 +1,46 @@ +createElement('d:root'); + $root->setAttribute('xmlns:d','DAV:'); + $root->setAttribute('xmlns:cal',CalDAV\Plugin::NS_CALDAV); + $root->setAttribute('xmlns:cs',CalDAV\Plugin::NS_CALENDARSERVER); + + $doc->appendChild($root); + $server = new DAV\Server(); + + $property->serialize($server, $root); + + $xml = $doc->saveXML(); + + $this->assertEquals( +' +' . +'' . +'' . +' +', $xml); + + } + +} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Property/InviteTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Property/InviteTest.php new file mode 100644 index 000000000..349a6e080 --- /dev/null +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Property/InviteTest.php @@ -0,0 +1,196 @@ + 'mailto:user1@example.org', + 'status' => CalDAV\SharingPlugin::STATUS_ACCEPTED, + 'readOnly' => false, + ), + array( + 'href' => 'mailto:user2@example.org', + 'commonName' => 'John Doe', + 'status' => CalDAV\SharingPlugin::STATUS_DECLINED, + 'readOnly' => true, + ), + array( + 'href' => 'mailto:user3@example.org', + 'commonName' => 'Joe Shmoe', + 'status' => CalDAV\SharingPlugin::STATUS_NORESPONSE, + 'readOnly' => true, + 'summary' => 'Something, something', + ), + array( + 'href' => 'mailto:user4@example.org', + 'commonName' => 'Hoe Boe', + 'status' => CalDAV\SharingPlugin::STATUS_INVALID, + 'readOnly' => true, + ), + ), array( + 'href' => 'mailto:thedoctor@example.org', + 'commonName' => 'The Doctor', + 'firstName' => 'The', + 'lastName' => 'Doctor', + )); + + $doc = new \DOMDocument(); + $doc->formatOutput = true; + $root = $doc->createElement('d:root'); + $root->setAttribute('xmlns:d','DAV:'); + $root->setAttribute('xmlns:cal',CalDAV\Plugin::NS_CALDAV); + $root->setAttribute('xmlns:cs',CalDAV\Plugin::NS_CALENDARSERVER); + + $doc->appendChild($root); + $server = new DAV\Server(); + + $property->serialize($server, $root); + + $xml = $doc->saveXML(); + + $this->assertEquals( +' + + + mailto:thedoctor@example.org + The Doctor + The + Doctor + + + mailto:user1@example.org + + + + + + + mailto:user2@example.org + John Doe + + + + + + + mailto:user3@example.org + Joe Shmoe + + + + + Something, something + + + mailto:user4@example.org + Hoe Boe + + + + + + +', $xml); + + } + + /** + * @depends testSerialize + */ + public function testUnserialize() { + + $input = array( + array( + 'href' => 'mailto:user1@example.org', + 'status' => CalDAV\SharingPlugin::STATUS_ACCEPTED, + 'readOnly' => false, + 'commonName' => '', + 'summary' => '', + ), + array( + 'href' => 'mailto:user2@example.org', + 'commonName' => 'John Doe', + 'status' => CalDAV\SharingPlugin::STATUS_DECLINED, + 'readOnly' => true, + 'summary' => '', + ), + array( + 'href' => 'mailto:user3@example.org', + 'commonName' => 'Joe Shmoe', + 'status' => CalDAV\SharingPlugin::STATUS_NORESPONSE, + 'readOnly' => true, + 'summary' => 'Something, something', + ), + array( + 'href' => 'mailto:user4@example.org', + 'commonName' => 'Hoe Boe', + 'status' => CalDAV\SharingPlugin::STATUS_INVALID, + 'readOnly' => true, + 'summary' => '', + ), + ); + + // Creating the xml + $doc = new \DOMDocument(); + $doc->formatOutput = true; + $root = $doc->createElement('d:root'); + $root->setAttribute('xmlns:d','DAV:'); + $root->setAttribute('xmlns:cal',CalDAV\Plugin::NS_CALDAV); + $root->setAttribute('xmlns:cs',CalDAV\Plugin::NS_CALENDARSERVER); + + $doc->appendChild($root); + $server = new DAV\Server(); + + $inputProperty = new Invite($input); + $inputProperty->serialize($server, $root); + + $xml = $doc->saveXML(); + + // Parsing it again + + $doc2 = DAV\XMLUtil::loadDOMDocument($xml); + + $outputProperty = Invite::unserialize($doc2->firstChild); + + $this->assertEquals($input, $outputProperty->getValue()); + + } + + /** + * @expectedException Sabre\DAV\Exception + */ + function testUnserializeNoStatus() { + +$xml = ' + + + mailto:user1@example.org + + + + + +'; + + $doc2 = DAV\XMLUtil::loadDOMDocument($xml); + $outputProperty = Invite::unserialize($doc2->firstChild); + + } + +} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Property/ScheduleCalendarTranspTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Property/ScheduleCalendarTranspTest.php new file mode 100644 index 000000000..1ace0b18f --- /dev/null +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Property/ScheduleCalendarTranspTest.php @@ -0,0 +1,99 @@ +assertEquals('transparent', $sccs->getValue()); + + } + + /** + * @expectedException InvalidArgumentException + */ + function testBadArg() { + + $sccs = new ScheduleCalendarTransp('foo'); + + } + + function values() { + + return array( + array('transparent'), + array('opaque'), + ); + + } + + /** + * @depends testSimple + * @dataProvider values + */ + function testSerialize($value) { + + $property = new ScheduleCalendarTransp($value); + + $doc = new \DOMDocument(); + $root = $doc->createElement('d:root'); + $root->setAttribute('xmlns:d','DAV:'); + $root->setAttribute('xmlns:cal',CalDAV\Plugin::NS_CALDAV); + + $doc->appendChild($root); + $server = new DAV\Server(); + + $property->serialize($server, $root); + + $xml = $doc->saveXML(); + + $this->assertEquals( +' +' . +'' . +' +', $xml); + + } + + /** + * @depends testSimple + * @dataProvider values + */ + function testUnserializer($value) { + + $xml = ' +' . +'' . +''; + + $dom = DAV\XMLUtil::loadDOMDocument($xml); + + $property = ScheduleCalendarTransp::unserialize($dom->firstChild); + + $this->assertTrue($property instanceof ScheduleCalendarTransp); + $this->assertEquals($value, $property->getValue()); + + } + + /** + * @depends testSimple + */ + function testUnserializerBadData() { + + $xml = ' +' . +'' . +''; + + $dom = DAV\XMLUtil::loadDOMDocument($xml); + + $this->assertNull(ScheduleCalendarTransp::unserialize($dom->firstChild)); + + } +} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Property/SupportedCalendarComponentSetTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Property/SupportedCalendarComponentSetTest.php new file mode 100644 index 000000000..3e5d5f5fc --- /dev/null +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Property/SupportedCalendarComponentSetTest.php @@ -0,0 +1,67 @@ +assertEquals(array('VEVENT'), $sccs->getValue()); + + } + + /** + * @depends testSimple + */ + function testSerialize() { + + $property = new 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); + $server = new \Sabre\DAV\Server(); + + $property->serialize($server, $root); + + $xml = $doc->saveXML(); + + $this->assertEquals( +' +' . +'' . +'' . +' +', $xml); + + } + + /** + * @depends testSimple + */ + function testUnserializer() { + + $xml = ' +' . +'' . +'' . +''; + + $dom = \Sabre\DAV\XMLUtil::loadDOMDocument($xml); + + $property = SupportedCalendarComponentSet::unserialize($dom->firstChild); + + $this->assertTrue($property instanceof SupportedCalendarComponentSet); + $this->assertEquals(array( + 'VEVENT', + 'VJOURNAL', + ), + $property->getValue()); + + } + +} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Property/SupportedCalendarDataTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Property/SupportedCalendarDataTest.php new file mode 100644 index 000000000..3e016368c --- /dev/null +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Property/SupportedCalendarDataTest.php @@ -0,0 +1,44 @@ +createElement('d:root'); + $root->setAttribute('xmlns:d','DAV:'); + $root->setAttribute('xmlns:cal',CalDAV\Plugin::NS_CALDAV); + + $doc->appendChild($root); + $server = new DAV\Server(); + + $property->serialize($server, $root); + + $xml = $doc->saveXML(); + + $this->assertEquals( +' +' . +'' . +' +', $xml); + + } + +} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Property/SupportedCollationSetTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Property/SupportedCollationSetTest.php new file mode 100644 index 000000000..669e31553 --- /dev/null +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Property/SupportedCollationSetTest.php @@ -0,0 +1,46 @@ +createElement('d:root'); + $root->setAttribute('xmlns:d','DAV:'); + $root->setAttribute('xmlns:cal',CalDAV\Plugin::NS_CALDAV); + + $doc->appendChild($root); + $server = new DAV\Server(); + + $property->serialize($server, $root); + + $xml = $doc->saveXML(); + + $this->assertEquals( +' +' . +'i;ascii-casemap' . +'i;octet' . +'i;unicode-casemap' . +' +', $xml); + + } + +} -- cgit v1.2.3