[Pkg-owncloud-commits] [php-sabre-vobject] 02/30: Fix issue 290: fix vcalendar#getBaseComponent filter feature
David Prévot
taffit at moszumanska.debian.org
Sun Mar 13 00:53:00 UTC 2016
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 4b79c883ba5d641416b58a11758ed5021ddd9669
Author: Graham Crosmarie <gcrosmarie at linagora.com>
Date: Wed Jan 13 09:45:50 2016 +0100
Fix issue 290: fix vcalendar#getBaseComponent filter feature
---
lib/Component/VCalendar.php | 2 +-
tests/VObject/Component/VCalendarTest.php | 49 +++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 1 deletion(-)
diff --git a/lib/Component/VCalendar.php b/lib/Component/VCalendar.php
index b22fed0..988db9d 100644
--- a/lib/Component/VCalendar.php
+++ b/lib/Component/VCalendar.php
@@ -253,8 +253,8 @@ class VCalendar extends VObject\Document {
if ($isBaseComponent($child)) {
return $child;
}
- return null;
}
+ return null;
}
// Searching all components
diff --git a/tests/VObject/Component/VCalendarTest.php b/tests/VObject/Component/VCalendarTest.php
index 4e92760..1f3455d 100644
--- a/tests/VObject/Component/VCalendarTest.php
+++ b/tests/VObject/Component/VCalendarTest.php
@@ -576,6 +576,55 @@ END:VCALENDAR
}
+ function testGetBaseComponentWithFilter() {
+
+ $input = 'BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:foo
+METHOD:REQUEST
+BEGIN:VEVENT
+SUMMARY:test
+DTSTART;VALUE=DATE:20111202
+UID:foo
+DTSTAMP:20140122T234434Z
+END:VEVENT
+BEGIN:VEVENT
+DTSTART;VALUE=DATE:20111202
+UID:foo
+DTSTAMP:20140122T234434Z
+RECURRENCE-ID;VALUE=DATE:20111202
+END:VEVENT
+END:VCALENDAR
+';
+
+ $vcal = VObject\Reader::read($input);
+
+ $result = $vcal->getBaseComponent('VEVENT');
+ $this->assertEquals('test', $result->SUMMARY->getValue());
+
+ }
+
+ function testGetBaseComponentWithFilterNoResult() {
+
+ $input = 'BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:foo
+METHOD:REQUEST
+BEGIN:VTODO
+SUMMARY:test
+UID:foo
+DTSTAMP:20140122T234434Z
+END:VTODO
+END:VCALENDAR
+';
+
+ $vcal = VObject\Reader::read($input);
+
+ $result = $vcal->getBaseComponent('VEVENT');
+ $this->assertNull($result);
+
+ }
+
function testNoComponents() {
$input = <<<ICS
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-php/php-sabre-vobject.git
More information about the Pkg-owncloud-commits
mailing list