[Pkg-owncloud-commits] [php-sabre-vobject] 55/106: More passing tests.
David Prévot
taffit at moszumanska.debian.org
Fri Aug 22 15:11:02 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 bfc871473612ac8be81d3d5cd465a49b867c46a6
Author: Evert Pot <evert at rooftopsolutions.nl>
Date: Sat Aug 2 23:09:04 2014 -0400
More passing tests.
---
lib/Sabre/VObject/Component.php | 9 ++++++++-
lib/Sabre/VObject/RecurrenceIterator.php | 15 ++++++---------
tests/Sabre/VObject/ComponentTest.php | 6 ++++--
tests/Sabre/VObject/DocumentTest.php | 5 +++++
tests/Sabre/VObject/FreeBusyGeneratorTest.php | 14 ++++++++++++++
5 files changed, 37 insertions(+), 12 deletions(-)
diff --git a/lib/Sabre/VObject/Component.php b/lib/Sabre/VObject/Component.php
index 00e2694..2e5c9cf 100644
--- a/lib/Sabre/VObject/Component.php
+++ b/lib/Sabre/VObject/Component.php
@@ -53,7 +53,7 @@ class Component extends Node {
$this->root = $root;
if ($defaults) {
- $children = array_merge($this->getDefaults(), $children);
+ $defaultProps = $this->getDefaults();
}
foreach($children as $k=>$child) {
@@ -67,6 +67,13 @@ class Component extends Node {
$this->add($k, $child);
}
}
+ if ($defaults) {
+ foreach($this->getDefaults() as $key=>$value) {
+ if (!isset($this->$key)) {
+ $this->add($key, $value);
+ }
+ }
+ }
}
diff --git a/lib/Sabre/VObject/RecurrenceIterator.php b/lib/Sabre/VObject/RecurrenceIterator.php
index d0dd605..b5beb1a 100644
--- a/lib/Sabre/VObject/RecurrenceIterator.php
+++ b/lib/Sabre/VObject/RecurrenceIterator.php
@@ -68,7 +68,6 @@ class RecurrenceIterator implements \Iterator {
$rrule = null;
if ($vcal instanceof VEvent) {
// Single instance mode.
- $uid = (string)$vcal->UID;
$events = array($vcal);
} else {
$uid = (string)$uid;
@@ -78,19 +77,17 @@ class RecurrenceIterator implements \Iterator {
if (!isset($vcal->VEVENT)) {
throw new InvalidArgumentException('No events found in this calendar');
}
- $events = $vcal->VEVENT;
+ $events = array();
+ foreach($vcal->VEVENT as $event) {
+ if ($event->uid->getValue() === $uid) {
+ $events[] = $event;
+ }
+ }
}
foreach($events as $vevent) {
- if (!isset($vevent->UID)) {
- throw new InvalidArgumentException('An event MUST have a UID');
- }
- if ($uid !== $vevent->UID->getValue()) {
- continue;
- }
-
if (!isset($vevent->{'RECURRENCE-ID'})) {
$this->masterEvent = $vevent;
diff --git a/tests/Sabre/VObject/ComponentTest.php b/tests/Sabre/VObject/ComponentTest.php
index b0c17a4..aef2d47 100644
--- a/tests/Sabre/VObject/ComponentTest.php
+++ b/tests/Sabre/VObject/ComponentTest.php
@@ -357,7 +357,8 @@ class ComponentTest extends \PHPUnit_Framework_TestCase {
function testSerializeChildren() {
$comp = new VCalendar(array(), false);
- $comp->add($comp->createComponent('VEVENT'));
+ $event = $comp->add($comp->createComponent('VEVENT'));
+ unset($event->DTSTAMP, $event->UID);
$comp->add($comp->createComponent('VTODO'));
$str = $comp->serialize();
@@ -369,11 +370,12 @@ class ComponentTest extends \PHPUnit_Framework_TestCase {
function testSerializeOrderCompAndProp() {
$comp = new VCalendar(array(), false);
- $comp->add($comp->createComponent('VEVENT'));
+ $comp->add($event = $comp->createComponent('VEVENT'));
$comp->add('PROP1','BLABLA');
$comp->add('VERSION','2.0');
$comp->add($comp->createComponent('VTIMEZONE'));
+ unset($event->DTSTAMP, $event->UID);
$str = $comp->serialize();
$this->assertEquals("BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPROP1:BLABLA\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n", $str);
diff --git a/tests/Sabre/VObject/DocumentTest.php b/tests/Sabre/VObject/DocumentTest.php
index 40d6b68..d019b39 100644
--- a/tests/Sabre/VObject/DocumentTest.php
+++ b/tests/Sabre/VObject/DocumentTest.php
@@ -32,6 +32,11 @@ class DocumentTest extends \PHPUnit_Framework_TestCase {
$event->add($prop);
+ unset(
+ $event->DTSTAMP,
+ $event->UID
+ );
+
$out = $vcal->serialize();
$this->assertEquals("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nX-PROP;X-PARAM=3:1234256\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n", $out);
diff --git a/tests/Sabre/VObject/FreeBusyGeneratorTest.php b/tests/Sabre/VObject/FreeBusyGeneratorTest.php
index 534cb55..5a0c6a9 100644
--- a/tests/Sabre/VObject/FreeBusyGeneratorTest.php
+++ b/tests/Sabre/VObject/FreeBusyGeneratorTest.php
@@ -10,6 +10,7 @@ class FreeBusyGeneratorTest extends \PHPUnit_Framework_TestCase {
$blob1 = <<<ICS
BEGIN:VCALENDAR
BEGIN:VEVENT
+UID:foobar
DTSTART:20110101T120000Z
DTEND:20110101T130000Z
END:VEVENT
@@ -20,6 +21,7 @@ ICS;
$blob2 = <<<ICS
BEGIN:VCALENDAR
BEGIN:VEVENT
+UID:foobar2
TRANSP:OPAQUE
DTSTART:20110101T130000Z
DTEND:20110101T140000Z
@@ -31,6 +33,7 @@ ICS;
$blob3 = <<<ICS
BEGIN:VCALENDAR
BEGIN:VEVENT
+UID:foobar3
TRANSP:TRANSPARENT
DTSTART:20110101T140000Z
DTEND:20110101T150000Z
@@ -42,6 +45,7 @@ ICS;
$blob4 = <<<ICS
BEGIN:VCALENDAR
BEGIN:VEVENT
+UID:foobar4
STATUS:CANCELLED
DTSTART:20110101T160000Z
DTEND:20110101T170000Z
@@ -53,6 +57,7 @@ ICS;
$blob5 = <<<ICS
BEGIN:VCALENDAR
BEGIN:VEVENT
+UID:foobar5
STATUS:TENTATIVE
DTSTART:20110101T180000Z
DTEND:20110101T190000Z
@@ -64,6 +69,7 @@ ICS;
$blob6 = <<<ICS
BEGIN:VCALENDAR
BEGIN:VEVENT
+UID:foobar6
DTSTART:20110101T090000Z
DTEND:20110101T100000Z
END:VEVENT
@@ -74,6 +80,8 @@ ICS;
$blob7 = <<<ICS
BEGIN:VCALENDAR
BEGIN:VEVENT
+UID:foobar7
+UID:foo
DTSTART:20110104T090000Z
DTEND:20110104T100000Z
END:VEVENT
@@ -84,6 +92,7 @@ ICS;
$blob8 = <<<ICS
BEGIN:VCALENDAR
BEGIN:VEVENT
+UID:foobar8
DTSTART:20110101T190000Z
DURATION:PT1H
END:VEVENT
@@ -95,6 +104,7 @@ ICS;
$blob9 = <<<ICS
BEGIN:VCALENDAR
BEGIN:VEVENT
+UID:foobar9
DTSTART;VALUE=DATE:20110102
END:VEVENT
END:VCALENDAR
@@ -105,6 +115,7 @@ ICS;
$blob10 = <<<ICS
BEGIN:VCALENDAR
BEGIN:VEVENT
+UID:foobar10
DTSTART:20110101T200000Z
END:VEVENT
END:VCALENDAR
@@ -114,6 +125,7 @@ ICS;
$blob11 = <<<ICS
BEGIN:VCALENDAR
BEGIN:VEVENT
+UID:foobar11
DTSTART:20110101T210000Z
DURATION:PT1H
END:VEVENT
@@ -137,6 +149,7 @@ ICS;
$blob13 = <<<ICS
BEGIN:VCALENDAR
BEGIN:VEVENT
+UID:foobar13
DTSTART:20100101T220000Z
DTEND:20100101T230000Z
RRULE:FREQ=YEARLY
@@ -148,6 +161,7 @@ ICS;
$blob14 = <<<ICS
BEGIN:VCALENDAR
BEGIN:VEVENT
+UID:foobar14
DTSTART:20100101T230000Z
DURATION:PT1H
RRULE:FREQ=YEARLY
--
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