[Pkg-owncloud-commits] [php-sabre-vobject] 27/32: A few more unittests.
David Prévot
taffit at moszumanska.debian.org
Fri Nov 28 22:27:12 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository php-sabre-vobject.
commit 8ddc2c9f0468c0a810fd827eb682ca15fc42c8e7
Author: Evert Pot <me at evertpot.com>
Date: Wed Nov 19 17:14:34 2014 -0500
A few more unittests.
---
lib/ITip/Broker.php | 4 +
tests/VObject/ITip/BrokerAttendeeReplyTest.php | 145 +++++++++++++++++++++++++
tests/VObject/Parser/MimeDirTest.php | 21 ++++
3 files changed, 170 insertions(+)
diff --git a/lib/ITip/Broker.php b/lib/ITip/Broker.php
index 73534b6..a256756 100644
--- a/lib/ITip/Broker.php
+++ b/lib/ITip/Broker.php
@@ -736,6 +736,10 @@ class Broker {
$event->add('SUMMARY', $summary);
}
} else {
+ // This branch of the code is reached, when a reply is
+ // generated for an instance of a recurring event, through the
+ // fact that the instance has disappeared by showing up in
+ // EXDATE
$dt = DateTimeParser::parse($instance['id'], $eventInfo['timezone']);
// Treat is as a DATE field
if (strlen($instance['id']) <= 8) {
diff --git a/tests/VObject/ITip/BrokerAttendeeReplyTest.php b/tests/VObject/ITip/BrokerAttendeeReplyTest.php
index daa9666..c82ec1d 100644
--- a/tests/VObject/ITip/BrokerAttendeeReplyTest.php
+++ b/tests/VObject/ITip/BrokerAttendeeReplyTest.php
@@ -11,6 +11,7 @@ BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
UID:foobar
+SUMMARY:B-day party
SEQUENCE:1
ORGANIZER;CN=Strunk:mailto:strunk at example.org
ATTENDEE;CN=One:mailto:one at example.org
@@ -25,6 +26,7 @@ BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
UID:foobar
+SUMMARY:B-day party
SEQUENCE:1
ORGANIZER;CN=Strunk:mailto:strunk at example.org
ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one at example.org
@@ -54,6 +56,7 @@ BEGIN:VEVENT
UID:foobar
SEQUENCE:1
DTSTART:20140716T120000Z
+SUMMARY:B-day party
ORGANIZER;CN=Strunk:mailto:strunk at example.org
ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one at example.org
END:VEVENT
@@ -79,6 +82,7 @@ SEQUENCE:1
ORGANIZER;CN=Strunk:mailto:strunk at example.org
ATTENDEE;CN=One:mailto:one at example.org
DTSTART:20140724T120000Z
+SUMMARY:Daily sprint
RRULE;FREQ=DAILY
END:VEVENT
END:VCALENDAR
@@ -94,6 +98,7 @@ SEQUENCE:1
ORGANIZER;CN=Strunk:mailto:strunk at example.org
ATTENDEE;PARTSTAT=NEEDS-ACTION;CN=One:mailto:one at example.org
DTSTART:20140724T120000Z
+SUMMARY:Daily sprint
END:VEVENT
BEGIN:VEVENT
UID:foobar
@@ -159,6 +164,7 @@ BEGIN:VEVENT
UID:foobar
SEQUENCE:1
DTSTART:20140726T120000Z
+SUMMARY:Daily sprint
RECURRENCE-ID:20140726T120000Z
ORGANIZER;CN=Strunk:mailto:strunk at example.org
ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one at example.org
@@ -167,6 +173,7 @@ BEGIN:VEVENT
UID:foobar
SEQUENCE:1
DTSTART:20140724T120000Z
+SUMMARY:Daily sprint
RECURRENCE-ID:20140724T120000Z
ORGANIZER;CN=Strunk:mailto:strunk at example.org
ATTENDEE;PARTSTAT=DECLINED;CN=One:mailto:one at example.org
@@ -175,6 +182,7 @@ BEGIN:VEVENT
UID:foobar
SEQUENCE:1
DTSTART:20140728T120000Z
+SUMMARY:Daily sprint
RECURRENCE-ID:20140728T120000Z
ORGANIZER;CN=Strunk:mailto:strunk at example.org
ATTENDEE;PARTSTAT=TENTATIVE;CN=One:mailto:one at example.org
@@ -183,6 +191,7 @@ BEGIN:VEVENT
UID:foobar
SEQUENCE:1
DTSTART:20140729T120000Z
+SUMMARY:Daily sprint
RECURRENCE-ID:20140729T120000Z
ORGANIZER;CN=Strunk:mailto:strunk at example.org
ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one at example.org
@@ -191,6 +200,7 @@ BEGIN:VEVENT
UID:foobar
SEQUENCE:1
DTSTART:20140725T120000Z
+SUMMARY:Daily sprint
RECURRENCE-ID:20140725T120000Z
ORGANIZER;CN=Strunk:mailto:strunk at example.org
ATTENDEE;PARTSTAT=DECLINED;CN=One:mailto:one at example.org
@@ -618,6 +628,77 @@ ICS
}
+ /**
+ * @depends testCreateReplyByException
+ */
+ function testCreateReplyByExceptionAllDay() {
+
+
+ $oldMessage = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+SUMMARY:Weekly meeting
+UID:foobar
+SEQUENCE:1
+DTSTART;VALUE=DATE:20140811
+RRULE:FREQ=WEEKLY
+ORGANIZER:mailto:organizer at example.org
+ATTENDEE:mailto:one at example.org
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+ $newMessage = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+SUMMARY:Weekly meeting
+UID:foobar
+SEQUENCE:1
+DTSTART;VALUE=DATE:20140811
+RRULE:FREQ=WEEKLY
+ORGANIZER:mailto:organizer at example.org
+ATTENDEE:mailto:one at example.org
+EXDATE;VALUE=DATE:20140818
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+ $version = \Sabre\VObject\Version::VERSION;
+ $expected = array(
+ array(
+ 'uid' => 'foobar',
+ 'method' => 'REPLY',
+ 'component' => 'VEVENT',
+ 'sender' => 'mailto:one at example.org',
+ 'senderName' => null,
+ 'recipient' => 'mailto:organizer at example.org',
+ 'recipientName' => null,
+ 'message' => <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Sabre//Sabre VObject $version//EN
+CALSCALE:GREGORIAN
+METHOD:REPLY
+BEGIN:VEVENT
+UID:foobar
+SEQUENCE:1
+DTSTART;VALUE=DATE:20140818
+SUMMARY:Weekly meeting
+RECURRENCE-ID;VALUE=DATE:20140818
+ORGANIZER:mailto:organizer at example.org
+ATTENDEE;PARTSTAT=DECLINED:mailto:one at example.org
+END:VEVENT
+END:VCALENDAR
+ICS
+
+ ),
+ );
+ $result = $this->parse($oldMessage, $newMessage, $expected);
+
+ }
+
function testDeclined() {
$oldMessage = <<<ICS
@@ -814,4 +895,68 @@ ICS;
}
+ function testAcceptedAllDay() {
+
+ $oldMessage = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+UID:foobar
+SEQUENCE:1
+ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;CN=One:mailto:one at example.org
+DTSTART;VALUE=DATE:20140716
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+
+ $newMessage = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+UID:foobar
+SEQUENCE:1
+ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one at example.org
+DTSTART;VALUE=DATE:20140716
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+ $version = \Sabre\VObject\Version::VERSION;
+
+ $expected = array(
+ array(
+ 'uid' => 'foobar',
+ 'method' => 'REPLY',
+ 'component' => 'VEVENT',
+ 'sender' => 'mailto:one at example.org',
+ 'senderName' => 'One',
+ 'recipient' => 'mailto:strunk at example.org',
+ 'recipientName' => 'Strunk',
+ 'message' => <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Sabre//Sabre VObject $version//EN
+CALSCALE:GREGORIAN
+METHOD:REPLY
+BEGIN:VEVENT
+UID:foobar
+SEQUENCE:1
+DTSTART;VALUE=DATE:20140716
+ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one at example.org
+END:VEVENT
+END:VCALENDAR
+ICS
+
+ ),
+
+ );
+
+ $result = $this->parse($oldMessage, $newMessage, $expected);
+
+ }
+
}
diff --git a/tests/VObject/Parser/MimeDirTest.php b/tests/VObject/Parser/MimeDirTest.php
new file mode 100644
index 0000000..b4ee47c
--- /dev/null
+++ b/tests/VObject/Parser/MimeDirTest.php
@@ -0,0 +1,21 @@
+<?php
+
+namespace Sabre\VObject\Parser;
+
+/**
+ * Note that most MimeDir related tests can actually be found in the ReaderTest
+ * class one level up.
+ */
+class MimeDirTest extends \PHPUnit_Framework_TestCase {
+
+ /**
+ * @expectedException \Sabre\VObject\ParseException
+ */
+ function testParseError() {
+
+ $mimeDir = new MimeDir();
+ $mimeDir->parse(fopen(__FILE__,'a'));
+
+ }
+
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabre-vobject.git
More information about the Pkg-owncloud-commits
mailing list