[Pkg-owncloud-commits] [php-sabredav] 38/45: Bugfix and unittest.
David Prévot
taffit at moszumanska.debian.org
Sat Jan 10 14:20:34 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository php-sabredav.
commit 97265cb5f5b2502a0d92e185fa31ff448f45b459
Author: Evert Pot <me at evertpot.com>
Date: Fri Jan 9 18:13:12 2015 -0500
Bugfix and unittest.
Fixes #539.
---
lib/CalDAV/Backend/AbstractBackend.php | 2 +-
tests/Sabre/CalDAV/Backend/AbstractTest.php | 54 ++++++++++++++++++++++-------
2 files changed, 42 insertions(+), 14 deletions(-)
diff --git a/lib/CalDAV/Backend/AbstractBackend.php b/lib/CalDAV/Backend/AbstractBackend.php
index 0538adb..4191a1d 100644
--- a/lib/CalDAV/Backend/AbstractBackend.php
+++ b/lib/CalDAV/Backend/AbstractBackend.php
@@ -177,7 +177,7 @@ abstract class AbstractBackend implements BackendInterface {
}
// Ignore calendars that are shared.
- if (isset($calendar['{http://sabredav.org/ns}owner-principal']) && $calendar['{http://sabredav.org}owner-principal']!==$principalUri) {
+ if (isset($calendar['{http://sabredav.org/ns}owner-principal']) && $calendar['{http://sabredav.org/ns}owner-principal']!==$principalUri) {
continue;
}
diff --git a/tests/Sabre/CalDAV/Backend/AbstractTest.php b/tests/Sabre/CalDAV/Backend/AbstractTest.php
index 2bf3046..106ce1f 100644
--- a/tests/Sabre/CalDAV/Backend/AbstractTest.php
+++ b/tests/Sabre/CalDAV/Backend/AbstractTest.php
@@ -55,7 +55,10 @@ class AbstractTest extends \PHPUnit_Framework_TestCase {
$abstract->getCalendarObjectByUID('principal1', 'foo')
);
$this->assertNull(
- $abstract->getCalendarObjectByUID('principal22', 'foo')
+ $abstract->getCalendarObjectByUID('principal3', 'foo')
+ );
+ $this->assertNull(
+ $abstract->getCalendarObjectByUID('principal1', 'shared')
);
}
@@ -100,6 +103,12 @@ class AbstractMock extends AbstractBackend {
'principaluri' => 'principal1',
'uri' => 'cal1',
),
+ array(
+ 'id' => 2,
+ 'principaluri' => 'principal1',
+ '{http://sabredav.org/ns}owner-principal' => 'principal2',
+ 'uri' => 'cal1',
+ ),
);
}
@@ -107,20 +116,32 @@ class AbstractMock extends AbstractBackend {
function deleteCalendar($calendarId) { }
function getCalendarObjects($calendarId) {
- return array(
- array(
- 'id' => 1,
- 'calendarid' => 1,
- 'uri' => 'event1.ics',
- ),
- array(
- 'id' => 2,
- 'calendarid' => 1,
- 'uri' => 'task1.ics',
- ),
- );
+ switch($calendarId) {
+ case 1:
+ return [
+ [
+ 'id' => 1,
+ 'calendarid' => 1,
+ 'uri' => 'event1.ics',
+ ],
+ [
+ 'id' => 2,
+ 'calendarid' => 1,
+ 'uri' => 'task1.ics',
+ ],
+ ];
+ case 2:
+ return [
+ [
+ 'id' => 3,
+ 'calendarid' => 2,
+ 'uri' => 'shared-event.ics',
+ ]
+ ];
+ }
}
+
function getCalendarObject($calendarId, $objectUri) {
switch($objectUri) {
@@ -139,6 +160,13 @@ class AbstractMock extends AbstractBackend {
'uri' => 'task1.ics',
'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n",
);
+ case 'shared-event.ics' :
+ return array(
+ 'id' => 3,
+ 'calendarid' => 2,
+ 'uri' => 'event1.ics',
+ 'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:shared\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n",
+ );
}
--
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