[Pkg-owncloud-commits] [php-sabre-vobject] 06/46: add test for VCalendar expand with RDate
David Prévot
taffit at moszumanska.debian.org
Thu Dec 10 02:12:37 UTC 2015
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 654f718feef997f2a3271a7b30b891ea43347e9d
Author: Jan Kantert <kantert at sra.uni-hannover.de>
Date: Wed Oct 14 21:30:32 2015 +0200
add test for VCalendar expand with RDate
---
.../Recur/EventIterator/HandleRDateExpandTest.php | 59 ++++++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/tests/VObject/Recur/EventIterator/HandleRDateExpandTest.php b/tests/VObject/Recur/EventIterator/HandleRDateExpandTest.php
new file mode 100644
index 0000000..027fc55
--- /dev/null
+++ b/tests/VObject/Recur/EventIterator/HandleRDateExpandTest.php
@@ -0,0 +1,59 @@
+<?php
+
+namespace Sabre\VObject;
+
+use DateTime;
+use DateTimeImmutable;
+use DateTimeZone;
+
+/**
+ * This is a unittest for Issue #53.
+ */
+class HandleRDateExpandTest extends \PHPUnit_Framework_TestCase {
+
+ function testExpand() {
+
+ $input = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+UID:2CD5887F7CF4600F7A3B1F8065099E40-240BDA7121B61224
+DTSTAMP;VALUE=DATE-TIME:20151014T110604Z
+CREATED;VALUE=DATE-TIME:20151014T110245Z
+LAST-MODIFIED;VALUE=DATE-TIME:20151014T110541Z
+DTSTART;VALUE=DATE-TIME;TZID=Europe/Berlin:20151012T020000
+DTEND;VALUE=DATE-TIME;TZID=Europe/Berlin:20151012T013000
+SUMMARY:Test
+SEQUENCE:2
+RDATE;VALUE=DATE-TIME;TZID=Europe/Berlin:20151015T020000,20151017T020000,20
+ 151018T020000,20151020T020000
+TRANSP:OPAQUE
+CLASS:PUBLIC
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+ $vcal = Reader::read($input);
+ $this->assertInstanceOf('Sabre\\VObject\\Component\\VCalendar', $vcal);
+
+ $vcal->expand(new DateTime('2015-01-01'), new DateTime('2015-12-01'));
+
+ $result = iterator_to_array($vcal->vevent);
+
+ $this->assertEquals(5, count($result));
+
+ $utc = new DateTimeZone('UTC');
+ $expected = array(
+ new DateTimeImmutable("2015-10-12", $utc),
+ new DateTimeImmutable("2015-10-15", $utc),
+ new DateTimeImmutable("2015-10-17", $utc),
+ new DateTimeImmutable("2015-10-18", $utc),
+ new DateTimeImmutable("2015-10-20", $utc),
+ );
+
+ $result = array_map(function($ev){return $ev->dtstart->getDateTime();}, $result);
+ $this->assertEquals($expected, $result);
+
+ }
+
+}
--
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