[Pkg-owncloud-commits] [php-sabredav] 28/40: Added SupportedCalendarComponentSetTest
David Prévot
taffit at moszumanska.debian.org
Sat Sep 5 15:24:09 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to tag 3.1.0-alpha2
in repository php-sabredav.
commit cd4e193e5fbaee33eeaf0e3e6e5945c43e0fa289
Author: Dominik Tobschall <dominik at fruux.com>
Date: Wed Aug 26 09:50:26 2015 +0200
Added SupportedCalendarComponentSetTest
---
.../Property/SupportedCalendarComponentSetTest.php | 104 +++++++++++++++++++++
1 file changed, 104 insertions(+)
diff --git a/tests/Sabre/CalDAV/Xml/Property/SupportedCalendarComponentSetTest.php b/tests/Sabre/CalDAV/Xml/Property/SupportedCalendarComponentSetTest.php
new file mode 100644
index 0000000..0785e7c
--- /dev/null
+++ b/tests/Sabre/CalDAV/Xml/Property/SupportedCalendarComponentSetTest.php
@@ -0,0 +1,104 @@
+<?php
+
+namespace Sabre\CalDAV\Xml\Property;
+
+use Sabre\CalDAV;
+use Sabre\DAV;
+
+class SupportedCalendarComponentSetTest extends DAV\Xml\XmlTest {
+
+ function setUp() {
+
+ $this->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 version="1.0"?>
+<d:root xmlns:d="DAV:" xmlns:cal="' . CalDAV\Plugin::NS_CALDAV . '" xmlns:cs="' . CalDAV\Plugin::NS_CALENDARSERVER . '">
+ <cal:comp name="VEVENT"/>
+ <cal:comp name="VTODO"/>
+</d:root>
+', $xml);
+
+ }
+
+ function testUnserialize() {
+
+ $cal = CalDAV\Plugin::NS_CALDAV;
+ $cs = CalDAV\Plugin::NS_CALENDARSERVER;
+
+$xml = <<<XML
+<?xml version="1.0"?>
+ <d:root xmlns:cal="$cal" xmlns:cs="$cs" xmlns:d="DAV:">
+ <cal:comp name="VEVENT"/>
+ <cal:comp name="VTODO"/>
+ </d:root>
+XML;
+
+ $result = $this->parse(
+ $xml,
+ ['{DAV:}root' => 'Sabre\\CalDAV\\Xml\\Property\\SupportedCalendarComponentSet']
+ );
+
+ $this->assertEquals(
+ new SupportedCalendarComponentSet(['VEVENT', 'VTODO']),
+ $result['value']
+ );
+
+ }
+
+ function testUnserializeEmpty() {
+
+ $cal = CalDAV\Plugin::NS_CALDAV;
+ $cs = CalDAV\Plugin::NS_CALENDARSERVER;
+
+$xml = <<<XML
+<?xml version="1.0"?>
+ <d:root xmlns:cal="$cal" xmlns:cs="$cs" xmlns:d="DAV:">
+ </d:root>
+XML;
+
+ $result = $this->parse(
+ $xml,
+ ['{DAV:}root' => 'Sabre\\CalDAV\\Xml\\Property\\SupportedCalendarComponentSet']
+ );
+
+ $this->assertEquals(
+ new SupportedCalendarComponentSet([]),
+ $result['value']
+ );
+
+ }
+
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git
More information about the Pkg-owncloud-commits
mailing list