aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/tests/Sabre/CalDAV
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/CalDAV')
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php634
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php53
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/Backend/PDOMySQLTest.php32
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/Backend/PDOSqliteTest.php30
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php166
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryVAlarmTest.php88
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php518
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php97
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php37
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/FreeBusyReportTest.php40
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php2
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/ICSExportPluginTest.php747
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/Issue166Test.php32
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/Issue172Test.php86
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/Issue205Test.php39
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/Issue211Test.php38
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/Issue220Test.php36
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/Issue228Test.php37
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/CollectionTest.php35
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/NodeTest.php25
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php13
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/Principal/CollectionTest.php5
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyReadTest.php19
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyWriteTest.php5
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/Principal/UserTest.php37
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/Schedule/OutboxTest.php73
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/ShareableCalendarTest.php60
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/SharedCalendarTest.php239
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/SharingPluginTest.php215
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/TestUtil.php65
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/ValidateICalTest.php291
31 files changed, 1994 insertions, 1800 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php
index 25f8b1794..2a00f7925 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php
@@ -5,11 +5,30 @@ namespace Sabre\CalDAV\Backend;
use Sabre\CalDAV;
use Sabre\DAV;
use Sabre\DAV\PropPatch;
+use Sabre\DAV\Xml\Element\Sharee;
abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
+ use DAV\DbTestHelperTrait;
+
protected $pdo;
+ function setUp() {
+
+ $this->dropTables([
+ 'calendarobjects',
+ 'calendars',
+ 'calendarinstances',
+ 'calendarchanges',
+ 'calendarsubscriptions',
+ 'schedulingobjects',
+ ]);
+ $this->createSchema('calendars');
+
+ $this->pdo = $this->getDb();
+
+ }
+
function testConstruct() {
$backend = new PDO($this->pdo);
@@ -42,11 +61,11 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$calendars = $backend->getCalendarsForUser('principals/user2');
$elementCheck = [
- 'id' => $returnedId,
'uri' => 'somerandomid',
'{DAV:}displayname' => 'Hello!',
'{urn:ietf:params:xml:ns:caldav}calendar-description' => '',
'{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp('transparent'),
+ 'share-access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER,
];
$this->assertInternalType('array', $calendars);
@@ -110,6 +129,27 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
}
/**
+ * @depends testConstruct
+ * @expectedException \InvalidArgumentException
+ */
+ function testUpdateCalendarBadId() {
+
+ $backend = new PDO($this->pdo);
+
+ //Creating a new calendar
+ $newId = $backend->createCalendar('principals/user2', 'somerandomid', []);
+
+ $propPatch = new PropPatch([
+ '{DAV:}displayname' => 'myCalendar',
+ '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp('transparent'),
+ ]);
+
+ // Updating the calendar
+ $backend->updateCalendar('raaaa', $propPatch);
+
+ }
+
+ /**
* @depends testUpdateCalendarAndFetch
*/
function testUpdateCalendarUnknownProperty() {
@@ -156,6 +196,22 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
/**
* @depends testCreateCalendarAndFetch
+ * @expectedException \InvalidArgumentException
+ */
+ function testDeleteCalendarBadID() {
+
+ $backend = new PDO($this->pdo);
+ $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', [
+ '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet(['VEVENT']),
+ '{DAV:}displayname' => 'Hello!',
+ ]);
+
+ $backend->deleteCalendar('bad-id');
+
+ }
+
+ /**
+ * @depends testCreateCalendarAndFetch
* @expectedException \Sabre\DAV\Exception
*/
function testCreateCalendarIncorrectComponentSet() {;
@@ -178,7 +234,13 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$backend->createCalendarObject($returnedId, 'random-id', $object);
- $result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = "random-id"');
+ $result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = \'random-id\'');
+
+ $row = $result->fetch(\PDO::FETCH_ASSOC);
+ if (is_resource($row['calendardata'])) {
+ $row['calendardata'] = stream_get_contents($row['calendardata']);
+ }
+
$this->assertEquals([
'etag' => md5($object),
'size' => strlen($object),
@@ -186,7 +248,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
'firstoccurence' => strtotime('20120101'),
'lastoccurence' => strtotime('20120101') + (3600 * 24),
'componenttype' => 'VEVENT',
- ], $result->fetch(\PDO::FETCH_ASSOC));
+ ], $row);
}
function testGetMultipleObjects() {
@@ -207,7 +269,6 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
'size' => strlen($object),
'calendardata' => $object,
'lastmodified' => null,
- 'calendarid' => $returnedId,
],
[
'id' => 2,
@@ -216,7 +277,6 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
'size' => strlen($object),
'calendardata' => $object,
'lastmodified' => null,
- 'calendarid' => $returnedId,
],
];
@@ -224,12 +284,22 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
foreach ($check as $index => $props) {
- foreach ($props as $key => $value) {
+ foreach ($props as $key => $expected) {
+
+ $actual = $result[$index][$key];
+
+ switch ($key) {
+ case 'lastmodified' :
+ $this->assertInternalType('int', $actual);
+ break;
+ case 'calendardata' :
+ if (is_resource($actual)) {
+ $actual = stream_get_contents($actual);
+ }
+ // no break intentional
+ default :
+ $this->assertEquals($expected, $actual);
- if ($key !== 'lastmodified') {
- $this->assertEquals($value, $result[$index][$key]);
- } else {
- $this->assertTrue(isset($result[$index][$key]));
}
}
@@ -239,6 +309,17 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
}
/**
+ * @depends testGetMultipleObjects
+ * @expectedException \InvalidArgumentException
+ */
+ function testGetMultipleObjectsBadId() {
+
+ $backend = new PDO($this->pdo);
+ $backend->getMultipleCalendarObjects('bad-id', ['foo-bar']);
+
+ }
+
+ /**
* @expectedException Sabre\DAV\Exception\BadRequest
* @depends testCreateCalendarObject
*/
@@ -265,7 +346,13 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$backend->createCalendarObject($returnedId, 'random-id', $object);
- $result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = "random-id"');
+ $result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = \'random-id\'');
+
+ $row = $result->fetch(\PDO::FETCH_ASSOC);
+ if (is_resource($row['calendardata'])) {
+ $row['calendardata'] = stream_get_contents($row['calendardata']);
+ }
+
$this->assertEquals([
'etag' => md5($object),
'size' => strlen($object),
@@ -273,10 +360,26 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
'firstoccurence' => strtotime('20120101'),
'lastoccurence' => strtotime('20120101') + (3600 * 48),
'componenttype' => 'VEVENT',
- ], $result->fetch(\PDO::FETCH_ASSOC));
+ ], $row);
+
+ }
+
+ /**
+ * @depends testCreateCalendarObject
+ * @expectedException \InvalidArgumentException
+ */
+ function testCreateCalendarObjectBadId() {
+
+ $backend = new PDO($this->pdo);
+ $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []);
+
+ $object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nDURATION:P2D\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n";
+
+ $backend->createCalendarObject('bad-id', 'random-id', $object);
}
+
/**
* @depends testCreateCalendarObject
*/
@@ -289,7 +392,12 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$backend->createCalendarObject($returnedId, 'random-id', $object);
- $result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = "random-id"');
+ $result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = \'random-id\'');
+ $row = $result->fetch(\PDO::FETCH_ASSOC);
+ if (is_resource($row['calendardata'])) {
+ $row['calendardata'] = stream_get_contents($row['calendardata']);
+ }
+
$this->assertEquals([
'etag' => md5($object),
'size' => strlen($object),
@@ -297,7 +405,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
'firstoccurence' => strtotime('2012-01-01 10:00:00'),
'lastoccurence' => strtotime('2012-01-01 10:00:00'),
'componenttype' => 'VEVENT',
- ], $result->fetch(\PDO::FETCH_ASSOC));
+ ], $row);
}
@@ -313,7 +421,12 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$backend->createCalendarObject($returnedId, 'random-id', $object);
- $result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = "random-id"');
+ $result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = \'random-id\'');
+ $row = $result->fetch(\PDO::FETCH_ASSOC);
+ if (is_resource($row['calendardata'])) {
+ $row['calendardata'] = stream_get_contents($row['calendardata']);
+ }
+
$this->assertEquals([
'etag' => md5($object),
'size' => strlen($object),
@@ -321,7 +434,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
'firstoccurence' => strtotime('2012-01-01 10:00:00'),
'lastoccurence' => strtotime('2012-01-01 11:00:00'),
'componenttype' => 'VEVENT',
- ], $result->fetch(\PDO::FETCH_ASSOC));
+ ], $row);
}
@@ -337,7 +450,12 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$backend->createCalendarObject($returnedId, 'random-id', $object);
- $result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = "random-id"');
+ $result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = \'random-id\'');
+ $row = $result->fetch(\PDO::FETCH_ASSOC);
+ if (is_resource($row['calendardata'])) {
+ $row['calendardata'] = stream_get_contents($row['calendardata']);
+ }
+
$this->assertEquals([
'etag' => md5($object),
'size' => strlen($object),
@@ -345,7 +463,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
'firstoccurence' => strtotime('2012-01-01 10:00:00'),
'lastoccurence' => strtotime(PDO::MAX_DATE),
'componenttype' => 'VEVENT',
- ], $result->fetch(\PDO::FETCH_ASSOC));
+ ], $row);
}
@@ -361,7 +479,12 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$backend->createCalendarObject($returnedId, 'random-id', $object);
- $result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = "random-id"');
+ $result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = \'random-id\'');
+ $row = $result->fetch(\PDO::FETCH_ASSOC);
+ if (is_resource($row['calendardata'])) {
+ $row['calendardata'] = stream_get_contents($row['calendardata']);
+ }
+
$this->assertEquals([
'etag' => md5($object),
'size' => strlen($object),
@@ -369,7 +492,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
'firstoccurence' => strtotime('2012-01-01 10:00:00'),
'lastoccurence' => strtotime('2012-01-01 11:00:00') + (3600 * 24 * 999),
'componenttype' => 'VEVENT',
- ], $result->fetch(\PDO::FETCH_ASSOC));
+ ], $row);
}
@@ -385,7 +508,12 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$backend->createCalendarObject($returnedId, 'random-id', $object);
- $result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = "random-id"');
+ $result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = \'random-id\'');
+ $row = $result->fetch(\PDO::FETCH_ASSOC);
+ if (is_resource($row['calendardata'])) {
+ $row['calendardata'] = stream_get_contents($row['calendardata']);
+ }
+
$this->assertEquals([
'etag' => md5($object),
'size' => strlen($object),
@@ -393,7 +521,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
'firstoccurence' => null,
'lastoccurence' => null,
'componenttype' => 'VTODO',
- ], $result->fetch(\PDO::FETCH_ASSOC));
+ ], $row);
}
@@ -408,17 +536,38 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n";
$backend->createCalendarObject($returnedId, 'random-id', $object);
- $data = $backend->getCalendarObjects($returnedId, 'random-id');
+ $data = $backend->getCalendarObjects($returnedId);
$this->assertEquals(1, count($data));
$data = $data[0];
- $this->assertEquals($returnedId, $data['calendarid']);
$this->assertEquals('random-id', $data['uri']);
$this->assertEquals(strlen($object), $data['size']);
+ }
+
+ /**
+ * @depends testGetCalendarObjects
+ * @expectedException \InvalidArgumentException
+ */
+ function testGetCalendarObjectsBadId() {
+
+ $backend = new PDO($this->pdo);
+ $backend->getCalendarObjects('bad-id');
}
+
+ /**
+ * @depends testGetCalendarObjects
+ * @expectedException \InvalidArgumentException
+ */
+ function testGetCalendarObjectBadId() {
+
+ $backend = new PDO($this->pdo);
+ $backend->getCalendarObject('bad-id', 'foo-bar');
+
+ }
+
/**
* @depends testCreateCalendarObject
*/
@@ -455,14 +604,28 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$data = $backend->getCalendarObject($returnedId, 'random-id');
+ if (is_resource($data['calendardata'])) {
+ $data['calendardata'] = stream_get_contents($data['calendardata']);
+ }
+
$this->assertEquals($object2, $data['calendardata']);
- $this->assertEquals($returnedId, $data['calendarid']);
$this->assertEquals('random-id', $data['uri']);
}
/**
+ * @depends testUpdateCalendarObject
+ * @expectedException \InvalidArgumentException
+ */
+ function testUpdateCalendarObjectBadId() {
+
+ $backend = new PDO($this->pdo);
+ $backend->updateCalendarObject('bad-id', 'object-id', 'objectdata');
+
+ }
+
+ /**
* @depends testCreateCalendarObject
*/
function testDeleteCalendarObject() {
@@ -479,6 +642,21 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
}
+ /**
+ * @depends testDeleteCalendarObject
+ * @expectedException \InvalidArgumentException
+ */
+ function testDeleteCalendarObjectBadId() {
+
+ $backend = new PDO($this->pdo);
+ $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []);
+
+ $object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n";
+ $backend->createCalendarObject($returnedId, 'random-id', $object);
+ $backend->deleteCalendarObject('bad-id', 'random-id');
+
+ }
+
function testCalendarQueryNoResult() {
$abstract = new PDO($this->pdo);
@@ -499,15 +677,42 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
];
$this->assertEquals([
- ], $abstract->calendarQuery(1, $filters));
+ ], $abstract->calendarQuery([1, 1], $filters));
+
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @depends testCalendarQueryNoResult
+ */
+ function testCalendarQueryBadId() {
+
+ $abstract = new PDO($this->pdo);
+ $filters = [
+ 'name' => 'VCALENDAR',
+ 'comp-filters' => [
+ [
+ 'name' => 'VJOURNAL',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
+ 'is-not-defined' => false,
+ 'time-range' => null,
+ ],
+ ],
+ 'prop-filters' => [],
+ 'is-not-defined' => false,
+ 'time-range' => null,
+ ];
+
+ $abstract->calendarQuery('bad-id', $filters);
}
function testCalendarQueryTodo() {
$backend = new PDO($this->pdo);
- $backend->createCalendarObject(1, "todo", "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n");
- $backend->createCalendarObject(1, "event", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
+ $backend->createCalendarObject([1, 1], "todo", "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n");
+ $backend->createCalendarObject([1, 1], "event", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
$filters = [
'name' => 'VCALENDAR',
@@ -527,14 +732,14 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals([
"todo",
- ], $backend->calendarQuery(1, $filters));
+ ], $backend->calendarQuery([1, 1], $filters));
}
function testCalendarQueryTodoNotMatch() {
$backend = new PDO($this->pdo);
- $backend->createCalendarObject(1, "todo", "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n");
- $backend->createCalendarObject(1, "event", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
+ $backend->createCalendarObject([1, 1], "todo", "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n");
+ $backend->createCalendarObject([1, 1], "event", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
$filters = [
'name' => 'VCALENDAR',
@@ -561,15 +766,15 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
];
$this->assertEquals([
- ], $backend->calendarQuery(1, $filters));
+ ], $backend->calendarQuery([1, 1], $filters));
}
function testCalendarQueryNoFilter() {
$backend = new PDO($this->pdo);
- $backend->createCalendarObject(1, "todo", "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n");
- $backend->createCalendarObject(1, "event", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
+ $backend->createCalendarObject([1, 1], "todo", "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n");
+ $backend->createCalendarObject([1, 1], "event", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
$filters = [
'name' => 'VCALENDAR',
@@ -579,7 +784,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
'time-range' => null,
];
- $result = $backend->calendarQuery(1, $filters);
+ $result = $backend->calendarQuery([1, 1], $filters);
$this->assertTrue(in_array('todo', $result));
$this->assertTrue(in_array('event', $result));
@@ -588,9 +793,9 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
function testCalendarQueryTimeRange() {
$backend = new PDO($this->pdo);
- $backend->createCalendarObject(1, "todo", "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n");
- $backend->createCalendarObject(1, "event", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
- $backend->createCalendarObject(1, "event2", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120103\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
+ $backend->createCalendarObject([1, 1], "todo", "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n");
+ $backend->createCalendarObject([1, 1], "event", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
+ $backend->createCalendarObject([1, 1], "event2", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120103\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
$filters = [
'name' => 'VCALENDAR',
@@ -613,15 +818,15 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals([
"event2",
- ], $backend->calendarQuery(1, $filters));
+ ], $backend->calendarQuery([1, 1], $filters));
}
function testCalendarQueryTimeRangeNoEnd() {
$backend = new PDO($this->pdo);
- $backend->createCalendarObject(1, "todo", "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n");
- $backend->createCalendarObject(1, "event", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
- $backend->createCalendarObject(1, "event2", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120103\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
+ $backend->createCalendarObject([1, 1], "todo", "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n");
+ $backend->createCalendarObject([1, 1], "event", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
+ $backend->createCalendarObject([1, 1], "event2", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120103\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
$filters = [
'name' => 'VCALENDAR',
@@ -644,7 +849,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals([
"event2",
- ], $backend->calendarQuery(1, $filters));
+ ], $backend->calendarQuery([1, 1], $filters));
}
@@ -694,6 +899,22 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
], $result);
}
+ /**
+ * @depends testGetChanges
+ * @expectedException \InvalidArgumentException
+ */
+ function testGetChangesBadId() {
+
+ $backend = new PDO($this->pdo);
+ $id = $backend->createCalendar(
+ 'principals/user1',
+ 'bla',
+ []
+ );
+ $backend->getChangesForCalendar('bad-id', null, 1);
+
+ }
+
function testCreateSubscriptions() {
$props = [
@@ -862,6 +1083,9 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$result = $backend->getSchedulingObject('principals/user1', 'schedule1.ics');
foreach ($expected as $k => $v) {
$this->assertArrayHasKey($k, $result);
+ if (is_resource($result[$k])) {
+ $result[$k] = stream_get_contents($result[$k]);
+ }
$this->assertEquals($v, $result[$k]);
}
@@ -870,6 +1094,9 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals(1, count($results));
$result = $results[0];
foreach ($expected as $k => $v) {
+ if (is_resource($result[$k])) {
+ $result[$k] = stream_get_contents($result[$k]);
+ }
$this->assertEquals($v, $result[$k]);
}
@@ -880,4 +1107,325 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
}
+ function testGetInvites() {
+
+ $backend = new PDO($this->pdo);
+
+ // creating a new calendar
+ $backend->createCalendar('principals/user1', 'somerandomid', []);
+ $calendar = $backend->getCalendarsForUser('principals/user1')[0];
+
+ $result = $backend->getInvites($calendar['id']);
+ $expected = [
+ new Sharee([
+ 'href' => 'principals/user1',
+ 'principal' => 'principals/user1',
+ 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER,
+ 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
+ ])
+ ];
+
+ $this->assertEquals($expected, $result);
+
+ }
+
+ /**
+ * @depends testGetInvites
+ * @expectedException \InvalidArgumentException
+ */
+ function testGetInvitesBadId() {
+
+ $backend = new PDO($this->pdo);
+
+ // creating a new calendar
+ $backend->createCalendar('principals/user1', 'somerandomid', []);
+ $calendar = $backend->getCalendarsForUser('principals/user1')[0];
+
+ $backend->getInvites('bad-id');
+
+ }
+
+ /**
+ * @depends testCreateCalendarAndFetch
+ */
+ function testUpdateInvites() {
+
+ $backend = new PDO($this->pdo);
+
+ // creating a new calendar
+ $backend->createCalendar('principals/user1', 'somerandomid', []);
+ $calendar = $backend->getCalendarsForUser('principals/user1')[0];
+
+ $ownerSharee = new Sharee([
+ 'href' => 'principals/user1',
+ 'principal' => 'principals/user1',
+ 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER,
+ 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
+ ]);
+
+ // Add a new invite
+ $backend->updateInvites(
+ $calendar['id'],
+ [
+ new Sharee([
+ 'href' => 'mailto:user@example.org',
+ 'principal' => 'principals/user2',
+ 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ,
+ 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
+ 'properties' => ['{DAV:}displayname' => 'User 2'],
+ ])
+ ]
+ );
+
+ $result = $backend->getInvites($calendar['id']);
+ $expected = [
+ $ownerSharee,
+ new Sharee([
+ 'href' => 'mailto:user@example.org',
+ 'principal' => 'principals/user2',
+ 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ,
+ 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
+ 'properties' => [
+ '{DAV:}displayname' => 'User 2',
+ ],
+ ])
+ ];
+ $this->assertEquals($expected, $result);
+
+ // Checking calendar_instances too
+ $expectedCalendar = [
+ 'id' => [1,2],
+ 'principaluri' => 'principals/user2',
+ '{http://calendarserver.org/ns/}getctag' => 'http://sabre.io/ns/sync/1',
+ '{http://sabredav.org/ns}sync-token' => '1',
+ 'share-access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ,
+ 'read-only' => true,
+ 'share-resource-uri' => '/ns/share/1',
+ ];
+ $calendars = $backend->getCalendarsForUser('principals/user2');
+
+ foreach ($expectedCalendar as $k => $v) {
+ $this->assertEquals(
+ $v,
+ $calendars[0][$k],
+ "Key " . $k . " in calendars array did not have the expected value."
+ );
+ }
+
+
+ // Updating an invite
+ $backend->updateInvites(
+ $calendar['id'],
+ [
+ new Sharee([
+ 'href' => 'mailto:user@example.org',
+ 'principal' => 'principals/user2',
+ 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE,
+ 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
+ ])
+ ]
+ );
+
+ $result = $backend->getInvites($calendar['id']);
+ $expected = [
+ $ownerSharee,
+ new Sharee([
+ 'href' => 'mailto:user@example.org',
+ 'principal' => 'principals/user2',
+ 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE,
+ 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
+ 'properties' => [
+ '{DAV:}displayname' => 'User 2',
+ ],
+ ])
+ ];
+ $this->assertEquals($expected, $result);
+
+ // Removing an invite
+ $backend->updateInvites(
+ $calendar['id'],
+ [
+ new Sharee([
+ 'href' => 'mailto:user@example.org',
+ 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS,
+ ])
+ ]
+ );
+
+ $result = $backend->getInvites($calendar['id']);
+ $expected = [
+ $ownerSharee
+ ];
+ $this->assertEquals($expected, $result);
+
+ // Preventing the owner share from being removed
+ $backend->updateInvites(
+ $calendar['id'],
+ [
+ new Sharee([
+ 'href' => 'principals/user2',
+ 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS,
+ ])
+ ]
+ );
+
+ $result = $backend->getInvites($calendar['id']);
+ $expected = [
+ new Sharee([
+ 'href' => 'principals/user1',
+ 'principal' => 'principals/user1',
+ 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER,
+ 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
+ ]),
+ ];
+ $this->assertEquals($expected, $result);
+
+ }
+
+ /**
+ * @depends testUpdateInvites
+ * @expectedException \InvalidArgumentException
+ */
+ function testUpdateInvitesBadId() {
+
+ $backend = new PDO($this->pdo);
+ // Add a new invite
+ $backend->updateInvites(
+ 'bad-id',
+ []
+ );
+
+ }
+
+ /**
+ * @depends testUpdateInvites
+ */
+ function testUpdateInvitesNoPrincipal() {
+
+ $backend = new PDO($this->pdo);
+
+ // creating a new calendar
+ $backend->createCalendar('principals/user1', 'somerandomid', []);
+ $calendar = $backend->getCalendarsForUser('principals/user1')[0];
+
+ $ownerSharee = new Sharee([
+ 'href' => 'principals/user1',
+ 'principal' => 'principals/user1',
+ 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER,
+ 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
+ ]);
+
+ // Add a new invite
+ $backend->updateInvites(
+ $calendar['id'],
+ [
+ new Sharee([
+ 'href' => 'mailto:user@example.org',
+ 'principal' => null,
+ 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ,
+ 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
+ 'properties' => ['{DAV:}displayname' => 'User 2'],
+ ])
+ ]
+ );
+
+ $result = $backend->getInvites($calendar['id']);
+ $expected = [
+ $ownerSharee,
+ new Sharee([
+ 'href' => 'mailto:user@example.org',
+ 'principal' => null,
+ 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ,
+ 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_INVALID,
+ 'properties' => [
+ '{DAV:}displayname' => 'User 2',
+ ],
+ ])
+ ];
+ $this->assertEquals($expected, $result, null, 0.0, 10, true); // Last argument is $canonicalize = true, which allows us to compare, ignoring the order, because it's different between MySQL and Sqlite.
+
+ }
+
+ /**
+ * @depends testUpdateInvites
+ */
+ function testDeleteSharedCalendar() {
+
+ $backend = new PDO($this->pdo);
+
+ // creating a new calendar
+ $backend->createCalendar('principals/user1', 'somerandomid', []);
+ $calendar = $backend->getCalendarsForUser('principals/user1')[0];
+
+ $ownerSharee = new Sharee([
+ 'href' => 'principals/user1',
+ 'principal' => 'principals/user1',
+ 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER,
+ 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
+ ]);
+
+ // Add a new invite
+ $backend->updateInvites(
+ $calendar['id'],
+ [
+ new Sharee([
+ 'href' => 'mailto:user@example.org',
+ 'principal' => 'principals/user2',
+ 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ,
+ 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
+ 'properties' => ['{DAV:}displayname' => 'User 2'],
+ ])
+ ]
+ );
+
+ $expectedCalendar = [
+ 'id' => [1,2],
+ 'principaluri' => 'principals/user2',
+ '{http://calendarserver.org/ns/}getctag' => 'http://sabre.io/ns/sync/1',
+ '{http://sabredav.org/ns}sync-token' => '1',
+ 'share-access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ,
+ 'read-only' => true,
+ 'share-resource-uri' => '/ns/share/1',
+ ];
+ $calendars = $backend->getCalendarsForUser('principals/user2');
+
+ foreach ($expectedCalendar as $k => $v) {
+ $this->assertEquals(
+ $v,
+ $calendars[0][$k],
+ "Key " . $k . " in calendars array did not have the expected value."
+ );
+ }
+
+ // Removing the shared calendar.
+ $backend->deleteCalendar($calendars[0]['id']);
+
+ $this->assertEquals(
+ [],
+ $backend->getCalendarsForUser('principals/user2')
+ );
+
+ $result = $backend->getInvites($calendar['id']);
+ $expected = [
+ new Sharee([
+ 'href' => 'principals/user1',
+ 'principal' => 'principals/user1',
+ 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER,
+ 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
+ ]),
+ ];
+ $this->assertEquals($expected, $result);
+
+ }
+
+ /**
+ * @expectedException \Sabre\DAV\Exception\NotImplemented
+ */
+ function testSetPublishStatus() {
+
+ $backend = new PDO($this->pdo);
+ $backend->setPublishStatus([1, 1], true);
+
+ }
+
}
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php
index 4412e5531..d4dcc07dc 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php
@@ -82,6 +82,46 @@ class Mock extends AbstractBackend {
}
/**
+ * Updates properties for a calendar.
+ *
+ * The list of mutations is stored in a Sabre\DAV\PropPatch object.
+ * To do the actual updates, you must tell this object which properties
+ * you're going to process with the handle() method.
+ *
+ * Calling the handle method is like telling the PropPatch object "I
+ * promise I can handle updating this property".
+ *
+ * Read the PropPatch documentation for more info and examples.
+ *
+ * @param mixed $calendarId
+ * @param \Sabre\DAV\PropPatch $propPatch
+ * @return void
+ */
+ function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) {
+
+ $propPatch->handleRemaining(function($props) use ($calendarId) {
+
+ foreach ($this->calendars as $k => $calendar) {
+
+ if ($calendar['id'] === $calendarId) {
+ foreach ($props as $propName => $propValue) {
+ if (is_null($propValue)) {
+ unset($this->calendars[$k][$propName]);
+ } else {
+ $this->calendars[$k][$propName] = $propValue;
+ }
+ }
+ return true;
+
+ }
+
+ }
+
+ });
+
+ }
+
+ /**
* Delete a calendar and all it's objects
*
* @param string $calendarId
@@ -139,18 +179,22 @@ class Mock extends AbstractBackend {
* Returns information from a single calendar object, based on it's object
* uri.
*
+ * The object uri is only the basename, or filename and not a full path.
+ *
* The returned array must have the same keys as getCalendarObjects. The
* 'calendardata' object is required here though, while it's not required
* for getCalendarObjects.
*
- * @param string $calendarId
+ * This method must return null if the object did not exist.
+ *
+ * @param mixed $calendarId
* @param string $objectUri
- * @return array
+ * @return array|null
*/
function getCalendarObject($calendarId, $objectUri) {
if (!isset($this->calendarData[$calendarId][$objectUri])) {
- throw new DAV\Exception\NotFound('Object could not be found');
+ return null;
}
$object = $this->calendarData[$calendarId][$objectUri];
$object['calendarid'] = $calendarId;
@@ -207,8 +251,7 @@ class Mock extends AbstractBackend {
*/
function deleteCalendarObject($calendarId, $objectUri) {
- throw new Exception('Not implemented');
-
+ unset($this->calendarData[$calendarId][$objectUri]);
}
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/PDOMySQLTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/PDOMySQLTest.php
index c215ca171..e068ff1e7 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/PDOMySQLTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/PDOMySQLTest.php
@@ -2,38 +2,8 @@
namespace Sabre\CalDAV\Backend;
-require_once 'Sabre/TestUtil.php';
-require_once 'Sabre/CalDAV/TestUtil.php';
-require_once 'Sabre/CalDAV/Backend/AbstractPDOTest.php';
-
class PDOMySQLTest extends AbstractPDOTest {
- function setup() {
-
- if (!SABRE_HASMYSQL) $this->markTestSkipped('MySQL driver is not available, or not properly configured');
- $pdo = \Sabre\TestUtil::getMySQLDB();
- if (!$pdo) $this->markTestSkipped('Could not connect to mysql database');
-
- $pdo->query('DROP TABLE IF EXISTS calendarobjects, calendars, calendarchanges, calendarsubscriptions, schedulingobjects');
-
- $queries = explode(
- ';',
- file_get_contents(__DIR__ . '/../../../../examples/sql/mysql.calendars.sql')
- );
-
- foreach ($queries as $query) {
- $query = trim($query, " \r\n\t");
- if ($query)
- $pdo->exec($query);
- }
- $this->pdo = $pdo;
-
- }
-
- function teardown() {
-
- $this->pdo = null;
-
- }
+ public $driver = 'mysql';
}
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/PDOSqliteTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/PDOSqliteTest.php
index 4074259f2..90ad5a171 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/PDOSqliteTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/PDOSqliteTest.php
@@ -2,36 +2,8 @@
namespace Sabre\CalDAV\Backend;
-use Sabre\CalDAV;
-
-require_once 'Sabre/CalDAV/Backend/AbstractPDOTest.php';
-
class PDOSqliteTest extends AbstractPDOTest {
- function setup() {
-
- if (!SABRE_HASSQLITE) $this->markTestSkipped('SQLite driver is not available');
-
- if (file_exists(SABRE_TEMPDIR . '/testdb.sqlite'))
- unlink(SABRE_TEMPDIR . '/testdb.sqlite');
-
- $pdo = new \PDO('sqlite:' . SABRE_TEMPDIR . '/testdb.sqlite');
- $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
-
- // Yup this is definitely not 'fool proof', but good enough for now.
- $queries = explode(';', file_get_contents(__DIR__ . '/../../../../examples/sql/sqlite.calendars.sql'));
- foreach ($queries as $query) {
- $pdo->exec($query);
- }
- $this->pdo = $pdo;
-
- }
-
- function teardown() {
-
- $this->pdo = null;
- unlink(SABRE_TEMPDIR . '/testdb.sqlite');
-
- }
+ public $driver = 'sqlite';
}
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php
index 9fc1eee4c..0d98922ff 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php
@@ -1,7 +1,6 @@
<?php
namespace Sabre\CalDAV;
-use Sabre\DAVACL;
require_once 'Sabre/CalDAV/TestUtil.php';
@@ -19,11 +18,10 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase {
function setup() {
- if (!SABRE_HASSQLITE) $this->markTestSkipped('SQLite driver is not available');
$this->backend = TestUtil::getBackend();
$calendars = $this->backend->getCalendarsForUser('principals/user1');
- $this->assertEquals(2,count($calendars));
+ $this->assertEquals(2, count($calendars));
$this->calendar = new Calendar($this->backend, $calendars[0]);
}
@@ -40,10 +38,10 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase {
$children = $this->calendar->getChildren();
$this->assertTrue($children[0] instanceof CalendarObject);
- $this->assertInternalType('string',$children[0]->getName());
- $this->assertInternalType('string',$children[0]->get());
- $this->assertInternalType('string',$children[0]->getETag());
- $this->assertEquals('text/calendar; charset=utf-8; component=vevent', $children[0]->getContentType());
+ $this->assertInternalType('string', $children[0]->getName());
+ $this->assertInternalType('string', $children[0]->get());
+ $this->assertInternalType('string', $children[0]->getETag());
+ $this->assertEquals('text/calendar; charset=utf-8', $children[0]->getContentType());
}
@@ -53,9 +51,9 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase {
function testInvalidArg1() {
$obj = new CalendarObject(
- new Backend\Mock(array(),array()),
- array(),
- array()
+ new Backend\Mock([], []),
+ [],
+ []
);
}
@@ -66,9 +64,9 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase {
function testInvalidArg2() {
$obj = new CalendarObject(
- new Backend\Mock(array(),array()),
- array(),
- array('calendarid' => '1')
+ new Backend\Mock([], []),
+ [],
+ ['calendarid' => '1']
);
}
@@ -96,7 +94,7 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase {
$this->assertTrue($children[0] instanceof CalendarObject);
$newData = TestUtil::getTestCalendarData();
- $stream = fopen('php://temp','r+');
+ $stream = fopen('php://temp', 'r+');
fwrite($stream, $newData);
rewind($stream);
$children[0]->put($stream);
@@ -117,7 +115,7 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase {
$obj->delete();
$children2 = $this->calendar->getChildren();
- $this->assertEquals(count($children)-1, count($children2));
+ $this->assertEquals(count($children) - 1, count($children2));
}
@@ -132,7 +130,7 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase {
$obj = $children[0];
$lastMod = $obj->getLastModified();
- $this->assertTrue(is_int($lastMod) || ctype_digit($lastMod));
+ $this->assertTrue(is_int($lastMod) || ctype_digit($lastMod) || is_null($lastMod));
}
@@ -173,33 +171,33 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase {
function testGetACL() {
- $expected = array(
- array(
+ $expected = [
+ [
'privilege' => '{DAV:}read',
'principal' => 'principals/user1',
'protected' => true,
- ),
- array(
+ ],
+ [
'privilege' => '{DAV:}read',
'principal' => 'principals/user1/calendar-proxy-write',
'protected' => true,
- ),
- array(
+ ],
+ [
'privilege' => '{DAV:}read',
'principal' => 'principals/user1/calendar-proxy-read',
'protected' => true,
- ),
- array(
+ ],
+ [
'privilege' => '{DAV:}write',
'principal' => 'principals/user1',
'protected' => true,
- ),
- array(
+ ],
+ [
'privilege' => '{DAV:}write',
'principal' => 'principals/user1/calendar-proxy-write',
'protected' => true,
- ),
- );
+ ],
+ ];
$children = $this->calendar->getChildren();
$this->assertTrue($children[0] instanceof CalendarObject);
@@ -213,40 +211,30 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase {
$backend = new Backend\Mock([], []);
$calendarObject = new CalendarObject($backend, ['principaluri' => 'principals/user1'], ['calendarid' => 1, 'uri' => 'foo']);
- $expected = array(
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => 'principals/user1',
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}write',
+ $expected = [
+ [
+ 'privilege' => '{DAV:}all',
'principal' => 'principals/user1',
'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}read',
+ ],
+ [
+ 'privilege' => '{DAV:}all',
'principal' => 'principals/user1/calendar-proxy-write',
'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}write',
- 'principal' => 'principals/user1/calendar-proxy-write',
- 'protected' => true,
- ),
- array(
+ ],
+ [
'privilege' => '{DAV:}read',
'principal' => 'principals/user1/calendar-proxy-read',
'protected' => true,
- ),
- );
+ ],
+ ];
$this->assertEquals($expected, $calendarObject->getACL());
}
/**
- * @expectedException Sabre\DAV\Exception\MethodNotAllowed
+ * @expectedException \Sabre\DAV\Exception\Forbidden
*/
function testSetACL() {
@@ -254,7 +242,7 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase {
$this->assertTrue($children[0] instanceof CalendarObject);
$obj = $children[0];
- $obj->setACL(array());
+ $obj->setACL([]);
}
@@ -306,15 +294,15 @@ END:VCALENDAR";
function testGetRefetch() {
- $backend = new Backend\Mock(array(), array(
- 1 => array(
- 'foo' => array(
+ $backend = new Backend\Mock([], [
+ 1 => [
+ 'foo' => [
'calendardata' => 'foo',
- 'uri' => 'foo'
- ),
- )
- ));
- $obj = new CalendarObject($backend, array('id' => 1), array('uri' => 'foo'));
+ 'uri' => 'foo'
+ ],
+ ]
+ ]);
+ $obj = new CalendarObject($backend, ['id' => 1], ['uri' => 'foo']);
$this->assertEquals('foo', $obj->get());
@@ -322,15 +310,15 @@ END:VCALENDAR";
function testGetEtag1() {
- $objectInfo = array(
+ $objectInfo = [
'calendardata' => 'foo',
- 'uri' => 'foo',
- 'etag' => 'bar',
- 'calendarid' => 1
- );
+ 'uri' => 'foo',
+ 'etag' => 'bar',
+ 'calendarid' => 1
+ ];
- $backend = new Backend\Mock(array(), array());
- $obj = new CalendarObject($backend, array(), $objectInfo);
+ $backend = new Backend\Mock([], []);
+ $obj = new CalendarObject($backend, [], $objectInfo);
$this->assertEquals('bar', $obj->getETag());
@@ -338,14 +326,14 @@ END:VCALENDAR";
function testGetEtag2() {
- $objectInfo = array(
+ $objectInfo = [
'calendardata' => 'foo',
- 'uri' => 'foo',
- 'calendarid' => 1
- );
+ 'uri' => 'foo',
+ 'calendarid' => 1
+ ];
- $backend = new Backend\Mock(array(), array());
- $obj = new CalendarObject($backend, array(), $objectInfo);
+ $backend = new Backend\Mock([], []);
+ $obj = new CalendarObject($backend, [], $objectInfo);
$this->assertEquals('"' . md5('foo') . '"', $obj->getETag());
@@ -353,42 +341,42 @@ END:VCALENDAR";
function testGetSupportedPrivilegesSet() {
- $objectInfo = array(
+ $objectInfo = [
'calendardata' => 'foo',
- 'uri' => 'foo',
- 'calendarid' => 1
- );
+ 'uri' => 'foo',
+ 'calendarid' => 1
+ ];
- $backend = new Backend\Mock(array(), array());
- $obj = new CalendarObject($backend, array(), $objectInfo);
+ $backend = new Backend\Mock([], []);
+ $obj = new CalendarObject($backend, [], $objectInfo);
$this->assertNull($obj->getSupportedPrivilegeSet());
}
function testGetSize1() {
- $objectInfo = array(
+ $objectInfo = [
'calendardata' => 'foo',
- 'uri' => 'foo',
- 'calendarid' => 1
- );
+ 'uri' => 'foo',
+ 'calendarid' => 1
+ ];
- $backend = new Backend\Mock(array(), array());
- $obj = new CalendarObject($backend, array(), $objectInfo);
+ $backend = new Backend\Mock([], []);
+ $obj = new CalendarObject($backend, [], $objectInfo);
$this->assertEquals(3, $obj->getSize());
}
function testGetSize2() {
- $objectInfo = array(
- 'uri' => 'foo',
+ $objectInfo = [
+ 'uri' => 'foo',
'calendarid' => 1,
- 'size' => 4,
- );
+ 'size' => 4,
+ ];
- $backend = new Backend\Mock(array(), array());
- $obj = new CalendarObject($backend, array(), $objectInfo);
+ $backend = new Backend\Mock([], []);
+ $obj = new CalendarObject($backend, [], $objectInfo);
$this->assertEquals(4, $obj->getSize());
}
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryVAlarmTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryVAlarmTest.php
index 9de24d3aa..ca06d8ffa 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryVAlarmTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryVAlarmTest.php
@@ -26,32 +26,32 @@ class CalendarQueryVAlarmTest extends \PHPUnit_Framework_TestCase {
$vcalendar->add($vevent);
- $filter = array(
- 'name' => 'VCALENDAR',
+ $filter = [
+ 'name' => 'VCALENDAR',
'is-not-defined' => false,
- 'time-range' => null,
- 'prop-filters' => array(),
- 'comp-filters' => array(
- array(
- 'name' => 'VEVENT',
+ 'time-range' => null,
+ 'prop-filters' => [],
+ 'comp-filters' => [
+ [
+ 'name' => 'VEVENT',
'is-not-defined' => false,
- 'time-range' => null,
- 'prop-filters' => array(),
- 'comp-filters' => array(
- array(
- 'name' => 'VALARM',
+ 'time-range' => null,
+ 'prop-filters' => [],
+ 'comp-filters' => [
+ [
+ 'name' => 'VALARM',
'is-not-defined' => false,
- 'prop-filters' => array(),
- 'comp-filters' => array(),
- 'time-range' => array(
+ 'prop-filters' => [],
+ 'comp-filters' => [],
+ 'time-range' => [
'start' => new \DateTime('2012-05-10'),
- 'end' => new \DateTime('2012-05-20'),
- ),
- ),
- ),
- ),
- ),
- );
+ 'end' => new \DateTime('2012-05-20'),
+ ],
+ ],
+ ],
+ ],
+ ],
+ ];
$validator = new CalendarQueryValidator();
$this->assertTrue($validator->validate($vcalendar, $filter));
@@ -87,32 +87,32 @@ class CalendarQueryVAlarmTest extends \PHPUnit_Framework_TestCase {
$vcalendar->add($vevent);
- $filter = array(
- 'name' => 'VCALENDAR',
+ $filter = [
+ 'name' => 'VCALENDAR',
'is-not-defined' => false,
- 'time-range' => null,
- 'prop-filters' => array(),
- 'comp-filters' => array(
- array(
- 'name' => 'VEVENT',
+ 'time-range' => null,
+ 'prop-filters' => [],
+ 'comp-filters' => [
+ [
+ 'name' => 'VEVENT',
'is-not-defined' => false,
- 'time-range' => null,
- 'prop-filters' => array(),
- 'comp-filters' => array(
- array(
- 'name' => 'VALARM',
+ 'time-range' => null,
+ 'prop-filters' => [],
+ 'comp-filters' => [
+ [
+ 'name' => 'VALARM',
'is-not-defined' => false,
- 'prop-filters' => array(),
- 'comp-filters' => array(),
- 'time-range' => array(
+ 'prop-filters' => [],
+ 'comp-filters' => [],
+ 'time-range' => [
'start' => new \DateTime('2011-12-10'),
- 'end' => new \DateTime('2011-12-20'),
- ),
- ),
- ),
- ),
- ),
- );
+ 'end' => new \DateTime('2011-12-20'),
+ ],
+ ],
+ ],
+ ],
+ ],
+ ];
$validator = new CalendarQueryValidator();
$this->assertTrue($validator->validate($vcalendar, $filter));
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php
index 9822e82e2..4c2558a9b 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php
@@ -1,8 +1,8 @@
<?php
namespace Sabre\CalDAV;
+
use Sabre\VObject;
-use Sabre\DAV;
class CalendarQueryValidatorTest extends \PHPUnit_Framework_TestCase {
@@ -29,17 +29,17 @@ ICS;
// Wrapping filter in a VCALENDAR component filter, as this is always
// there anyway.
- $filters = array(
- 'name' => 'VCALENDAR',
- 'comp-filters' => array($filters),
- 'prop-filters' => array(),
+ $filters = [
+ 'name' => 'VCALENDAR',
+ 'comp-filters' => [$filters],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => null,
- );
+ 'time-range' => null,
+ ];
$vObject = VObject\Reader::read($icalObject);
- switch($outcome) {
+ switch ($outcome) {
case 0 :
$this->assertFalse($validator->validate($vObject, $filters));
break;
@@ -392,13 +392,13 @@ END:VEVENT
END:VCALENDAR
yow;
- $filter1 = array(
- 'name' => 'VEVENT',
- 'comp-filters' => array(),
- 'prop-filters' => array(),
+ $filter1 = [
+ 'name' => 'VEVENT',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => null,
- );
+ 'time-range' => null,
+ ];
$filter2 = $filter1;
$filter2['name'] = 'VTODO';
@@ -410,25 +410,25 @@ yow;
$filter4['is-not-defined'] = true;
$filter5 = $filter1;
- $filter5['comp-filters'] = array(
- array(
- 'name' => 'VALARM',
+ $filter5['comp-filters'] = [
+ [
+ 'name' => 'VALARM',
'is-not-defined' => false,
- 'comp-filters' => array(),
- 'prop-filters' => array(),
- 'time-range' => null,
- ),
- );
+ 'comp-filters' => [],
+ 'prop-filters' => [],
+ 'time-range' => null,
+ ],
+ ];
$filter6 = $filter1;
- $filter6['prop-filters'] = array(
- array(
- 'name' => 'SUMMARY',
+ $filter6['prop-filters'] = [
+ [
+ 'name' => 'SUMMARY',
'is-not-defined' => false,
- 'param-filters' => array(),
- 'time-range' => null,
- 'text-match' => null,
- ),
- );
+ 'param-filters' => [],
+ 'time-range' => null,
+ 'text-match' => null,
+ ],
+ ];
$filter7 = $filter6;
$filter7['prop-filters'][0]['name'] = 'DESCRIPTION';
@@ -443,21 +443,21 @@ yow;
// Param filters
$filter11 = $filter1;
- $filter11['prop-filters'] = array(
- array(
- 'name' => 'DTSTART',
+ $filter11['prop-filters'] = [
+ [
+ 'name' => 'DTSTART',
'is-not-defined' => false,
- 'param-filters' => array(
- array(
- 'name' => 'VALUE',
+ 'param-filters' => [
+ [
+ 'name' => 'VALUE',
'is-not-defined' => false,
- 'text-match' => null,
- ),
- ),
+ 'text-match' => null,
+ ],
+ ],
'time-range' => null,
'text-match' => null,
- ),
- );
+ ],
+ ];
$filter12 = $filter11;
$filter12['prop-filters'][0]['param-filters'][0]['name'] = 'TZID';
@@ -470,11 +470,11 @@ yow;
// Param text filter
$filter15 = $filter11;
- $filter15['prop-filters'][0]['param-filters'][0]['text-match'] = array(
- 'collation' => 'i;ascii-casemap',
- 'value' => 'dAtE',
+ $filter15['prop-filters'][0]['param-filters'][0]['text-match'] = [
+ 'collation' => 'i;ascii-casemap',
+ 'value' => 'dAtE',
'negate-condition' => false,
- );
+ ];
$filter16 = $filter15;
$filter16['prop-filters'][0]['param-filters'][0]['text-match']['collation'] = 'i;octet';
@@ -487,31 +487,31 @@ yow;
// prop + text
$filter19 = $filter5;
- $filter19['comp-filters'][0]['prop-filters'] = array(
- array(
- 'name' => 'action',
+ $filter19['comp-filters'][0]['prop-filters'] = [
+ [
+ 'name' => 'action',
'is-not-defined' => false,
- 'time-range' => null,
- 'param-filters' => array(),
- 'text-match' => array(
- 'collation' => 'i;ascii-casemap',
- 'value' => 'display',
+ 'time-range' => null,
+ 'param-filters' => [],
+ 'text-match' => [
+ 'collation' => 'i;ascii-casemap',
+ 'value' => 'display',
'negate-condition' => false,
- ),
- ),
- );
+ ],
+ ],
+ ];
// Time range
- $filter20 = array(
- 'name' => 'VEVENT',
- 'comp-filters' => array(),
- 'prop-filters' => array(),
+ $filter20 = [
+ 'name' => 'VEVENT',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => array(
+ 'time-range' => [
'start' => new \DateTime('2011-01-01 10:00:00', new \DateTimeZone('GMT')),
- 'end' => new \DateTime('2011-01-01 13:00:00', new \DateTimeZone('GMT')),
- ),
- );
+ 'end' => new \DateTime('2011-01-01 13:00:00', new \DateTimeZone('GMT')),
+ ],
+ ];
// Time range, no end date
$filter21 = $filter20;
$filter21['time-range']['end'] = null;
@@ -522,105 +522,105 @@ yow;
// Time range, other dates
$filter23 = $filter20;
- $filter23['time-range'] = array(
+ $filter23['time-range'] = [
'start' => new \DateTime('2011-02-01 10:00:00', new \DateTimeZone('GMT')),
- 'end' => new \DateTime('2011-02-01 13:00:00', new \DateTimeZone('GMT')),
- );
+ 'end' => new \DateTime('2011-02-01 13:00:00', new \DateTimeZone('GMT')),
+ ];
// Time range
- $filter24 = array(
- 'name' => 'VTODO',
- 'comp-filters' => array(),
- 'prop-filters' => array(),
+ $filter24 = [
+ 'name' => 'VTODO',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => array(
+ 'time-range' => [
'start' => new \DateTime('2011-01-01 12:45:00', new \DateTimeZone('GMT')),
- 'end' => new \DateTime('2011-01-01 13:15:00', new \DateTimeZone('GMT')),
- ),
- );
+ 'end' => new \DateTime('2011-01-01 13:15:00', new \DateTimeZone('GMT')),
+ ],
+ ];
// Time range, other dates (1 month in the future)
$filter25 = $filter24;
- $filter25['time-range'] = array(
+ $filter25['time-range'] = [
'start' => new \DateTime('2011-02-01 10:00:00', new \DateTimeZone('GMT')),
- 'end' => new \DateTime('2011-02-01 13:00:00', new \DateTimeZone('GMT')),
- );
+ 'end' => new \DateTime('2011-02-01 13:00:00', new \DateTimeZone('GMT')),
+ ];
$filter26 = $filter24;
- $filter26['time-range'] = array(
+ $filter26['time-range'] = [
'start' => new \DateTime('2011-01-01 11:45:00', new \DateTimeZone('GMT')),
- 'end' => new \DateTime('2011-01-01 12:15:00', new \DateTimeZone('GMT')),
- );
+ 'end' => new \DateTime('2011-01-01 12:15:00', new \DateTimeZone('GMT')),
+ ];
// Time range for VJOURNAL
- $filter27 = array(
- 'name' => 'VJOURNAL',
- 'comp-filters' => array(),
- 'prop-filters' => array(),
+ $filter27 = [
+ 'name' => 'VJOURNAL',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => array(
+ 'time-range' => [
'start' => new \DateTime('2011-01-01 12:45:00', new \DateTimeZone('GMT')),
- 'end' => new \DateTime('2011-01-01 13:15:00', new \DateTimeZone('GMT')),
- ),
- );
+ 'end' => new \DateTime('2011-01-01 13:15:00', new \DateTimeZone('GMT')),
+ ],
+ ];
$filter28 = $filter27;
- $filter28['time-range'] = array(
+ $filter28['time-range'] = [
'start' => new \DateTime('2011-01-01 11:45:00', new \DateTimeZone('GMT')),
- 'end' => new \DateTime('2011-01-01 12:15:00', new \DateTimeZone('GMT')),
- );
+ 'end' => new \DateTime('2011-01-01 12:15:00', new \DateTimeZone('GMT')),
+ ];
// Time range for VFREEBUSY
- $filter29 = array(
- 'name' => 'VFREEBUSY',
- 'comp-filters' => array(),
- 'prop-filters' => array(),
+ $filter29 = [
+ 'name' => 'VFREEBUSY',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => array(
+ 'time-range' => [
'start' => new \DateTime('2011-01-01 12:45:00', new \DateTimeZone('GMT')),
- 'end' => new \DateTime('2011-01-01 13:15:00', new \DateTimeZone('GMT')),
- ),
- );
+ 'end' => new \DateTime('2011-01-01 13:15:00', new \DateTimeZone('GMT')),
+ ],
+ ];
// Time range filter on property
- $filter30 = array(
- 'name' => 'VEVENT',
- 'comp-filters' => array(),
- 'prop-filters' => array(
- array(
- 'name' => 'DTSTART',
+ $filter30 = [
+ 'name' => 'VEVENT',
+ 'comp-filters' => [],
+ 'prop-filters' => [
+ [
+ 'name' => 'DTSTART',
'is-not-defined' => false,
- 'param-filters' => array(),
- 'time-range' => array(
+ 'param-filters' => [],
+ 'time-range' => [
'start' => new \DateTime('2011-01-01 10:00:00', new \DateTimeZone('GMT')),
- 'end' => new \DateTime('2011-01-01 13:00:00', new \DateTimeZone('GMT')),
- ),
+ 'end' => new \DateTime('2011-01-01 13:00:00', new \DateTimeZone('GMT')),
+ ],
'text-match' => null,
- ),
- ),
+ ],
+ ],
'is-not-defined' => false,
- 'time-range' => null,
- );
+ 'time-range' => null,
+ ];
// Time range for alarm
- $filter31 = array(
- 'name' => 'VEVENT',
- 'prop-filters' => array(),
- 'comp-filters' => array(
- array(
- 'name' => 'VALARM',
+ $filter31 = [
+ 'name' => 'VEVENT',
+ 'prop-filters' => [],
+ 'comp-filters' => [
+ [
+ 'name' => 'VALARM',
'is-not-defined' => false,
- 'comp-filters' => array(),
- 'prop-filters' => array(),
- 'time-range' => array(
+ 'comp-filters' => [],
+ 'prop-filters' => [],
+ 'time-range' => [
'start' => new \DateTime('2011-01-01 10:45:00', new \DateTimeZone('GMT')),
- 'end' => new \DateTime('2011-01-01 11:15:00', new \DateTimeZone('GMT')),
- ),
+ 'end' => new \DateTime('2011-01-01 11:15:00', new \DateTimeZone('GMT')),
+ ],
'text-match' => null,
- ),
- ),
+ ],
+ ],
'is-not-defined' => false,
- 'time-range' => null,
- );
+ 'time-range' => null,
+ ];
$filter32 = $filter31;
- $filter32['comp-filters'][0]['time-range'] = array(
+ $filter32['comp-filters'][0]['time-range'] = [
'start' => new \DateTime('2011-01-01 11:45:00', new \DateTimeZone('GMT')),
- 'end' => new \DateTime('2011-01-01 12:15:00', new \DateTimeZone('GMT')),
- );
+ 'end' => new \DateTime('2011-01-01 12:15:00', new \DateTimeZone('GMT')),
+ ];
$filter33 = $filter31;
$filter33['name'] = 'VTODO';
@@ -632,194 +632,194 @@ yow;
$filter36['name'] = 'VJOURNAL';
// Time range filter on non-datetime property
- $filter37 = array(
- 'name' => 'VEVENT',
- 'comp-filters' => array(),
- 'prop-filters' => array(
- array(
- 'name' => 'SUMMARY',
+ $filter37 = [
+ 'name' => 'VEVENT',
+ 'comp-filters' => [],
+ 'prop-filters' => [
+ [
+ 'name' => 'SUMMARY',
'is-not-defined' => false,
- 'param-filters' => array(),
- 'time-range' => array(
+ 'param-filters' => [],
+ 'time-range' => [
'start' => new \DateTime('2011-01-01 10:00:00', new \DateTimeZone('GMT')),
- 'end' => new \DateTime('2011-01-01 13:00:00', new \DateTimeZone('GMT')),
- ),
+ 'end' => new \DateTime('2011-01-01 13:00:00', new \DateTimeZone('GMT')),
+ ],
'text-match' => null,
- ),
- ),
+ ],
+ ],
'is-not-defined' => false,
- 'time-range' => null,
- );
+ 'time-range' => null,
+ ];
- $filter38 = array(
- 'name' => 'VEVENT',
- 'comp-filters' => array(),
- 'prop-filters' => array(),
+ $filter38 = [
+ 'name' => 'VEVENT',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => array(
+ 'time-range' => [
'start' => new \DateTime('2012-07-01 00:00:00', new \DateTimeZone('UTC')),
- 'end' => new \DateTime('2012-08-01 00:00:00', new \DateTimeZone('UTC')),
- )
- );
- $filter39 = array(
- 'name' => 'VEVENT',
- 'comp-filters' => array(
- array(
- 'name' => 'VALARM',
- 'comp-filters' => array(),
- 'prop-filters' => array(),
+ 'end' => new \DateTime('2012-08-01 00:00:00', new \DateTimeZone('UTC')),
+ ]
+ ];
+ $filter39 = [
+ 'name' => 'VEVENT',
+ 'comp-filters' => [
+ [
+ 'name' => 'VALARM',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => array(
+ 'time-range' => [
'start' => new \DateTime('2012-09-01 00:00:00', new \DateTimeZone('UTC')),
- 'end' => new \DateTime('2012-10-01 00:00:00', new \DateTimeZone('UTC')),
- )
- ),
- ),
- 'prop-filters' => array(),
+ 'end' => new \DateTime('2012-10-01 00:00:00', new \DateTimeZone('UTC')),
+ ]
+ ],
+ ],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => null,
- );
+ 'time-range' => null,
+ ];
- return array(
+ return [
// Component check
- array($blob1, $filter1, 1),
- array($blob1, $filter2, 0),
- array($blob1, $filter3, 0),
- array($blob1, $filter4, 1),
+ [$blob1, $filter1, 1],
+ [$blob1, $filter2, 0],
+ [$blob1, $filter3, 0],
+ [$blob1, $filter4, 1],
// Subcomponent check (4)
- array($blob1, $filter5, 0),
- array($blob2, $filter5, 1),
+ [$blob1, $filter5, 0],
+ [$blob2, $filter5, 1],
// Property checki (6)
- array($blob1, $filter6, 1),
- array($blob1, $filter7, 0),
- array($blob1, $filter8, 0),
- array($blob1, $filter9, 1),
+ [$blob1, $filter6, 1],
+ [$blob1, $filter7, 0],
+ [$blob1, $filter8, 0],
+ [$blob1, $filter9, 1],
// Subcomponent + property (10)
- array($blob2, $filter10, 1),
+ [$blob2, $filter10, 1],
// Param filter (11)
- array($blob3, $filter11, 1),
- array($blob3, $filter12, 0),
- array($blob3, $filter13, 0),
- array($blob3, $filter14, 1),
+ [$blob3, $filter11, 1],
+ [$blob3, $filter12, 0],
+ [$blob3, $filter13, 0],
+ [$blob3, $filter14, 1],
// Param + text (15)
- array($blob3, $filter15, 1),
- array($blob3, $filter16, 0),
- array($blob3, $filter17, 0),
- array($blob3, $filter18, 1),
+ [$blob3, $filter15, 1],
+ [$blob3, $filter16, 0],
+ [$blob3, $filter17, 0],
+ [$blob3, $filter18, 1],
// Prop + text (19)
- array($blob2, $filter19, 1),
+ [$blob2, $filter19, 1],
// Incorrect object (vcard) (20)
- array($blob4, $filter1, -1),
+ [$blob4, $filter1, -1],
// Time-range for event (21)
- array($blob5, $filter20, 1),
- array($blob6, $filter20, 1),
- array($blob7, $filter20, 1),
- array($blob8, $filter20, 1),
+ [$blob5, $filter20, 1],
+ [$blob6, $filter20, 1],
+ [$blob7, $filter20, 1],
+ [$blob8, $filter20, 1],
- array($blob5, $filter21, 1),
- array($blob5, $filter22, 1),
+ [$blob5, $filter21, 1],
+ [$blob5, $filter22, 1],
- array($blob5, $filter23, 0),
- array($blob6, $filter23, 0),
- array($blob7, $filter23, 0),
- array($blob8, $filter23, 0),
+ [$blob5, $filter23, 0],
+ [$blob6, $filter23, 0],
+ [$blob7, $filter23, 0],
+ [$blob8, $filter23, 0],
// Time-range for todo (31)
- array($blob9, $filter24, 1),
- array($blob9, $filter25, 0),
- array($blob9, $filter26, 1),
- array($blob10, $filter24, 1),
- array($blob10, $filter25, 0),
- array($blob10, $filter26, 1),
+ [$blob9, $filter24, 1],
+ [$blob9, $filter25, 0],
+ [$blob9, $filter26, 1],
+ [$blob10, $filter24, 1],
+ [$blob10, $filter25, 0],
+ [$blob10, $filter26, 1],
- array($blob11, $filter24, 0),
- array($blob11, $filter25, 0),
- array($blob11, $filter26, 1),
+ [$blob11, $filter24, 0],
+ [$blob11, $filter25, 0],
+ [$blob11, $filter26, 1],
- array($blob12, $filter24, 1),
- array($blob12, $filter25, 0),
- array($blob12, $filter26, 0),
+ [$blob12, $filter24, 1],
+ [$blob12, $filter25, 0],
+ [$blob12, $filter26, 0],
- array($blob13, $filter24, 1),
- array($blob13, $filter25, 0),
- array($blob13, $filter26, 1),
+ [$blob13, $filter24, 1],
+ [$blob13, $filter25, 0],
+ [$blob13, $filter26, 1],
- array($blob14, $filter24, 1),
- array($blob14, $filter25, 0),
- array($blob14, $filter26, 0),
+ [$blob14, $filter24, 1],
+ [$blob14, $filter25, 0],
+ [$blob14, $filter26, 0],
- array($blob15, $filter24, 1),
- array($blob15, $filter25, 1),
- array($blob15, $filter26, 1),
+ [$blob15, $filter24, 1],
+ [$blob15, $filter25, 1],
+ [$blob15, $filter26, 1],
- array($blob16, $filter24, 1),
- array($blob16, $filter25, 1),
- array($blob16, $filter26, 1),
+ [$blob16, $filter24, 1],
+ [$blob16, $filter25, 1],
+ [$blob16, $filter26, 1],
// Time-range for journals (55)
- array($blob17, $filter27, 0),
- array($blob17, $filter28, 0),
- array($blob18, $filter27, 0),
- array($blob18, $filter28, 1),
- array($blob19, $filter27, 1),
- array($blob19, $filter28, 1),
+ [$blob17, $filter27, 0],
+ [$blob17, $filter28, 0],
+ [$blob18, $filter27, 0],
+ [$blob18, $filter28, 1],
+ [$blob19, $filter27, 1],
+ [$blob19, $filter28, 1],
// Time-range for free-busy (61)
- array($blob20, $filter29, -1),
+ [$blob20, $filter29, -1],
// Time-range on property (62)
- array($blob5, $filter30, 1),
- array($blob3, $filter37, -1),
- array($blob3, $filter30, 0),
+ [$blob5, $filter30, 1],
+ [$blob3, $filter37, -1],
+ [$blob3, $filter30, 0],
// Time-range on alarm in vevent (65)
- array($blob21, $filter31, 1),
- array($blob21, $filter32, 0),
- array($blob22, $filter31, 1),
- array($blob22, $filter32, 0),
- array($blob23, $filter31, 1),
- array($blob23, $filter32, 0),
- array($blob24, $filter31, 1),
- array($blob24, $filter32, 0),
- array($blob25, $filter31, 1),
- array($blob25, $filter32, 0),
- array($blob26, $filter31, 1),
- array($blob26, $filter32, 0),
+ [$blob21, $filter31, 1],
+ [$blob21, $filter32, 0],
+ [$blob22, $filter31, 1],
+ [$blob22, $filter32, 0],
+ [$blob23, $filter31, 1],
+ [$blob23, $filter32, 0],
+ [$blob24, $filter31, 1],
+ [$blob24, $filter32, 0],
+ [$blob25, $filter31, 1],
+ [$blob25, $filter32, 0],
+ [$blob26, $filter31, 1],
+ [$blob26, $filter32, 0],
// Time-range on alarm for vtodo (77)
- array($blob27, $filter33, 1),
- array($blob27, $filter34, 0),
+ [$blob27, $filter33, 1],
+ [$blob27, $filter34, 0],
// Time-range on alarm for vjournal (79)
- array($blob28, $filter35, -1),
- array($blob28, $filter36, -1),
+ [$blob28, $filter35, -1],
+ [$blob28, $filter36, -1],
// Time-range on alarm with duration (81)
- array($blob29, $filter31, 1),
- array($blob29, $filter32, 0),
- array($blob30, $filter31, 0),
- array($blob30, $filter32, 0),
+ [$blob29, $filter31, 1],
+ [$blob29, $filter32, 0],
+ [$blob30, $filter31, 0],
+ [$blob30, $filter32, 0],
// Time-range with RRULE (85)
- array($blob31, $filter20, 1),
- array($blob32, $filter20, 0),
+ [$blob31, $filter20, 1],
+ [$blob32, $filter20, 0],
// Bug reported on mailing list, related to all-day events (87)
//array($blob33, $filter38, 1),
// Event in timerange, but filtered alarm is in the far future (88).
- array($blob34, $filter39, 0),
- );
+ [$blob34, $filter39, 0],
+ ];
}
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php
index ea744d2cf..df85b6ded 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php
@@ -3,7 +3,6 @@
namespace Sabre\CalDAV;
use Sabre\DAV\PropPatch;
-use Sabre\DAVACL;
require_once 'Sabre/CalDAV/TestUtil.php';
@@ -25,8 +24,6 @@ class CalendarTest extends \PHPUnit_Framework_TestCase {
function setup() {
- if (!SABRE_HASSQLITE) $this->markTestSkipped('SQLite driver is not available');
-
$this->backend = TestUtil::getBackend();
$this->calendars = $this->backend->getCalendarsForUser('principals/user1');
@@ -63,7 +60,7 @@ class CalendarTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals(true, $result);
$calendars2 = $this->backend->getCalendarsForUser('principals/user1');
- $this->assertEquals('NewName',$calendars2[0]['{DAV:}displayname']);
+ $this->assertEquals('NewName', $calendars2[0]['{DAV:}displayname']);
}
@@ -72,15 +69,15 @@ class CalendarTest extends \PHPUnit_Framework_TestCase {
*/
function testGetProperties() {
- $question = array(
+ $question = [
'{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set',
- );
+ ];
$result = $this->calendar->getProperties($question);
- foreach($question as $q) $this->assertArrayHasKey($q,$result);
+ foreach ($question as $q) $this->assertArrayHasKey($q, $result);
- $this->assertEquals(array('VEVENT','VTODO'), $result['{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set']->getValue());
+ $this->assertEquals(['VEVENT', 'VTODO'], $result['{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set']->getValue());
}
@@ -100,7 +97,7 @@ class CalendarTest extends \PHPUnit_Framework_TestCase {
function testGetChildren() {
$children = $this->calendar->getChildren();
- $this->assertEquals(1,count($children));
+ $this->assertEquals(1, count($children));
$this->assertTrue($children[0] instanceof CalendarObject);
@@ -145,11 +142,11 @@ class CalendarTest extends \PHPUnit_Framework_TestCase {
function testCreateFile() {
- $file = fopen('php://memory','r+');
- fwrite($file,TestUtil::getTestCalendarData());
+ $file = fopen('php://memory', 'r+');
+ fwrite($file, TestUtil::getTestCalendarData());
rewind($file);
- $this->calendar->createFile('hello',$file);
+ $this->calendar->createFile('hello', $file);
$file = $this->calendar->getChild('hello');
$this->assertTrue($file instanceof CalendarObject);
@@ -158,12 +155,12 @@ class CalendarTest extends \PHPUnit_Framework_TestCase {
function testCreateFileNoSupportedComponents() {
- $file = fopen('php://memory','r+');
- fwrite($file,TestUtil::getTestCalendarData());
+ $file = fopen('php://memory', 'r+');
+ fwrite($file, TestUtil::getTestCalendarData());
rewind($file);
$calendar = new Calendar($this->backend, $this->calendars[1]);
- $calendar->createFile('hello',$file);
+ $calendar->createFile('hello', $file);
$file = $calendar->getChild('hello');
$this->assertTrue($file instanceof CalendarObject);
@@ -180,7 +177,7 @@ class CalendarTest extends \PHPUnit_Framework_TestCase {
function testGetOwner() {
- $this->assertEquals('principals/user1',$this->calendar->getOwner());
+ $this->assertEquals('principals/user1', $this->calendar->getOwner());
}
@@ -192,98 +189,68 @@ class CalendarTest extends \PHPUnit_Framework_TestCase {
function testGetACL() {
- $expected = array(
- array(
+ $expected = [
+ [
'privilege' => '{DAV:}read',
'principal' => 'principals/user1',
'protected' => true,
- ),
- array(
+ ],
+ [
'privilege' => '{DAV:}read',
'principal' => 'principals/user1/calendar-proxy-write',
'protected' => true,
- ),
- array(
+ ],
+ [
'privilege' => '{DAV:}read',
'principal' => 'principals/user1/calendar-proxy-read',
'protected' => true,
- ),
- array(
+ ],
+ [
'privilege' => '{' . Plugin::NS_CALDAV . '}read-free-busy',
'principal' => '{DAV:}authenticated',
'protected' => true,
- ),
- array(
+ ],
+ [
'privilege' => '{DAV:}write',
'principal' => 'principals/user1',
'protected' => true,
- ),
- array(
+ ],
+ [
'privilege' => '{DAV:}write',
'principal' => 'principals/user1/calendar-proxy-write',
'protected' => true,
- ),
- );
+ ],
+ ];
$this->assertEquals($expected, $this->calendar->getACL());
}
/**
- * @expectedException Sabre\DAV\Exception\MethodNotAllowed
+ * @expectedException \Sabre\DAV\Exception\Forbidden
*/
function testSetACL() {
- $this->calendar->setACL(array());
-
- }
-
- function testGetSupportedPrivilegesSet() {
-
- $result = $this->calendar->getSupportedPrivilegeSet();
-
- $this->assertEquals(
- '{' . Plugin::NS_CALDAV . '}read-free-busy',
- $result['aggregates'][0]['aggregates'][2]['privilege']
- );
+ $this->calendar->setACL([]);
}
function testGetSyncToken() {
- $this->assertEquals(2, $this->calendar->getSyncToken());
-
- }
- function testGetSyncToken2() {
-
- $calendar = new Calendar(new Backend\Mock([],[]), [
- '{DAV:}sync-token' => 2
- ]);
- $this->assertEquals(2, $this->calendar->getSyncToken());
+ $this->assertNull($this->calendar->getSyncToken());
}
function testGetSyncTokenNoSyncSupport() {
- $calendar = new Calendar(new Backend\Mock([],[]), []);
+ $calendar = new Calendar(new Backend\Mock([], []), []);
$this->assertNull($calendar->getSyncToken());
}
function testGetChanges() {
- $this->assertEquals([
- 'syncToken' => 2,
- 'modified' => [],
- 'deleted' => [],
- 'added' => ['UUID-2345'],
- ], $this->calendar->getChanges(1, 1));
+ $this->assertNull($this->calendar->getChanges(1, 1));
}
- function testGetChangesNoSyncSupport() {
-
- $calendar = new Calendar(new Backend\Mock([],[]), []);
- $this->assertNull($calendar->getChanges(1,null));
-
- }
}
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php
index b64fb122a..3a22e03d4 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php
@@ -19,18 +19,18 @@ class ExpandEventsDoubleEventsTest extends \Sabre\DAVServerTest {
protected $setupCalDAV = true;
- protected $caldavCalendars = array(
- array(
- 'id' => 1,
- 'name' => 'Calendar',
+ protected $caldavCalendars = [
+ [
+ 'id' => 1,
+ 'name' => 'Calendar',
'principaluri' => 'principals/user1',
- 'uri' => 'calendar1',
- )
- );
+ 'uri' => 'calendar1',
+ ]
+ ];
- protected $caldavCalendarObjects = array(
- 1 => array(
- 'event.ics' => array(
+ protected $caldavCalendarObjects = [
+ 1 => [
+ 'event.ics' => [
'calendardata' => 'BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
@@ -50,17 +50,17 @@ RECURRENCE-ID;TZID=Europe/Berlin:20120208T181500
END:VEVENT
END:VCALENDAR
',
- ),
- ),
- );
+ ],
+ ],
+ ];
function testExpand() {
$request = HTTP\Sapi::createFromServerArray([
- 'REQUEST_METHOD' => 'REPORT',
+ 'REQUEST_METHOD' => 'REPORT',
'HTTP_CONTENT_TYPE' => 'application/xml',
- 'REQUEST_URI' => '/calendars/user1/calendar1',
- 'HTTP_DEPTH' => '1',
+ 'REQUEST_URI' => '/calendars/user1/calendar1',
+ 'HTTP_DEPTH' => '1',
]);
$request->setBody('<?xml version="1.0" encoding="utf-8" ?>
@@ -88,12 +88,12 @@ END:VCALENDAR
$start = strpos($response->body, 'BEGIN:VCALENDAR'),
strpos($response->body, 'END:VCALENDAR') - $start + 13
);
- $body = str_replace('&#13;','',$body);
+ $body = str_replace('&#13;', '', $body);
$vObject = VObject\Reader::read($body);
// We only expect 3 events
- $this->assertEquals(3, count($vObject->VEVENT),'We got 6 events instead of 3. Output: ' . $body);
+ $this->assertEquals(3, count($vObject->VEVENT), 'We got 6 events instead of 3. Output: ' . $body);
// TZID should be gone
$this->assertFalse(isset($vObject->VEVENT->DTSTART['TZID']));
@@ -101,4 +101,3 @@ END:VCALENDAR
}
}
-
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/FreeBusyReportTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/FreeBusyReportTest.php
index 84f05f3c0..7a756774f 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/FreeBusyReportTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/FreeBusyReportTest.php
@@ -3,7 +3,6 @@
namespace Sabre\CalDAV;
use Sabre\DAV;
-use Sabre\DAVACL;
use Sabre\HTTP;
require_once 'Sabre/CalDAV/Backend/Mock.php';
@@ -31,8 +30,8 @@ END:VEVENT
END:VCALENDAR
ics;
- $obj2 = fopen('php://memory','r+');
- fwrite($obj2,<<<ics
+ $obj2 = fopen('php://memory', 'r+');
+ fwrite($obj2, <<<ics
BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTART:20121005T120000Z
@@ -55,18 +54,18 @@ ics;
$calendarData = [
1 => [
'obj1' => [
- 'calendarid' => 1,
- 'uri' => 'event1.ics',
+ 'calendarid' => 1,
+ 'uri' => 'event1.ics',
'calendardata' => $obj1,
],
'obj2' => [
- 'calendarid' => 1,
- 'uri' => 'event2.ics',
+ 'calendarid' => 1,
+ 'uri' => 'event2.ics',
'calendardata' => $obj2
],
'obj3' => [
- 'calendarid' => 1,
- 'uri' => 'event3.ics',
+ 'calendarid' => 1,
+ 'uri' => 'event3.ics',
'calendardata' => $obj3
]
],
@@ -76,9 +75,9 @@ ics;
$caldavBackend = new Backend\Mock([], $calendarData);
$calendar = new Calendar($caldavBackend, [
- 'id' => 1,
- 'uri' => 'calendar',
- 'principaluri' => 'principals/user1',
+ 'id' => 1,
+ 'uri' => 'calendar',
+ 'principaluri' => 'principals/user1',
'{' . Plugin::NS_CALDAV . '}calendar-timezone' => "BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nTZID:Europe/Berlin\r\nEND:VTIMEZONE\r\nEND:VCALENDAR",
]);
@@ -105,13 +104,13 @@ ics;
XML;
$report = $this->server->xml->parse($reportXML, null, $rootElem);
- $this->plugin->report($rootElem, $report);
+ $this->plugin->report($rootElem, $report, null);
$this->assertEquals(200, $this->server->httpResponse->status);
$this->assertEquals('text/calendar', $this->server->httpResponse->getHeader('Content-Type'));
- $this->assertTrue(strpos($this->server->httpResponse->body, 'BEGIN:VFREEBUSY')!==false);
- $this->assertTrue(strpos($this->server->httpResponse->body, '20111005T120000Z/20111005T130000Z')!==false);
- $this->assertTrue(strpos($this->server->httpResponse->body, '20111006T100000Z/20111006T110000Z')!==false);
+ $this->assertTrue(strpos($this->server->httpResponse->body, 'BEGIN:VFREEBUSY') !== false);
+ $this->assertTrue(strpos($this->server->httpResponse->body, '20111005T120000Z/20111005T130000Z') !== false);
+ $this->assertTrue(strpos($this->server->httpResponse->body, '20111006T100000Z/20111006T110000Z') !== false);
}
@@ -127,7 +126,6 @@ XML;
XML;
$report = $this->server->xml->parse($reportXML, null, $rootElem);
- $this->plugin->report($rootElem, $report);
}
@@ -136,9 +134,9 @@ XML;
*/
function testFreeBusyReportWrongNode() {
- $request = HTTP\Sapi::createFromServerArray(array(
+ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_URI' => '/',
- ));
+ ]);
$this->server->httpRequest = $request;
$reportXML = <<<XML
@@ -149,7 +147,7 @@ XML;
XML;
$report = $this->server->xml->parse($reportXML, null, $rootElem);
- $this->plugin->report($rootElem, $report);
+ $this->plugin->report($rootElem, $report, null);
}
@@ -170,7 +168,7 @@ XML;
XML;
$report = $this->server->xml->parse($reportXML, null, $rootElem);
- $this->plugin->report($rootElem, $report);
+ $this->plugin->report($rootElem, $report, null);
}
}
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php
index c3c97e8f6..5fd8d29a1 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php
@@ -75,7 +75,7 @@ END:VCALENDAR
$response = $this->request($request);
- $this->assertTrue(strpos($response->body, 'BEGIN:VCALENDAR')!==false);
+ $this->assertTrue(strpos($response->body, 'BEGIN:VCALENDAR') !== false);
}
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/ICSExportPluginTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/ICSExportPluginTest.php
index c123bd0c1..9719529fb 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/ICSExportPluginTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/ICSExportPluginTest.php
@@ -7,657 +7,380 @@ use Sabre\HTTP;
use Sabre\VObject;
use Sabre\DAVACL;
-require_once 'Sabre/CalDAV/TestUtil.php';
-require_once 'Sabre/HTTP/ResponseMock.php';
+class ICSExportPluginTest extends \Sabre\DAVServerTest {
-class ICSExportPluginTest extends \PHPUnit_Framework_TestCase {
+ protected $setupCalDAV = true;
+
+ protected $icsExportPlugin;
function setUp() {
- if (!SABRE_HASSQLITE) $this->markTestSkipped('SQLite driver is not available');
+ parent::setUp();
+ $this->icsExportPlugin = new ICSExportPlugin();
+ $this->server->addPlugin(
+ $this->icsExportPlugin
+ );
- }
+ $id = $this->caldavBackend->createCalendar(
+ 'principals/admin',
+ 'UUID-123467',
+ [
+ '{DAV:}displayname' => 'Hello!',
+ '{http://apple.com/ns/ical/}calendar-color' => '#AA0000FF',
+ ]
+ );
- function testInit() {
+ $this->caldavBackend->createCalendarObject(
+ $id,
+ 'event-1',
+ <<<ICS
+BEGIN:VCALENDAR
+BEGIN:VTIMEZONE
+TZID:Europe/Amsterdam
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:event-1
+DTSTART;TZID=Europe/Amsterdam:20151020T000000
+END:VEVENT
+END:VCALENDAR
+ICS
+ );
+ $this->caldavBackend->createCalendarObject(
+ $id,
+ 'todo-1',
+ <<<ICS
+BEGIN:VCALENDAR
+BEGIN:VTODO
+UID:todo-1
+END:VTODO
+END:VCALENDAR
+ICS
+ );
- $p = new ICSExportPlugin();
- $s = new DAV\Server();
- $s->addPlugin($p);
- $this->assertEquals($p, $s->getPlugin('ics-export'));
- $this->assertEquals('ics-export', $p->getPluginInfo()['name']);
}
- function testBeforeMethod() {
+ function testInit() {
- $cbackend = TestUtil::getBackend();
-
- $props = [
- 'uri'=>'UUID-123467',
- 'principaluri' => 'admin',
- 'id' => 1,
- '{DAV:}displayname' => 'Hello!',
- '{http://apple.com/ns/ical/}calendar-color' => '#AA0000FF',
- ];
- $tree = [
- new Calendar($cbackend,$props),
- ];
-
- $p = new ICSExportPlugin();
-
- $s = new DAV\Server($tree);
- $s->addPlugin($p);
- $s->addPlugin(new Plugin());
-
- $h = HTTP\Sapi::createFromServerArray([
- 'REQUEST_URI' => '/UUID-123467?export',
- 'REQUEST_METHOD' => 'GET',
- ]);
-
- $s->httpRequest = $h;
- $s->httpResponse = new HTTP\ResponseMock();
-
- $this->assertFalse($p->httpGet($h, $s->httpResponse));
-
- $this->assertEquals(200, $s->httpResponse->status);
- $this->assertEquals([
- 'Content-Type' => ['text/calendar'],
- ], $s->httpResponse->getHeaders());
-
- $obj = VObject\Reader::read($s->httpResponse->body);
-
- $this->assertEquals(7,count($obj->children()));
- $this->assertEquals(1,count($obj->VERSION));
- $this->assertEquals(1,count($obj->CALSCALE));
- $this->assertEquals(1,count($obj->PRODID));
- $this->assertTrue(strpos((string)$obj->PRODID, DAV\Version::VERSION)!==false);
- $this->assertEquals(1,count($obj->VTIMEZONE));
- $this->assertEquals(1,count($obj->VEVENT));
- $this->assertEquals("Hello!", $obj->{"X-WR-CALNAME"});
- $this->assertEquals("#AA0000FF", $obj->{"X-APPLE-CALENDAR-COLOR"});
+ $this->assertEquals(
+ $this->icsExportPlugin,
+ $this->server->getPlugin('ics-export')
+ );
+ $this->assertEquals($this->icsExportPlugin, $this->server->getPlugin('ics-export'));
+ $this->assertEquals('ics-export', $this->icsExportPlugin->getPluginInfo()['name']);
}
- function testBeforeMethodNoVersion() {
- if (!SABRE_HASSQLITE) $this->markTestSkipped('SQLite driver is not available');
- $cbackend = TestUtil::getBackend();
+ function testBeforeMethod() {
- $props = [
- 'uri'=>'UUID-123467',
- 'principaluri' => 'admin',
- 'id' => 1,
- ];
- $tree = [
- new Calendar($cbackend,$props),
- ];
+ $request = new HTTP\Request(
+ 'GET',
+ '/calendars/admin/UUID-123467?export'
+ );
- $p = new ICSExportPlugin();
+ $response = $this->request($request);
- $s = new DAV\Server($tree);
+ $this->assertEquals(200, $response->getStatus());
+ $this->assertEquals('text/calendar', $response->getHeader('Content-Type'));
- $s->addPlugin($p);
- $s->addPlugin(new Plugin());
+ $obj = VObject\Reader::read($response->body);
- $h = HTTP\Sapi::createFromServerArray([
- 'REQUEST_URI' => '/UUID-123467?export',
- 'REQUEST_METHOD' => 'GET',
- ]);
+ $this->assertEquals(8, count($obj->children()));
+ $this->assertEquals(1, count($obj->VERSION));
+ $this->assertEquals(1, count($obj->CALSCALE));
+ $this->assertEquals(1, count($obj->PRODID));
+ $this->assertTrue(strpos((string)$obj->PRODID, DAV\Version::VERSION) !== false);
+ $this->assertEquals(1, count($obj->VTIMEZONE));
+ $this->assertEquals(1, count($obj->VEVENT));
+ $this->assertEquals("Hello!", $obj->{"X-WR-CALNAME"});
+ $this->assertEquals("#AA0000FF", $obj->{"X-APPLE-CALENDAR-COLOR"});
- $s->httpRequest = $h;
- $s->httpResponse = new HTTP\ResponseMock();
+ }
+ function testBeforeMethodNoVersion() {
+ $request = new HTTP\Request(
+ 'GET',
+ '/calendars/admin/UUID-123467?export'
+ );
DAV\Server::$exposeVersion = false;
- $this->assertFalse($p->httpGet($h, $s->httpResponse));
+ $response = $this->request($request);
DAV\Server::$exposeVersion = true;
- $this->assertEquals(200, $s->httpResponse->status);
- $this->assertEquals([
- 'Content-Type' => ['text/calendar'],
- ], $s->httpResponse->getHeaders());
+ $this->assertEquals(200, $response->getStatus());
+ $this->assertEquals('text/calendar', $response->getHeader('Content-Type'));
- $obj = VObject\Reader::read($s->httpResponse->body);
+ $obj = VObject\Reader::read($response->body);
- $this->assertEquals(5,count($obj->children()));
- $this->assertEquals(1,count($obj->VERSION));
- $this->assertEquals(1,count($obj->CALSCALE));
- $this->assertEquals(1,count($obj->PRODID));
- $this->assertFalse(strpos((string)$obj->PRODID, DAV\Version::VERSION)!==false);
- $this->assertEquals(1,count($obj->VTIMEZONE));
- $this->assertEquals(1,count($obj->VEVENT));
+ $this->assertEquals(8, count($obj->children()));
+ $this->assertEquals(1, count($obj->VERSION));
+ $this->assertEquals(1, count($obj->CALSCALE));
+ $this->assertEquals(1, count($obj->PRODID));
+ $this->assertFalse(strpos((string)$obj->PRODID, DAV\Version::VERSION) !== false);
+ $this->assertEquals(1, count($obj->VTIMEZONE));
+ $this->assertEquals(1, count($obj->VEVENT));
}
function testBeforeMethodNoExport() {
- $p = new ICSExportPlugin();
-
- $s = new DAV\Server();
- $s->addPlugin($p);
-
- $h = HTTP\Sapi::createFromServerArray([
- 'REQUEST_URI' => '/UUID-123467',
- 'REQUEST_METHOD' => 'GET',
- ]);
- $this->assertNull($p->httpGet($h, $s->httpResponse));
+ $request = new HTTP\Request(
+ 'GET',
+ '/calendars/admin/UUID-123467'
+ );
+ $response = new HTTP\Response();
+ $this->assertNull($this->icsExportPlugin->httpGet($request, $response));
}
function testACLIntegrationBlocked() {
- $cbackend = TestUtil::getBackend();
-
- $props = array(
- 'uri'=>'UUID-123467',
- 'principaluri' => 'admin',
- 'id' => 1,
+ $aclPlugin = new DAVACL\Plugin();
+ $aclPlugin->allowUnauthenticatedAccess = false;
+ $this->server->addPlugin(
+ $aclPlugin
);
- $tree = array(
- new Calendar($cbackend,$props),
- );
-
- $p = new ICSExportPlugin();
-
- $s = new DAV\Server($tree);
- $s->addPlugin($p);
- $s->addPlugin(new Plugin());
- $s->addPlugin(new DAVACL\Plugin());
-
- $h = HTTP\Sapi::createFromServerArray([
- 'REQUEST_URI' => '/UUID-123467?export',
- ]);
- $s->httpRequest = $h;
- $s->httpResponse = new HTTP\ResponseMock();
-
- $p->httpGet($h, $s->httpResponse);
+ $request = new HTTP\Request(
+ 'GET',
+ '/calendars/admin/UUID-123467?export'
+ );
- // If the ACL system blocked this request, the effect will be that
- // there's no response, because the calendar information could not be
- // fetched.
- $this->assertNull($s->httpResponse->getStatus());
+ $this->request($request, 403);
}
function testACLIntegrationNotBlocked() {
- $cbackend = TestUtil::getBackend();
- $pbackend = new DAVACL\PrincipalBackend\Mock();
-
- $props = array(
- 'uri'=>'UUID-123467',
- 'principaluri' => 'admin',
- 'id' => 1,
+ $aclPlugin = new DAVACL\Plugin();
+ $aclPlugin->allowUnauthenticatedAccess = false;
+ $this->server->addPlugin(
+ $aclPlugin
);
- $tree = array(
- new Calendar($cbackend,$props),
- new DAVACL\PrincipalCollection($pbackend),
+ $this->server->addPlugin(
+ new Plugin()
);
- $p = new ICSExportPlugin();
+ $this->autoLogin('admin');
- $s = new DAV\Server($tree);
- $s->sapi = new HTTP\SapiMock();
- $s->addPlugin($p);
- $s->addPlugin(new Plugin());
- $s->addPlugin(new DAVACL\Plugin());
- $s->addPlugin(new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock(),'SabreDAV'));
-
- // Forcing login
- $s->getPlugin('acl')->adminPrincipals = array('principals/admin');
-
-
- $h = HTTP\Sapi::createFromServerArray([
- 'REQUEST_URI' => '/UUID-123467?export',
- 'REQUEST_METHOD' => 'GET',
- ]);
-
- $s->httpRequest = $h;
- $s->httpResponse = new HTTP\ResponseMock();
-
- $s->exec();
+ $request = new HTTP\Request(
+ 'GET',
+ '/calendars/admin/UUID-123467?export'
+ );
- $this->assertEquals(200, $s->httpResponse->status,'Invalid status received. Response body: '. $s->httpResponse->body);
- $this->assertEquals(array(
- 'X-Sabre-Version' => [DAV\Version::VERSION],
- 'Content-Type' => ['text/calendar'],
- ), $s->httpResponse->getHeaders());
+ $response = $this->request($request, 200);
+ $this->assertEquals('text/calendar', $response->getHeader('Content-Type'));
- $obj = VObject\Reader::read($s->httpResponse->body);
+ $obj = VObject\Reader::read($response->body);
- $this->assertEquals(5,count($obj->children()));
- $this->assertEquals(1,count($obj->VERSION));
- $this->assertEquals(1,count($obj->CALSCALE));
- $this->assertEquals(1,count($obj->PRODID));
- $this->assertEquals(1,count($obj->VTIMEZONE));
- $this->assertEquals(1,count($obj->VEVENT));
+ $this->assertEquals(8, count($obj->children()));
+ $this->assertEquals(1, count($obj->VERSION));
+ $this->assertEquals(1, count($obj->CALSCALE));
+ $this->assertEquals(1, count($obj->PRODID));
+ $this->assertTrue(strpos((string)$obj->PRODID, DAV\Version::VERSION) !== false);
+ $this->assertEquals(1, count($obj->VTIMEZONE));
+ $this->assertEquals(1, count($obj->VEVENT));
}
function testBadStartParam() {
- $cbackend = TestUtil::getBackend();
- $pbackend = new DAVACL\PrincipalBackend\Mock();
-
- $props = array(
- 'uri'=>'UUID-123467',
- 'principaluri' => 'admin',
- 'id' => 1,
- );
- $tree = array(
- new Calendar($cbackend,$props),
- new DAVACL\PrincipalCollection($pbackend),
+ $request = new HTTP\Request(
+ 'GET',
+ '/calendars/admin/UUID-123467?export&start=foo'
);
-
- $p = new ICSExportPlugin();
-
- $s = new DAV\Server($tree);
- $s->sapi = new HTTP\SapiMock();
- $s->addPlugin($p);
- $s->addPlugin(new Plugin());
-
- $h = HTTP\Sapi::createFromServerArray([
- 'REQUEST_URI' => '/UUID-123467?export&start=foo',
- 'REQUEST_METHOD' => 'GET',
- ]);
-
- $s->httpRequest = $h;
- $s->httpResponse = new HTTP\ResponseMock();
-
- $s->exec();
-
- $this->assertEquals(400, $s->httpResponse->status,'Invalid status received. Response body: '. $s->httpResponse->body);
+ $this->request($request, 400);
}
function testBadEndParam() {
- $cbackend = TestUtil::getBackend();
- $pbackend = new DAVACL\PrincipalBackend\Mock();
-
- $props = array(
- 'uri'=>'UUID-123467',
- 'principaluri' => 'admin',
- 'id' => 1,
+ $request = new HTTP\Request(
+ 'GET',
+ '/calendars/admin/UUID-123467?export&end=foo'
);
- $tree = array(
- new Calendar($cbackend,$props),
- new DAVACL\PrincipalCollection($pbackend),
- );
-
- $p = new ICSExportPlugin();
-
- $s = new DAV\Server($tree);
- $s->sapi = new HTTP\SapiMock();
- $s->addPlugin($p);
- $s->addPlugin(new Plugin());
-
- $h = HTTP\Sapi::createFromServerArray([
- 'REQUEST_URI' => '/UUID-123467?export&end=foo',
- 'REQUEST_METHOD' => 'GET',
- ]);
-
- $s->httpRequest = $h;
- $s->httpResponse = new HTTP\ResponseMock();
-
- $s->exec();
-
- $this->assertEquals(400, $s->httpResponse->status,'Invalid status received. Response body: '. $s->httpResponse->body);
+ $this->request($request, 400);
}
function testFilterStartEnd() {
- $cbackend = TestUtil::getBackend();
- $pbackend = new DAVACL\PrincipalBackend\Mock();
-
- $props = array(
- 'uri'=>'UUID-123467',
- 'principaluri' => 'admin',
- 'id' => 1,
+ $request = new HTTP\Request(
+ 'GET',
+ '/calendars/admin/UUID-123467?export&start=1&end=2'
);
- $tree = array(
- new Calendar($cbackend,$props),
- new DAVACL\PrincipalCollection($pbackend),
- );
-
- $p = new ICSExportPlugin();
-
- $s = new DAV\Server($tree);
- $s->sapi = new HTTP\SapiMock();
- $s->addPlugin($p);
- $s->addPlugin(new Plugin());
-
- $h = HTTP\Sapi::createFromServerArray([
- 'REQUEST_URI' => '/UUID-123467?export&start=1&end=2',
- 'REQUEST_METHOD' => 'GET',
- ]);
+ $response = $this->request($request, 200);
- $s->httpRequest = $h;
- $s->httpResponse = new HTTP\ResponseMock();
+ $obj = VObject\Reader::read($response->getBody());
- $s->exec();
-
- $this->assertEquals(200, $s->httpResponse->status,'Invalid status received. Response body: '. $s->httpResponse->body);
- $obj = VObject\Reader::read($s->httpResponse->body);
-
- $this->assertEquals(0,count($obj->VTIMEZONE));
- $this->assertEquals(0,count($obj->VEVENT));
+ $this->assertEquals(0, count($obj->VTIMEZONE));
+ $this->assertEquals(0, count($obj->VEVENT));
}
function testExpandNoStart() {
- $cbackend = TestUtil::getBackend();
- $pbackend = new DAVACL\PrincipalBackend\Mock();
-
- $props = array(
- 'uri'=>'UUID-123467',
- 'principaluri' => 'admin',
- 'id' => 1,
+ $request = new HTTP\Request(
+ 'GET',
+ '/calendars/admin/UUID-123467?export&expand=1&end=2'
);
- $tree = array(
- new Calendar($cbackend,$props),
- new DAVACL\PrincipalCollection($pbackend),
- );
-
- $p = new ICSExportPlugin();
-
- $s = new DAV\Server($tree);
- $s->sapi = new HTTP\SapiMock();
- $s->addPlugin($p);
- $s->addPlugin(new Plugin());
-
- $h = HTTP\Sapi::createFromServerArray([
- 'REQUEST_URI' => '/UUID-123467?export&expand=1&end=1',
- 'REQUEST_METHOD' => 'GET',
- ]);
-
- $s->httpRequest = $h;
- $s->httpResponse = new HTTP\ResponseMock();
-
- $s->exec();
-
- $this->assertEquals(400, $s->httpResponse->status,'Invalid status received. Response body: '. $s->httpResponse->body);
+ $this->request($request, 400);
}
function testExpand() {
- $cbackend = TestUtil::getBackend();
- $pbackend = new DAVACL\PrincipalBackend\Mock();
-
- $props = array(
- 'uri'=>'UUID-123467',
- 'principaluri' => 'admin',
- 'id' => 1,
+ $request = new HTTP\Request(
+ 'GET',
+ '/calendars/admin/UUID-123467?export&start=1&end=2000000000&expand=1'
);
- $tree = array(
- new Calendar($cbackend,$props),
- new DAVACL\PrincipalCollection($pbackend),
- );
-
- $p = new ICSExportPlugin();
-
- $s = new DAV\Server($tree);
- $s->sapi = new HTTP\SapiMock();
- $s->addPlugin($p);
- $s->addPlugin(new Plugin());
-
- $h = HTTP\Sapi::createFromServerArray([
- 'REQUEST_URI' => '/UUID-123467?export&start=1&end=2000000000&expand=1',
- 'REQUEST_METHOD' => 'GET',
- ]);
+ $response = $this->request($request, 200);
- $s->httpRequest = $h;
- $s->httpResponse = new HTTP\ResponseMock();
+ $obj = VObject\Reader::read($response->getBody());
- $s->exec();
-
- $this->assertEquals(200, $s->httpResponse->status,'Invalid status received. Response body: '. $s->httpResponse->body);
- $obj = VObject\Reader::read($s->httpResponse->body);
-
- $this->assertEquals(0,count($obj->VTIMEZONE));
- $this->assertEquals(1,count($obj->VEVENT));
+ $this->assertEquals(0, count($obj->VTIMEZONE));
+ $this->assertEquals(1, count($obj->VEVENT));
}
function testJCal() {
- $cbackend = TestUtil::getBackend();
- $pbackend = new DAVACL\PrincipalBackend\Mock();
-
- $props = array(
- 'uri'=>'UUID-123467',
- 'principaluri' => 'admin',
- 'id' => 1,
+ $request = new HTTP\Request(
+ 'GET',
+ '/calendars/admin/UUID-123467?export',
+ ['Accept' => 'application/calendar+json']
);
- $tree = array(
- new Calendar($cbackend,$props),
- new DAVACL\PrincipalCollection($pbackend),
- );
-
- $p = new ICSExportPlugin();
-
- $s = new DAV\Server($tree);
- $s->sapi = new HTTP\SapiMock();
- $s->addPlugin($p);
- $s->addPlugin(new Plugin());
-
- $h = HTTP\Sapi::createFromServerArray([
- 'REQUEST_URI' => '/UUID-123467?export',
- 'REQUEST_METHOD' => 'GET',
- 'HTTP_ACCEPT' => 'application/calendar+json',
- ]);
- $s->httpRequest = $h;
- $s->httpResponse = new HTTP\ResponseMock();
-
- $s->exec();
-
- $this->assertEquals(200, $s->httpResponse->status,'Invalid status received. Response body: '. $s->httpResponse->body);
- $this->assertEquals('application/calendar+json', $s->httpResponse->getHeader('Content-Type'));
+ $response = $this->request($request, 200);
+ $this->assertEquals('application/calendar+json', $response->getHeader('Content-Type'));
}
function testJCalInUrl() {
- $cbackend = TestUtil::getBackend();
- $pbackend = new DAVACL\PrincipalBackend\Mock();
-
- $props = array(
- 'uri'=>'UUID-123467',
- 'principaluri' => 'admin',
- 'id' => 1,
- );
- $tree = array(
- new Calendar($cbackend,$props),
- new DAVACL\PrincipalCollection($pbackend),
+ $request = new HTTP\Request(
+ 'GET',
+ '/calendars/admin/UUID-123467?export&accept=jcal'
);
- $p = new ICSExportPlugin();
-
- $s = new DAV\Server($tree);
- $s->sapi = new HTTP\SapiMock();
- $s->addPlugin($p);
- $s->addPlugin(new Plugin());
-
- $h = HTTP\Sapi::createFromServerArray([
- 'REQUEST_URI' => '/UUID-123467?export&accept=jcal',
- 'REQUEST_METHOD' => 'GET',
- ]);
-
- $s->httpRequest = $h;
- $s->httpResponse = new HTTP\ResponseMock();
-
- $s->exec();
-
- $this->assertEquals(200, $s->httpResponse->status,'Invalid status received. Response body: '. $s->httpResponse->body);
- $this->assertEquals('application/calendar+json', $s->httpResponse->getHeader('Content-Type'));
+ $response = $this->request($request, 200);
+ $this->assertEquals('application/calendar+json', $response->getHeader('Content-Type'));
}
function testNegotiateDefault() {
- $cbackend = TestUtil::getBackend();
- $pbackend = new DAVACL\PrincipalBackend\Mock();
-
- $props = array(
- 'uri'=>'UUID-123467',
- 'principaluri' => 'admin',
- 'id' => 1,
- );
- $tree = array(
- new Calendar($cbackend,$props),
- new DAVACL\PrincipalCollection($pbackend),
+ $request = new HTTP\Request(
+ 'GET',
+ '/calendars/admin/UUID-123467?export',
+ ['Accept' => 'text/plain']
);
- $p = new ICSExportPlugin();
-
- $s = new DAV\Server($tree);
- $s->sapi = new HTTP\SapiMock();
- $s->addPlugin($p);
- $s->addPlugin(new Plugin());
-
- $h = HTTP\Sapi::createFromServerArray([
- 'REQUEST_URI' => '/UUID-123467?export',
- 'REQUEST_METHOD' => 'GET',
- 'HTTP_ACCEPT' => 'text/plain',
- ]);
-
- $s->httpRequest = $h;
- $s->httpResponse = new HTTP\ResponseMock();
-
- $s->exec();
-
- $this->assertEquals(200, $s->httpResponse->status,'Invalid status received. Response body: '. $s->httpResponse->body);
- $this->assertEquals('text/calendar', $s->httpResponse->getHeader('Content-Type'));
+ $response = $this->request($request, 200);
+ $this->assertEquals('text/calendar', $response->getHeader('Content-Type'));
}
function testFilterComponentVEVENT() {
- $cbackend = TestUtil::getBackend();
- $pbackend = new DAVACL\PrincipalBackend\Mock();
-
- $props = array(
- 'uri'=>'UUID-123467',
- 'principaluri' => 'admin',
- 'id' => 1,
- );
- // add a todo to the calendar (see /tests/Sabre/TestUtil)
- $cbackend->createCalendarObject(1, 'UUID-3456', TestUtil::getTestTODO());
-
- $tree = array(
- new Calendar($cbackend,$props),
- new DAVACL\PrincipalCollection($pbackend),
+ $request = new HTTP\Request(
+ 'GET',
+ '/calendars/admin/UUID-123467?export&componentType=VEVENT'
);
- $p = new ICSExportPlugin();
+ $response = $this->request($request, 200);
- $s = new DAV\Server($tree);
- $s->sapi = new HTTP\SapiMock();
- $s->addPlugin($p);
- $s->addPlugin(new Plugin());
-
- $h = HTTP\Sapi::createFromServerArray([
- 'REQUEST_URI' => '/UUID-123467?export&componentType=VEVENT',
- 'REQUEST_METHOD' => 'GET',
- ]);
-
- $s->httpRequest = $h;
- $s->httpResponse = new HTTP\ResponseMock();
-
- $s->exec();
-
- $this->assertEquals(200, $s->httpResponse->status,'Invalid status received. Response body: '. $s->httpResponse->body);
- $obj = VObject\Reader::read($s->httpResponse->body);
-
- $this->assertEquals(1,count($obj->VTIMEZONE));
- $this->assertEquals(1,count($obj->VEVENT));
- $this->assertEquals(0,count($obj->VTODO));
+ $obj = VObject\Reader::read($response->body);
+ $this->assertEquals(1, count($obj->VTIMEZONE));
+ $this->assertEquals(1, count($obj->VEVENT));
+ $this->assertEquals(0, count($obj->VTODO));
}
function testFilterComponentVTODO() {
- $cbackend = TestUtil::getBackend();
- $pbackend = new DAVACL\PrincipalBackend\Mock();
+ $request = new HTTP\Request(
+ 'GET',
+ '/calendars/admin/UUID-123467?export&componentType=VTODO'
+ );
- $props = [
- 'uri'=>'UUID-123467',
- 'principaluri' => 'admin',
- 'id' => 1,
- ];
- // add a todo to the calendar (see /tests/Sabre/TestUtil)
- $cbackend->createCalendarObject(1, 'UUID-3456', TestUtil::getTestTODO());
+ $response = $this->request($request, 200);
- $tree = [
- new Calendar($cbackend,$props),
- new DAVACL\PrincipalCollection($pbackend),
- ];
+ $obj = VObject\Reader::read($response->body);
- $p = new ICSExportPlugin();
+ $this->assertEquals(0, count($obj->VTIMEZONE));
+ $this->assertEquals(0, count($obj->VEVENT));
+ $this->assertEquals(1, count($obj->VTODO));
- $s = new DAV\Server($tree);
- $s->sapi = new HTTP\SapiMock();
- $s->addPlugin($p);
- $s->addPlugin(new Plugin());
+ }
- $h = HTTP\Sapi::createFromServerArray([
- 'REQUEST_URI' => '/UUID-123467?export&componentType=VTODO',
- 'REQUEST_METHOD' => 'GET',
- ]);
+ function testFilterComponentBadComponent() {
- $s->httpRequest = $h;
- $s->httpResponse = new HTTP\ResponseMock();
+ $request = new HTTP\Request(
+ 'GET',
+ '/calendars/admin/UUID-123467?export&componentType=VVOODOO'
+ );
- $s->exec();
+ $response = $this->request($request, 400);
- $this->assertEquals(200, $s->httpResponse->status,'Invalid status received. Response body: '. $s->httpResponse->body);
- $obj = VObject\Reader::read($s->httpResponse->body);
+ }
- $this->assertEquals(0,count($obj->VTIMEZONE));
- $this->assertEquals(0,count($obj->VEVENT));
- $this->assertEquals(1,count($obj->VTODO));
+ function testContentDisposition() {
- }
+ $request = new HTTP\Request(
+ 'GET',
+ '/calendars/admin/UUID-123467?export'
+ );
- function testFilterComponentBadComponent() {
+ $response = $this->request($request, 200);
+ $this->assertEquals('text/calendar', $response->getHeader('Content-Type'));
+ $this->assertEquals(
+ 'attachment; filename="UUID-123467-' . date('Y-m-d') . '.ics"',
+ $response->getHeader('Content-Disposition')
+ );
- $cbackend = TestUtil::getBackend();
- $pbackend = new DAVACL\PrincipalBackend\Mock();
+ }
- $props = [
- 'uri'=>'UUID-123467',
- 'principaluri' => 'admin',
- 'id' => 1,
- ];
- // add a todo to the calendar (see /tests/Sabre/TestUtil)
- $cbackend->createCalendarObject(1, 'UUID-3456', TestUtil::getTestTODO());
+ function testContentDispositionJson() {
- $tree = [
- new Calendar($cbackend,$props),
- new DAVACL\PrincipalCollection($pbackend),
- ];
+ $request = new HTTP\Request(
+ 'GET',
+ '/calendars/admin/UUID-123467?export',
+ ['Accept' => 'application/calendar+json']
+ );
- $p = new ICSExportPlugin();
+ $response = $this->request($request, 200);
+ $this->assertEquals('application/calendar+json', $response->getHeader('Content-Type'));
+ $this->assertEquals(
+ 'attachment; filename="UUID-123467-' . date('Y-m-d') . '.json"',
+ $response->getHeader('Content-Disposition')
+ );
- $s = new DAV\Server($tree);
- $s->sapi = new HTTP\SapiMock();
- $s->addPlugin($p);
- $s->addPlugin(new Plugin());
+ }
- $h = HTTP\Sapi::createFromServerArray([
- 'REQUEST_URI' => '/UUID-123467?export&componentType=VVOODOO',
- 'REQUEST_METHOD' => 'GET',
- ]);
+ function testContentDispositionBadChars() {
- $s->httpRequest = $h;
- $s->httpResponse = new HTTP\ResponseMock();
+ $this->caldavBackend->createCalendar(
+ 'principals/admin',
+ 'UUID-b_ad"(ch)ars',
+ [
+ '{DAV:}displayname' => 'Test bad characters',
+ '{http://apple.com/ns/ical/}calendar-color' => '#AA0000FF',
+ ]
+ );
- $s->exec();
+ $request = new HTTP\Request(
+ 'GET',
+ '/calendars/admin/UUID-b_ad"(ch)ars?export',
+ ['Accept' => 'application/calendar+json']
+ );
- $this->assertEquals(400, $s->httpResponse->status,'Invalid status received. Response body: '. $s->httpResponse->body);
+ $response = $this->request($request, 200);
+ $this->assertEquals('application/calendar+json', $response->getHeader('Content-Type'));
+ $this->assertEquals(
+ 'attachment; filename="UUID-b_adchars-' . date('Y-m-d') . '.json"',
+ $response->getHeader('Content-Disposition')
+ );
}
+
}
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue166Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue166Test.php
index f925224f2..a1a9b7c04 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue166Test.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue166Test.php
@@ -1,8 +1,8 @@
<?php
namespace Sabre\CalDAV;
+
use Sabre\VObject;
-use Sabre\DAV;
class Issue166Test extends \PHPUnit_Framework_TestCase {
@@ -37,26 +37,26 @@ HI;
$validator = new CalendarQueryValidator();
- $filters = array(
- 'name' => 'VCALENDAR',
- 'comp-filters' => array(
- array(
- 'name' => 'VEVENT',
- 'comp-filters' => array(),
- 'prop-filters' => array(),
+ $filters = [
+ 'name' => 'VCALENDAR',
+ 'comp-filters' => [
+ [
+ 'name' => 'VEVENT',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => array(
+ 'time-range' => [
'start' => new \DateTime('2011-12-01'),
'end' => new \DateTime('2012-02-01'),
- ),
- ),
- ),
- 'prop-filters' => array(),
+ ],
+ ],
+ ],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => null,
- );
+ 'time-range' => null,
+ ];
$input = VObject\Reader::read($input);
- $this->assertTrue($validator->validate($input,$filters));
+ $this->assertTrue($validator->validate($input, $filters));
}
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue172Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue172Test.php
index ce6d364f6..e2b85c2bc 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue172Test.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue172Test.php
@@ -1,8 +1,8 @@
<?php
namespace Sabre\CalDAV;
+
use Sabre\VObject;
-use Sabre\DAV;
class Issue172Test extends \PHPUnit_Framework_TestCase {
@@ -18,24 +18,24 @@ END:VEVENT
END:VCALENDAR
HI;
$validator = new CalendarQueryValidator();
- $filters = array(
- 'name' => 'VCALENDAR',
- 'comp-filters' => array(
- array(
- 'name' => 'VEVENT',
- 'comp-filters' => array(),
- 'prop-filters' => array(),
+ $filters = [
+ 'name' => 'VCALENDAR',
+ 'comp-filters' => [
+ [
+ 'name' => 'VEVENT',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => array(
+ 'time-range' => [
'start' => new \DateTime('2012-01-18 21:00:00 GMT-08:00'),
'end' => new \DateTime('2012-01-18 21:00:00 GMT-08:00'),
- ),
- ),
- ),
- 'prop-filters' => array(),
- );
+ ],
+ ],
+ ],
+ 'prop-filters' => [],
+ ];
$input = VObject\Reader::read($input);
- $this->assertTrue($validator->validate($input,$filters));
+ $this->assertTrue($validator->validate($input, $filters));
}
// Pacific Standard Time, translates to America/Los_Angeles (GMT-8 in January)
@@ -65,24 +65,24 @@ END:VEVENT
END:VCALENDAR
HI;
$validator = new CalendarQueryValidator();
- $filters = array(
- 'name' => 'VCALENDAR',
- 'comp-filters' => array(
- array(
- 'name' => 'VEVENT',
- 'comp-filters' => array(),
- 'prop-filters' => array(),
+ $filters = [
+ 'name' => 'VCALENDAR',
+ 'comp-filters' => [
+ [
+ 'name' => 'VEVENT',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => array(
+ 'time-range' => [
'start' => new \DateTime('2012-01-13 10:30:00 GMT-08:00'),
'end' => new \DateTime('2012-01-13 10:30:00 GMT-08:00'),
- ),
- ),
- ),
- 'prop-filters' => array(),
- );
+ ],
+ ],
+ ],
+ 'prop-filters' => [],
+ ];
$input = VObject\Reader::read($input);
- $this->assertTrue($validator->validate($input,$filters));
+ $this->assertTrue($validator->validate($input, $filters));
}
// X-LIC-LOCATION, translates to America/Los_Angeles (GMT-8 in January)
@@ -113,23 +113,23 @@ END:VEVENT
END:VCALENDAR
HI;
$validator = new CalendarQueryValidator();
- $filters = array(
- 'name' => 'VCALENDAR',
- 'comp-filters' => array(
- array(
- 'name' => 'VEVENT',
- 'comp-filters' => array(),
- 'prop-filters' => array(),
+ $filters = [
+ 'name' => 'VCALENDAR',
+ 'comp-filters' => [
+ [
+ 'name' => 'VEVENT',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => array(
+ 'time-range' => [
'start' => new \DateTime('2012-01-13 10:30:00 GMT-08:00'),
'end' => new \DateTime('2012-01-13 10:30:00 GMT-08:00'),
- ),
- ),
- ),
- 'prop-filters' => array(),
- );
+ ],
+ ],
+ ],
+ 'prop-filters' => [],
+ ];
$input = VObject\Reader::read($input);
- $this->assertTrue($validator->validate($input,$filters));
+ $this->assertTrue($validator->validate($input, $filters));
}
}
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue205Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue205Test.php
index 4a53fcbe2..ce40a90b0 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue205Test.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue205Test.php
@@ -1,6 +1,7 @@
<?php
namespace Sabre\CalDAV;
+
use Sabre\HTTP;
use Sabre\VObject;
@@ -15,18 +16,18 @@ class Issue205Test extends \Sabre\DAVServerTest {
protected $setupCalDAV = true;
- protected $caldavCalendars = array(
- array(
- 'id' => 1,
- 'name' => 'Calendar',
+ protected $caldavCalendars = [
+ [
+ 'id' => 1,
+ 'name' => 'Calendar',
'principaluri' => 'principals/user1',
- 'uri' => 'calendar1',
- )
- );
+ 'uri' => 'calendar1',
+ ]
+ ];
- protected $caldavCalendarObjects = array(
- 1 => array(
- 'event.ics' => array(
+ protected $caldavCalendarObjects = [
+ 1 => [
+ 'event.ics' => [
'calendardata' => 'BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
@@ -44,18 +45,18 @@ END:VALARM
END:VEVENT
END:VCALENDAR
',
- ),
- ),
- );
+ ],
+ ],
+ ];
function testIssue205() {
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'REPORT',
+ $request = HTTP\Sapi::createFromServerArray([
+ 'REQUEST_METHOD' => 'REPORT',
'HTTP_CONTENT_TYPE' => 'application/xml',
- 'REQUEST_URI' => '/calendars/user1/calendar1',
- 'HTTP_DEPTH' => '1',
- ));
+ 'REQUEST_URI' => '/calendars/user1/calendar1',
+ 'HTTP_DEPTH' => '1',
+ ]);
$request->setBody('<?xml version="1.0" encoding="utf-8" ?>
<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
@@ -87,7 +88,7 @@ END:VCALENDAR
$start = strpos($response->body, 'BEGIN:VCALENDAR'),
strpos($response->body, 'END:VCALENDAR') - $start + 13
);
- $body = str_replace('&#13;','',$body);
+ $body = str_replace('&#13;', '', $body);
$vObject = VObject\Reader::read($body);
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue211Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue211Test.php
index f291e5e57..950629fd8 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue211Test.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue211Test.php
@@ -1,8 +1,8 @@
<?php
namespace Sabre\CalDAV;
+
use Sabre\HTTP;
-use Sabre\VObject;
/**
* This unittest is created to check for an endless loop in Sabre\CalDAV\CalendarQueryValidator
@@ -15,18 +15,18 @@ class Issue211Test extends \Sabre\DAVServerTest {
protected $setupCalDAV = true;
- protected $caldavCalendars = array(
- array(
- 'id' => 1,
- 'name' => 'Calendar',
+ protected $caldavCalendars = [
+ [
+ 'id' => 1,
+ 'name' => 'Calendar',
'principaluri' => 'principals/user1',
- 'uri' => 'calendar1',
- )
- );
+ 'uri' => 'calendar1',
+ ]
+ ];
- protected $caldavCalendarObjects = array(
- 1 => array(
- 'event.ics' => array(
+ protected $caldavCalendarObjects = [
+ 1 => [
+ 'event.ics' => [
'calendardata' => 'BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
@@ -49,18 +49,18 @@ END:VALARM
END:VEVENT
END:VCALENDAR
',
- ),
- ),
- );
+ ],
+ ],
+ ];
function testIssue211() {
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'REPORT',
+ $request = HTTP\Sapi::createFromServerArray([
+ 'REQUEST_METHOD' => 'REPORT',
'HTTP_CONTENT_TYPE' => 'application/xml',
- 'REQUEST_URI' => '/calendars/user1/calendar1',
- 'HTTP_DEPTH' => '1',
- ));
+ 'REQUEST_URI' => '/calendars/user1/calendar1',
+ 'HTTP_DEPTH' => '1',
+ ]);
$request->setBody('<?xml version="1.0" encoding="utf-8" ?>
<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue220Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue220Test.php
index 7b5dbfe63..c3c0b5b48 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue220Test.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue220Test.php
@@ -15,18 +15,18 @@ class Issue220Test extends \Sabre\DAVServerTest {
protected $setupCalDAV = true;
- protected $caldavCalendars = array(
- array(
- 'id' => 1,
- 'name' => 'Calendar',
+ protected $caldavCalendars = [
+ [
+ 'id' => 1,
+ 'name' => 'Calendar',
'principaluri' => 'principals/user1',
- 'uri' => 'calendar1',
- )
- );
+ 'uri' => 'calendar1',
+ ]
+ ];
- protected $caldavCalendarObjects = array(
- 1 => array(
- 'event.ics' => array(
+ protected $caldavCalendarObjects = [
+ 1 => [
+ 'event.ics' => [
'calendardata' => 'BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
@@ -59,18 +59,18 @@ UID:b64f14c5-dccc-4eda-947f-bdb1f763fbcd
END:VEVENT
END:VCALENDAR
',
- ),
- ),
- );
+ ],
+ ],
+ ];
function testIssue220() {
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'REPORT',
+ $request = HTTP\Sapi::createFromServerArray([
+ 'REQUEST_METHOD' => 'REPORT',
'HTTP_CONTENT_TYPE' => 'application/xml',
- 'REQUEST_URI' => '/calendars/user1/calendar1',
- 'HTTP_DEPTH' => '1',
- ));
+ 'REQUEST_URI' => '/calendars/user1/calendar1',
+ 'HTTP_DEPTH' => '1',
+ ]);
$request->setBody('<?xml version="1.0" encoding="utf-8" ?>
<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue228Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue228Test.php
index ccc6b303a..d0783701d 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue228Test.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue228Test.php
@@ -1,6 +1,7 @@
<?php
namespace Sabre\CalDAV;
+
use Sabre\HTTP;
/**
@@ -14,18 +15,18 @@ class Issue228Test extends \Sabre\DAVServerTest {
protected $setupCalDAV = true;
- protected $caldavCalendars = array(
- array(
- 'id' => 1,
- 'name' => 'Calendar',
+ protected $caldavCalendars = [
+ [
+ 'id' => 1,
+ 'name' => 'Calendar',
'principaluri' => 'principals/user1',
- 'uri' => 'calendar1',
- )
- );
+ 'uri' => 'calendar1',
+ ]
+ ];
- protected $caldavCalendarObjects = array(
- 1 => array(
- 'event.ics' => array(
+ protected $caldavCalendarObjects = [
+ 1 => [
+ 'event.ics' => [
'calendardata' => 'BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
@@ -38,18 +39,18 @@ TRANSP:TRANSPARENT
END:VEVENT
END:VCALENDAR
',
- ),
- ),
- );
+ ],
+ ],
+ ];
function testIssue228() {
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'REPORT',
+ $request = HTTP\Sapi::createFromServerArray([
+ 'REQUEST_METHOD' => 'REPORT',
'HTTP_CONTENT_TYPE' => 'application/xml',
- 'REQUEST_URI' => '/calendars/user1/calendar1',
- 'HTTP_DEPTH' => '1',
- ));
+ 'REQUEST_URI' => '/calendars/user1/calendar1',
+ 'HTTP_DEPTH' => '1',
+ ]);
$request->setBody('<?xml version="1.0" encoding="utf-8" ?>
<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/CollectionTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/CollectionTest.php
index 68035184f..6585f85c3 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/CollectionTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/CollectionTest.php
@@ -14,13 +14,13 @@ class CollectionTest extends \PHPUnit_Framework_TestCase {
$this->principalUri = 'principals/user1';
- $this->notification = new CalDAV\Xml\Notification\SystemStatus(1,'"1"');
+ $this->notification = new CalDAV\Xml\Notification\SystemStatus(1, '"1"');
- $this->caldavBackend = new CalDAV\Backend\MockSharing(array(),array(), array(
- 'principals/user1' => array(
+ $this->caldavBackend = new CalDAV\Backend\MockSharing([], [], [
+ 'principals/user1' => [
$this->notification
- )
- ));
+ ]
+ ]);
return new Collection($this->caldavBackend, $this->principalUri);
@@ -31,9 +31,9 @@ class CollectionTest extends \PHPUnit_Framework_TestCase {
$col = $this->getInstance();
$this->assertEquals('notifications', $col->getName());
- $this->assertEquals(array(
+ $this->assertEquals([
new Node($this->caldavBackend, $this->principalUri, $this->notification)
- ), $col->getChildren());
+ ], $col->getChildren());
}
@@ -54,30 +54,25 @@ class CollectionTest extends \PHPUnit_Framework_TestCase {
function testGetACL() {
$col = $this->getInstance();
- $expected = array(
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => $this->principalUri,
+ $expected = [
+ [
+ 'privilege' => '{DAV:}all',
+ 'principal' => '{DAV:}owner',
'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}write',
- 'principal' => $this->principalUri,
- 'protected' => true,
- ),
- );
+ ],
+ ];
$this->assertEquals($expected, $col->getACL());
}
/**
- * @expectedException Sabre\DAV\Exception\NotImplemented
+ * @expectedException \Sabre\DAV\Exception\Forbidden
*/
function testSetACL() {
$col = $this->getInstance();
- $col->setACL(array());
+ $col->setACL([]);
}
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/NodeTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/NodeTest.php
index d546116fc..6c6e02da8 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/NodeTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/NodeTest.php
@@ -13,7 +13,7 @@ class NodeTest extends \PHPUnit_Framework_TestCase {
$principalUri = 'principals/user1';
- $this->systemStatus = new CalDAV\Xml\Notification\SystemStatus(1,'"1"');
+ $this->systemStatus = new CalDAV\Xml\Notification\SystemStatus(1, '"1"');
$this->caldavBackend = new CalDAV\Backend\MockSharing([], [], [
'principals/user1' => [
@@ -51,7 +51,7 @@ class NodeTest extends \PHPUnit_Framework_TestCase {
$node = $this->getInstance();
$node->delete();
- $this->assertEquals(array(), $this->caldavBackend->getNotificationsForPrincipal('principals/user1'));
+ $this->assertEquals([], $this->caldavBackend->getNotificationsForPrincipal('principals/user1'));
}
@@ -65,30 +65,25 @@ class NodeTest extends \PHPUnit_Framework_TestCase {
function testGetACL() {
$node = $this->getInstance();
- $expected = array(
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => 'principals/user1',
+ $expected = [
+ [
+ 'privilege' => '{DAV:}all',
+ 'principal' => '{DAV:}owner',
'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}write',
- 'principal' => 'principals/user1',
- 'protected' => true,
- ),
- );
+ ],
+ ];
$this->assertEquals($expected, $node->getACL());
}
/**
- * @expectedException Sabre\DAV\Exception\NotImplemented
+ * @expectedException \Sabre\DAV\Exception\Forbidden
*/
function testSetACL() {
$node = $this->getInstance();
- $node->setACL(array());
+ $node->setACL([]);
}
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php
index 138012ffa..8d538dee5 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php
@@ -81,12 +81,14 @@ class PluginTest extends \PHPUnit_Framework_TestCase {
$this->server->addPlugin($this->plugin);
// Adding ACL plugin
- $this->server->addPlugin(new DAVACL\Plugin());
+ $aclPlugin = new DAVACL\Plugin();
+ $aclPlugin->allowUnauthenticatedAccess = false;
+ $this->server->addPlugin($aclPlugin);
// Adding Auth plugin, and ensuring that we are logged in.
$authBackend = new DAV\Auth\Backend\Mock();
$authBackend->setPrincipal('principals/user1');
- $authPlugin = new DAV\Auth\Plugin($authBackend, 'SabreDAV');
+ $authPlugin = new DAV\Auth\Plugin($authBackend);
$authPlugin->beforeMethod(new \Sabre\HTTP\Request(), new \Sabre\HTTP\Response());
$this->server->addPlugin($authPlugin);
@@ -480,8 +482,9 @@ END:VCALENDAR';
$this->assertInstanceOf('\\Sabre\\DAV\\Xml\\Property\\SupportedReportSet', $prop);
$value = [
'{DAV:}expand-property',
+ '{DAV:}principal-match',
'{DAV:}principal-property-search',
- '{DAV:}principal-search-property-set'
+ '{DAV:}principal-search-property-set',
];
$this->assertEquals($value, $prop->getValue());
@@ -508,6 +511,7 @@ END:VCALENDAR';
'{urn:ietf:params:xml:ns:caldav}calendar-query',
'{urn:ietf:params:xml:ns:caldav}free-busy-query',
'{DAV:}expand-property',
+ '{DAV:}principal-match',
'{DAV:}principal-property-search',
'{DAV:}principal-search-property-set'
];
@@ -533,6 +537,7 @@ END:VCALENDAR';
$value = [
'{DAV:}sync-collection',
'{DAV:}expand-property',
+ '{DAV:}principal-match',
'{DAV:}principal-property-search',
'{DAV:}principal-search-property-set',
];
@@ -719,7 +724,7 @@ XML;
'</c:calendar-query>';
$request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467', [
- 'Depth' => '0',
+ 'Depth' => '0',
'User-Agent' => 'MSFT-WP/8.10.14219 (gzip)',
]);
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/CollectionTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/CollectionTest.php
index 625f64211..23c248825 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/CollectionTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/CollectionTest.php
@@ -1,6 +1,7 @@
<?php
namespace Sabre\CalDAV\Principal;
+
use Sabre\DAVACL;
class CollectionTest extends \PHPUnit_Framework_TestCase {
@@ -9,9 +10,9 @@ class CollectionTest extends \PHPUnit_Framework_TestCase {
$back = new DAVACL\PrincipalBackend\Mock();
$col = new Collection($back);
- $r = $col->getChildForPrincipal(array(
+ $r = $col->getChildForPrincipal([
'uri' => 'principals/admin',
- ));
+ ]);
$this->assertInstanceOf('Sabre\\CalDAV\\Principal\\User', $r);
}
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyReadTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyReadTest.php
index 1ee999a92..fe07f0131 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyReadTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyReadTest.php
@@ -1,6 +1,7 @@
<?php
namespace Sabre\CalDAV\Principal;
+
use Sabre\DAVACL;
class ProxyReadTest extends \PHPUnit_Framework_TestCase {
@@ -10,9 +11,9 @@ class ProxyReadTest extends \PHPUnit_Framework_TestCase {
function getInstance() {
$backend = new DAVACL\PrincipalBackend\Mock();
- $principal = new ProxyRead($backend, array(
+ $principal = new ProxyRead($backend, [
'uri' => 'principal/user',
- ));
+ ]);
$this->backend = $backend;
return $principal;
@@ -61,7 +62,7 @@ class ProxyReadTest extends \PHPUnit_Framework_TestCase {
function testGetAlternateUriSet() {
$i = $this->getInstance();
- $this->assertEquals(array(), $i->getAlternateUriSet());
+ $this->assertEquals([], $i->getAlternateUriSet());
}
@@ -75,25 +76,25 @@ class ProxyReadTest extends \PHPUnit_Framework_TestCase {
function testGetGroupMemberSet() {
$i = $this->getInstance();
- $this->assertEquals(array(), $i->getGroupMemberSet());
+ $this->assertEquals([], $i->getGroupMemberSet());
}
function testGetGroupMembership() {
$i = $this->getInstance();
- $this->assertEquals(array(), $i->getGroupMembership());
+ $this->assertEquals([], $i->getGroupMembership());
}
function testSetGroupMemberSet() {
$i = $this->getInstance();
- $i->setGroupMemberSet(array('principals/foo'));
+ $i->setGroupMemberSet(['principals/foo']);
- $expected = array(
- $i->getPrincipalUrl() => array('principals/foo')
- );
+ $expected = [
+ $i->getPrincipalUrl() => ['principals/foo']
+ ];
$this->assertEquals($expected, $this->backend->groupMembers);
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyWriteTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyWriteTest.php
index c0186ff0d..6cdb9b30e 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyWriteTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyWriteTest.php
@@ -1,6 +1,7 @@
<?php
namespace Sabre\CalDAV\Principal;
+
use Sabre\DAVACL;
class ProxyWriteTest extends ProxyReadTest {
@@ -8,9 +9,9 @@ class ProxyWriteTest extends ProxyReadTest {
function getInstance() {
$backend = new DAVACL\PrincipalBackend\Mock();
- $principal = new ProxyWrite($backend, array(
+ $principal = new ProxyWrite($backend, [
'uri' => 'principal/user',
- ));
+ ]);
$this->backend = $backend;
return $principal;
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/UserTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/UserTest.php
index 37b5eae97..420bb3b1a 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/UserTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/UserTest.php
@@ -1,6 +1,7 @@
<?php
namespace Sabre\CalDAV\Principal;
+
use Sabre\DAVACL;
class UserTest extends \PHPUnit_Framework_TestCase {
@@ -8,18 +9,18 @@ class UserTest extends \PHPUnit_Framework_TestCase {
function getInstance() {
$backend = new DAVACL\PrincipalBackend\Mock();
- $backend->addPrincipal(array(
+ $backend->addPrincipal([
'uri' => 'principals/user/calendar-proxy-read',
- ));
- $backend->addPrincipal(array(
+ ]);
+ $backend->addPrincipal([
'uri' => 'principals/user/calendar-proxy-write',
- ));
- $backend->addPrincipal(array(
+ ]);
+ $backend->addPrincipal([
'uri' => 'principals/user/random',
- ));
- return new User($backend, array(
+ ]);
+ return new User($backend, [
'uri' => 'principals/user',
- ));
+ ]);
}
@@ -100,23 +101,23 @@ class UserTest extends \PHPUnit_Framework_TestCase {
function testGetACL() {
- $expected = array(
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => '{DAV:}authenticated',
+ $expected = [
+ [
+ 'privilege' => '{DAV:}all',
+ 'principal' => '{DAV:}owner',
'protected' => true,
- ),
- array(
+ ],
+ [
'privilege' => '{DAV:}read',
'principal' => 'principals/user/calendar-proxy-read',
'protected' => true,
- ),
- array(
+ ],
+ [
'privilege' => '{DAV:}read',
'principal' => 'principals/user/calendar-proxy-write',
'protected' => true,
- ),
- );
+ ],
+ ];
$u = $this->getInstance();
$this->assertEquals($expected, $u->getACL());
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Schedule/OutboxTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Schedule/OutboxTest.php
index 933c7157b..04d4b1237 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/Schedule/OutboxTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Schedule/OutboxTest.php
@@ -1,6 +1,7 @@
<?php
namespace Sabre\CalDAV\Schedule;
+
use Sabre\CalDAV;
use Sabre\DAV;
@@ -10,80 +11,38 @@ class OutboxTest extends \PHPUnit_Framework_TestCase {
$outbox = new Outbox('principals/user1');
$this->assertEquals('outbox', $outbox->getName());
- $this->assertEquals(array(), $outbox->getChildren());
+ $this->assertEquals([], $outbox->getChildren());
$this->assertEquals('principals/user1', $outbox->getOwner());
$this->assertEquals(null, $outbox->getGroup());
- $this->assertEquals(array(
- array(
- 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-query-freebusy',
- 'principal' => 'principals/user1',
- 'protected' => true,
- ),
-
- array(
- 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-post-vevent',
+ $this->assertEquals([
+ [
+ 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-send',
'principal' => 'principals/user1',
'protected' => true,
- ),
- array(
+ ],
+ [
'privilege' => '{DAV:}read',
'principal' => 'principals/user1',
'protected' => true,
- ),
- array(
- 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-query-freebusy',
+ ],
+ [
+ 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-send',
'principal' => 'principals/user1/calendar-proxy-write',
'protected' => true,
- ),
- array(
- 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-post-vevent',
- 'principal' => 'principals/user1/calendar-proxy-write',
- 'protected' => true,
- ),
- array(
+ ],
+ [
'privilege' => '{DAV:}read',
'principal' => 'principals/user1/calendar-proxy-read',
'protected' => true,
- ),
- array(
+ ],
+ [
'privilege' => '{DAV:}read',
'principal' => 'principals/user1/calendar-proxy-write',
'protected' => true,
- ),
- ), $outbox->getACL());
-
- $ok = false;
- try {
- $outbox->setACL(array());
- } catch (DAV\Exception\MethodNotAllowed $e) {
- $ok = true;
- }
- if (!$ok) {
- $this->fail('Exception was not emitted');
- }
-
- }
-
- function testGetSupportedPrivilegeSet() {
-
- $outbox = new Outbox('principals/user1');
- $r = $outbox->getSupportedPrivilegeSet();
-
- $ok = 0;
- foreach($r['aggregates'] as $priv) {
-
- if ($priv['privilege'] == '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-query-freebusy') {
- $ok++;
- }
- if ($priv['privilege'] == '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-post-vevent') {
- $ok++;
- }
- }
-
- $this->assertEquals(2, $ok, "We're missing one or more privileges");
+ ],
+ ], $outbox->getACL());
}
-
}
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/ShareableCalendarTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/ShareableCalendarTest.php
deleted file mode 100644
index 15b869d50..000000000
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/ShareableCalendarTest.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-
-namespace Sabre\CalDAV;
-
-use Sabre\DAVACL;
-
-class ShareableCalendarTest extends \PHPUnit_Framework_TestCase {
-
- protected $backend;
- protected $instance;
-
- function setUp() {
-
- $props = array(
- 'id' => 1,
- );
-
- $this->backend = new Backend\MockSharing(
- array($props)
- );
- $this->backend->updateShares(1, array(
- array(
- 'href' => 'mailto:removeme@example.org',
- 'commonName' => 'To be removed',
- 'readOnly' => true,
- ),
- ), array());
-
- $this->instance = new ShareableCalendar($this->backend, $props);
-
- }
-
- function testUpdateShares() {
-
- $this->instance->updateShares(array(
- array(
- 'href' => 'mailto:test@example.org',
- 'commonName' => 'Foo Bar',
- 'summary' => 'Booh',
- 'readOnly' => false,
- ),
- ), array('mailto:removeme@example.org'));
-
- $this->assertEquals(array(array(
- 'href' => 'mailto:test@example.org',
- 'commonName' => 'Foo Bar',
- 'summary' => 'Booh',
- 'readOnly' => false,
- 'status' => SharingPlugin::STATUS_NORESPONSE,
- )), $this->instance->getShares());
-
- }
-
- function testPublish() {
-
- $this->assertNull($this->instance->setPublishStatus(true));
- $this->assertNull($this->instance->setPublishStatus(false));
-
- }
-}
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/SharedCalendarTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/SharedCalendarTest.php
index 337b658f4..f71c19523 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/SharedCalendarTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/SharedCalendarTest.php
@@ -2,7 +2,8 @@
namespace Sabre\CalDAV;
-use Sabre\DAVACL;
+use Sabre\DAV\Sharing;
+use Sabre\DAV\Xml\Element\Sharee;
class SharedCalendarTest extends \PHPUnit_Framework_TestCase {
@@ -11,96 +12,95 @@ class SharedCalendarTest extends \PHPUnit_Framework_TestCase {
function getInstance(array $props = null) {
if (is_null($props)) {
- $props = array(
- 'id' => 1,
+ $props = [
+ 'id' => 1,
'{http://calendarserver.org/ns/}shared-url' => 'calendars/owner/original',
- '{http://sabredav.org/ns}owner-principal' => 'principals/owner',
- '{http://sabredav.org/ns}read-only' => false,
- 'principaluri' => 'principals/sharee',
- );
+ '{http://sabredav.org/ns}owner-principal' => 'principals/owner',
+ '{http://sabredav.org/ns}read-only' => false,
+ 'share-access' => Sharing\Plugin::ACCESS_READWRITE,
+ 'principaluri' => 'principals/sharee',
+ ];
}
$this->backend = new Backend\MockSharing(
- array($props),
- array(),
- array()
+ [$props],
+ [],
+ []
);
- $this->backend->updateShares(1, array(
- array(
- 'href' => 'mailto:removeme@example.org',
- 'commonName' => 'To be removed',
- 'readOnly' => true,
- ),
- ), array());
+
+ $sharee = new Sharee();
+ $sharee->href = 'mailto:removeme@example.org';
+ $sharee->properties['{DAV:}displayname'] = 'To be removed';
+ $sharee->access = Sharing\Plugin::ACCESS_READ;
+ $this->backend->updateInvites(1, [$sharee]);
return new SharedCalendar($this->backend, $props);
}
- function testGetSharedUrl() {
- $this->assertEquals('calendars/owner/original', $this->getInstance()->getSharedUrl());
- }
+ function testGetInvites() {
- function testGetShares() {
+ $sharee = new Sharee();
+ $sharee->href = 'mailto:removeme@example.org';
+ $sharee->properties['{DAV:}displayname'] = 'To be removed';
+ $sharee->access = Sharing\Plugin::ACCESS_READ;
+ $sharee->inviteStatus = Sharing\Plugin::INVITE_NORESPONSE;
- $this->assertEquals(array(array(
- 'href' => 'mailto:removeme@example.org',
- 'commonName' => 'To be removed',
- 'readOnly' => true,
- 'status' => SharingPlugin::STATUS_NORESPONSE,
- )), $this->getInstance()->getShares());
+ $this->assertEquals(
+ [$sharee],
+ $this->getInstance()->getInvites()
+ );
}
function testGetOwner() {
- $this->assertEquals('principals/owner', $this->getInstance()->getOwner());
+ $this->assertEquals('principals/sharee', $this->getInstance()->getOwner());
}
function testGetACL() {
- $expected = array(
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => 'principals/owner',
+ $expected = [
+ [
+ 'privilege' => '{DAV:}write',
+ 'principal' => 'principals/sharee',
'protected' => true,
- ),
-
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => 'principals/owner/calendar-proxy-write',
+ ],
+ [
+ 'privilege' => '{DAV:}write',
+ 'principal' => 'principals/sharee/calendar-proxy-write',
'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => 'principals/owner/calendar-proxy-read',
+ ],
+ [
+ 'privilege' => '{DAV:}write-properties',
+ 'principal' => 'principals/sharee',
'protected' => true,
- ),
- array(
- 'privilege' => '{' . Plugin::NS_CALDAV . '}read-free-busy',
- 'principal' => '{DAV:}authenticated',
+ ],
+ [
+ 'privilege' => '{DAV:}write-properties',
+ 'principal' => 'principals/sharee/calendar-proxy-write',
'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}write',
- 'principal' => 'principals/owner',
+ ],
+ [
+ 'privilege' => '{DAV:}read',
+ 'principal' => 'principals/sharee',
'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}write',
- 'principal' => 'principals/owner/calendar-proxy-write',
+ ],
+ [
+ 'privilege' => '{DAV:}read',
+ 'principal' => 'principals/sharee/calendar-proxy-read',
'protected' => true,
- ),
- array(
+ ],
+ [
'privilege' => '{DAV:}read',
- 'principal' => 'principals/sharee',
+ 'principal' => 'principals/sharee/calendar-proxy-write',
'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}write',
- 'principal' => 'principals/sharee',
+ ],
+ [
+ 'privilege' => '{' . Plugin::NS_CALDAV . '}read-free-busy',
+ 'principal' => '{DAV:}authenticated',
'protected' => true,
- ),
- );
+ ],
+ ];
$this->assertEquals($expected, $this->getInstance()->getACL());
@@ -108,96 +108,69 @@ class SharedCalendarTest extends \PHPUnit_Framework_TestCase {
function testGetChildACL() {
- $expected = array(
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => 'principals/owner',
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => 'principals/owner/calendar-proxy-write',
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => 'principals/owner/calendar-proxy-read',
- 'protected' => true,
- ),
- array(
+ $expected = [
+ [
'privilege' => '{DAV:}write',
- 'principal' => 'principals/owner',
+ 'principal' => 'principals/sharee',
'protected' => true,
- ),
- array(
+ ],
+ [
'privilege' => '{DAV:}write',
- 'principal' => 'principals/owner/calendar-proxy-write',
+ 'principal' => 'principals/sharee/calendar-proxy-write',
'protected' => true,
- ),
- array(
+ ],
+ [
'privilege' => '{DAV:}read',
'principal' => 'principals/sharee',
'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}write',
- 'principal' => 'principals/sharee',
+ ],
+ [
+ 'privilege' => '{DAV:}read',
+ 'principal' => 'principals/sharee/calendar-proxy-write',
'protected' => true,
- ),
- );
+ ],
+ [
+ 'privilege' => '{DAV:}read',
+ 'principal' => 'principals/sharee/calendar-proxy-read',
+ 'protected' => true,
+ ],
+
+ ];
$this->assertEquals($expected, $this->getInstance()->getChildACL());
}
- function testGetChildACLReadOnly() {
+ function testUpdateInvites() {
- $expected = array(
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => 'principals/owner',
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => 'principals/owner/calendar-proxy-write',
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => 'principals/owner/calendar-proxy-read',
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => 'principals/sharee',
- 'protected' => true,
- ),
- );
+ $instance = $this->getInstance();
+ $newSharees = [
+ new Sharee(),
+ new Sharee()
+ ];
+ $newSharees[0]->href = 'mailto:test@example.org';
+ $newSharees[0]->properties['{DAV:}displayname'] = 'Foo Bar';
+ $newSharees[0]->comment = 'Booh';
+ $newSharees[0]->access = Sharing\Plugin::ACCESS_READWRITE;
- $props = array(
- 'id' => 1,
- '{http://calendarserver.org/ns/}shared-url' => 'calendars/owner/original',
- '{http://sabredav.org/ns}owner-principal' => 'principals/owner',
- '{http://sabredav.org/ns}read-only' => true,
- 'principaluri' => 'principals/sharee',
- );
- $this->assertEquals($expected, $this->getInstance($props)->getChildACL());
+ $newSharees[1]->href = 'mailto:removeme@example.org';
+ $newSharees[1]->access = Sharing\Plugin::ACCESS_NOACCESS;
+
+ $instance->updateInvites($newSharees);
+
+ $expected = [
+ clone $newSharees[0]
+ ];
+ $expected[0]->inviteStatus = Sharing\Plugin::INVITE_NORESPONSE;
+ $this->assertEquals($expected, $instance->getInvites());
}
- /**
- * @expectedException InvalidArgumentException
- */
- public function testCreateInstanceMissingArg() {
+ function testPublish() {
- $this->getInstance(array(
- 'id' => 1,
- '{http://calendarserver.org/ns/}shared-url' => 'calendars/owner/original',
- '{http://sabredav.org/ns}read-only' => false,
- 'principaluri' => 'principals/sharee',
- ));
+ $instance = $this->getInstance();
+ $this->assertNull($instance->setPublishStatus(true));
+ $this->assertNull($instance->setPublishStatus(false));
}
-
}
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/SharingPluginTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/SharingPluginTest.php
index b4270da7d..6e9e88419 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/SharingPluginTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/SharingPluginTest.php
@@ -3,6 +3,7 @@
namespace Sabre\CalDAV;
use Sabre\DAV;
+use Sabre\DAV\Xml\Element\Sharee;
use Sabre\HTTP;
class SharingPluginTest extends \Sabre\DAVServerTest {
@@ -14,31 +15,28 @@ class SharingPluginTest extends \Sabre\DAVServerTest {
function setUp() {
- $this->caldavCalendars = array(
- array(
+ $this->caldavCalendars = [
+ [
'principaluri' => 'principals/user1',
- 'id' => 1,
- 'uri' => 'cal1',
- ),
- array(
+ 'id' => 1,
+ 'uri' => 'cal1',
+ ],
+ [
'principaluri' => 'principals/user1',
- 'id' => 2,
- 'uri' => 'cal2',
- '{' . Plugin::NS_CALENDARSERVER . '}shared-url' => 'calendars/user1/cal2',
- '{http://sabredav.org/ns}owner-principal' => 'principals/user2',
- '{http://sabredav.org/ns}read-only' => 'true',
- ),
- array(
+ 'id' => 2,
+ 'uri' => 'cal2',
+ 'share-access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE,
+ ],
+ [
'principaluri' => 'principals/user1',
- 'id' => 3,
- 'uri' => 'cal3',
- ),
- );
+ 'id' => 3,
+ 'uri' => 'cal3',
+ ],
+ ];
parent::setUp();
// Making the logged in user an admin, for full access:
- $this->aclPlugin->adminPrincipals[] = 'principals/user1';
$this->aclPlugin->adminPrincipals[] = 'principals/user2';
}
@@ -53,9 +51,21 @@ class SharingPluginTest extends \Sabre\DAVServerTest {
}
+ /**
+ * @expectedException \LogicException
+ */
+ function testSetupWithoutCoreSharingPlugin() {
+
+ $server = new DAV\Server();
+ $server->addPlugin(
+ new SharingPlugin()
+ );
+
+ }
+
function testGetFeatures() {
- $this->assertEquals(array('calendarserver-sharing'), $this->caldavSharingPlugin->getFeatures());
+ $this->assertEquals(['calendarserver-sharing'], $this->caldavSharingPlugin->getFeatures());
}
@@ -63,10 +73,10 @@ class SharingPluginTest extends \Sabre\DAVServerTest {
// Forcing the server to authenticate:
$this->authPlugin->beforeMethod(new HTTP\Request(), new HTTP\Response());
- $props = $this->server->getProperties('calendars/user1/cal1', array(
+ $props = $this->server->getProperties('calendars/user1/cal1', [
'{' . Plugin::NS_CALENDARSERVER . '}invite',
'{' . Plugin::NS_CALENDARSERVER . '}allowed-sharing-modes',
- ));
+ ]);
$this->assertInstanceOf('Sabre\\CalDAV\\Xml\\Property\\Invite', $props['{' . Plugin::NS_CALENDARSERVER . '}invite']);
$this->assertInstanceOf('Sabre\\CalDAV\\Xml\\Property\\AllowedSharingModes', $props['{' . Plugin::NS_CALENDARSERVER . '}allowed-sharing-modes']);
@@ -75,56 +85,55 @@ class SharingPluginTest extends \Sabre\DAVServerTest {
function testBeforeGetSharedCalendar() {
- $props = $this->server->getProperties('calendars/user1/cal2', array(
+ $props = $this->server->getProperties('calendars/user1/cal2', [
'{' . Plugin::NS_CALENDARSERVER . '}shared-url',
'{' . Plugin::NS_CALENDARSERVER . '}invite',
- ));
+ ]);
$this->assertInstanceOf('Sabre\\CalDAV\\Xml\\Property\\Invite', $props['{' . Plugin::NS_CALENDARSERVER . '}invite']);
- $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $props['{' . Plugin::NS_CALENDARSERVER . '}shared-url']);
+ //$this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $props['{' . Plugin::NS_CALENDARSERVER . '}shared-url']);
}
- function testUpdateProperties() {
+ function testUpdateResourceType() {
- $this->caldavBackend->updateShares(1,
- array(
- array(
+ $this->caldavBackend->updateInvites(1,
+ [
+ new Sharee([
'href' => 'mailto:joe@example.org',
- ),
- ),
- array()
+ ])
+ ]
);
- $result = $this->server->updateProperties('calendars/user1/cal1', array(
+ $result = $this->server->updateProperties('calendars/user1/cal1', [
'{DAV:}resourcetype' => new DAV\Xml\Property\ResourceType(['{DAV:}collection'])
- ));
+ ]);
$this->assertEquals([
'{DAV:}resourcetype' => 200
], $result);
- $this->assertEquals(0, count($this->caldavBackend->getShares(1)));
+ $this->assertEquals(0, count($this->caldavBackend->getInvites(1)));
}
function testUpdatePropertiesPassThru() {
- $result = $this->server->updateProperties('calendars/user1/cal3', array(
+ $result = $this->server->updateProperties('calendars/user1/cal3', [
'{DAV:}foo' => 'bar',
- ));
+ ]);
- $this->assertEquals(array(
- '{DAV:}foo' => 403,
- ), $result);
+ $this->assertEquals([
+ '{DAV:}foo' => 200,
+ ], $result);
}
function testUnknownMethodNoPOST() {
- $request = HTTP\Sapi::createFromServerArray(array(
+ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'PATCH',
'REQUEST_URI' => '/',
- ));
+ ]);
$response = $this->request($request);
@@ -134,11 +143,11 @@ class SharingPluginTest extends \Sabre\DAVServerTest {
function testUnknownMethodNoXML() {
- $request = HTTP\Sapi::createFromServerArray(array(
+ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'POST',
'REQUEST_URI' => '/',
'CONTENT_TYPE' => 'text/plain',
- ));
+ ]);
$response = $this->request($request);
@@ -148,11 +157,11 @@ class SharingPluginTest extends \Sabre\DAVServerTest {
function testUnknownMethodNoNode() {
- $request = HTTP\Sapi::createFromServerArray(array(
+ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'POST',
'REQUEST_URI' => '/foo',
'CONTENT_TYPE' => 'text/xml',
- ));
+ ]);
$response = $this->request($request);
@@ -162,11 +171,7 @@ class SharingPluginTest extends \Sabre\DAVServerTest {
function testShareRequest() {
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'POST',
- 'REQUEST_URI' => '/calendars/user1/cal1',
- 'CONTENT_TYPE' => 'text/xml',
- ));
+ $request = new HTTP\Request('POST', '/calendars/user1/cal1', ['Content-Type' => 'text/xml']);
$xml = <<<RRR
<?xml version="1.0"?>
@@ -184,19 +189,28 @@ RRR;
$request->setBody($xml);
- $response = $this->request($request);
- $this->assertEquals(200, $response->status, $response->body);
+ $response = $this->request($request, 200);
+
+ $this->assertEquals(
+ [
+ new Sharee([
+ 'href' => 'mailto:joe@example.org',
+ 'properties' => [
+ '{DAV:}displayname' => 'Joe Shmoe',
+ ],
+ 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE,
+ 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_NORESPONSE,
+ 'comment' => '',
+ ]),
+ ],
+ $this->caldavBackend->getInvites(1)
+ );
- $this->assertEquals(array(array(
- 'href' => 'mailto:joe@example.org',
- 'commonName' => 'Joe Shmoe',
- 'readOnly' => false,
- 'status' => SharingPlugin::STATUS_NORESPONSE,
- 'summary' => '',
- )), $this->caldavBackend->getShares(1));
+ // Wiping out tree cache
+ $this->server->tree->markDirty('');
// Verifying that the calendar is now marked shared.
- $props = $this->server->getProperties('calendars/user1/cal1', array('{DAV:}resourcetype'));
+ $props = $this->server->getProperties('calendars/user1/cal1', ['{DAV:}resourcetype']);
$this->assertTrue(
$props['{DAV:}resourcetype']->is('{http://calendarserver.org/ns/}shared-owner')
);
@@ -205,11 +219,11 @@ RRR;
function testShareRequestNoShareableCalendar() {
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'POST',
- 'REQUEST_URI' => '/calendars/user1/cal2',
- 'CONTENT_TYPE' => 'text/xml',
- ));
+ $request = new HTTP\Request(
+ 'POST',
+ '/calendars/user1/cal2',
+ ['Content-Type' => 'text/xml']
+ );
$xml = '<?xml version="1.0"?>
<cs:share xmlns:cs="' . Plugin::NS_CALENDARSERVER . '" xmlns:d="DAV:">
@@ -226,18 +240,17 @@ RRR;
$request->setBody($xml);
- $response = $this->request($request);
- $this->assertEquals(501, $response->status, $response->body);
+ $response = $this->request($request, 403);
}
function testInviteReply() {
- $request = HTTP\Sapi::createFromServerArray(array(
+ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'POST',
'REQUEST_URI' => '/calendars/user1',
'CONTENT_TYPE' => 'text/xml',
- ));
+ ]);
$xml = '<?xml version="1.0"?>
<cs:invite-reply xmlns:cs="' . Plugin::NS_CALENDARSERVER . '" xmlns:d="DAV:">
@@ -254,11 +267,11 @@ RRR;
function testInviteBadXML() {
- $request = HTTP\Sapi::createFromServerArray(array(
+ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'POST',
'REQUEST_URI' => '/calendars/user1',
'CONTENT_TYPE' => 'text/xml',
- ));
+ ]);
$xml = '<?xml version="1.0"?>
<cs:invite-reply xmlns:cs="' . Plugin::NS_CALENDARSERVER . '" xmlns:d="DAV:">
@@ -272,11 +285,11 @@ RRR;
function testInviteWrongUrl() {
- $request = HTTP\Sapi::createFromServerArray(array(
+ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'POST',
'REQUEST_URI' => '/calendars/user1/cal1',
'CONTENT_TYPE' => 'text/xml',
- ));
+ ]);
$xml = '<?xml version="1.0"?>
<cs:invite-reply xmlns:cs="' . Plugin::NS_CALENDARSERVER . '" xmlns:d="DAV:">
@@ -295,11 +308,7 @@ RRR;
function testPublish() {
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'POST',
- 'REQUEST_URI' => '/calendars/user1/cal1',
- 'CONTENT_TYPE' => 'text/xml',
- ));
+ $request = new HTTP\Request('POST', '/calendars/user1/cal1', ['Content-Type' => 'text/xml']);
$xml = '<?xml version="1.0"?>
<cs:publish-calendar xmlns:cs="' . Plugin::NS_CALENDARSERVER . '" xmlns:d="DAV:" />
@@ -312,13 +321,14 @@ RRR;
}
+
function testUnpublish() {
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'POST',
- 'REQUEST_URI' => '/calendars/user1/cal1',
- 'CONTENT_TYPE' => 'text/xml',
- ));
+ $request = new HTTP\Request(
+ 'POST',
+ '/calendars/user1/cal1',
+ ['Content-Type' => 'text/xml']
+ );
$xml = '<?xml version="1.0"?>
<cs:unpublish-calendar xmlns:cs="' . Plugin::NS_CALENDARSERVER . '" xmlns:d="DAV:" />
@@ -333,49 +343,46 @@ RRR;
function testPublishWrongUrl() {
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'POST',
- 'REQUEST_URI' => '/calendars/user1/cal2',
- 'CONTENT_TYPE' => 'text/xml',
- ));
+ $request = new HTTP\Request(
+ 'POST',
+ '/calendars/user1',
+ ['Content-Type' => 'text/xml']
+ );
$xml = '<?xml version="1.0"?>
<cs:publish-calendar xmlns:cs="' . Plugin::NS_CALENDARSERVER . '" xmlns:d="DAV:" />
';
$request->setBody($xml);
-
- $response = $this->request($request);
- $this->assertEquals(501, $response->status, $response->body);
+ $this->request($request, 501);
}
function testUnpublishWrongUrl() {
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'POST',
- 'REQUEST_URI' => '/calendars/user1/cal2',
- 'CONTENT_TYPE' => 'text/xml',
- ));
-
+ $request = new HTTP\Request(
+ 'POST',
+ '/calendars/user1',
+ ['Content-Type' => 'text/xml']
+ );
$xml = '<?xml version="1.0"?>
<cs:unpublish-calendar xmlns:cs="' . Plugin::NS_CALENDARSERVER . '" xmlns:d="DAV:" />
';
$request->setBody($xml);
- $response = $this->request($request);
- $this->assertEquals(501, $response->status, $response->body);
+ $this->request($request, 501);
}
function testUnknownXmlDoc() {
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'POST',
- 'REQUEST_URI' => '/calendars/user1/cal2',
- 'CONTENT_TYPE' => 'text/xml',
- ));
+
+ $request = new HTTP\Request(
+ 'POST',
+ '/calendars/user1/cal2',
+ ['Content-Type' => 'text/xml']
+ );
$xml = '<?xml version="1.0"?>
<cs:foo-bar xmlns:cs="' . Plugin::NS_CALENDARSERVER . '" xmlns:d="DAV:" />';
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/TestUtil.php b/vendor/sabre/dav/tests/Sabre/CalDAV/TestUtil.php
index 19acea200..673d39c0a 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/TestUtil.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/TestUtil.php
@@ -6,48 +6,29 @@ class TestUtil {
static function getBackend() {
- $backend = new Backend\PDO(self::getSQLiteDB());
- return $backend;
-
- }
-
- static function getSQLiteDB() {
-
- if (file_exists(SABRE_TEMPDIR . '/testdb.sqlite'))
- unlink(SABRE_TEMPDIR . '/testdb.sqlite');
-
- $pdo = new \PDO('sqlite:' . SABRE_TEMPDIR . '/testdb.sqlite');
- $pdo->setAttribute(\PDO::ATTR_ERRMODE,\PDO::ERRMODE_EXCEPTION);
-
- // Yup this is definitely not 'fool proof', but good enough for now.
- $queries = explode(';', file_get_contents(__DIR__ . '/../../../examples/sql/sqlite.calendars.sql'));
- foreach($queries as $query) {
- $pdo->exec($query);
- }
- // Inserting events through a backend class.
- $backend = new Backend\PDO($pdo);
+ $backend = new Backend\Mock();
$calendarId = $backend->createCalendar(
'principals/user1',
'UUID-123467',
- array(
- '{DAV:}displayname' => 'user1 calendar',
+ [
+ '{DAV:}displayname' => 'user1 calendar',
'{urn:ietf:params:xml:ns:caldav}calendar-description' => 'Calendar description',
- '{http://apple.com/ns/ical/}calendar-order' => '1',
- '{http://apple.com/ns/ical/}calendar-color' => '#FF0000',
- )
+ '{http://apple.com/ns/ical/}calendar-order' => '1',
+ '{http://apple.com/ns/ical/}calendar-color' => '#FF0000',
+ ]
);
$backend->createCalendar(
'principals/user1',
'UUID-123468',
- array(
- '{DAV:}displayname' => 'user1 calendar2',
+ [
+ '{DAV:}displayname' => 'user1 calendar2',
'{urn:ietf:params:xml:ns:caldav}calendar-description' => 'Calendar description',
- '{http://apple.com/ns/ical/}calendar-order' => '1',
- '{http://apple.com/ns/ical/}calendar-color' => '#FF0000',
- )
+ '{http://apple.com/ns/ical/}calendar-order' => '1',
+ '{http://apple.com/ns/ical/}calendar-color' => '#FF0000',
+ ]
);
$backend->createCalendarObject($calendarId, 'UUID-2345', self::getTestCalendarData());
- return $pdo;
+ return $backend;
}
@@ -80,37 +61,37 @@ TRANSP:TRANSPARENT
SUMMARY:Something here
DTSTAMP:20100228T130202Z';
- switch($type) {
+ switch ($type) {
case 1 :
- $calendarData.="\nDTSTART;TZID=Asia/Seoul:20100223T060000\nDTEND;TZID=Asia/Seoul:20100223T070000\n";
+ $calendarData .= "\nDTSTART;TZID=Asia/Seoul:20100223T060000\nDTEND;TZID=Asia/Seoul:20100223T070000\n";
break;
case 2 :
- $calendarData.="\nDTSTART:20100223T060000\nDTEND:20100223T070000\n";
+ $calendarData .= "\nDTSTART:20100223T060000\nDTEND:20100223T070000\n";
break;
case 3 :
- $calendarData.="\nDTSTART;VALUE=DATE:20100223\nDTEND;VALUE=DATE:20100223\n";
+ $calendarData .= "\nDTSTART;VALUE=DATE:20100223\nDTEND;VALUE=DATE:20100223\n";
break;
case 4 :
- $calendarData.="\nDTSTART;TZID=Asia/Seoul:20100223T060000\nDURATION:PT1H\n";
+ $calendarData .= "\nDTSTART;TZID=Asia/Seoul:20100223T060000\nDURATION:PT1H\n";
break;
case 5 :
- $calendarData.="\nDTSTART;TZID=Asia/Seoul:20100223T060000\nDURATION:-P5D\n";
+ $calendarData .= "\nDTSTART;TZID=Asia/Seoul:20100223T060000\nDURATION:-P5D\n";
break;
case 6 :
- $calendarData.="\nDTSTART;VALUE=DATE:20100223\n";
+ $calendarData .= "\nDTSTART;VALUE=DATE:20100223\n";
break;
case 7 :
- $calendarData.="\nDTSTART;VALUE=DATETIME:20100223T060000\n";
+ $calendarData .= "\nDTSTART;VALUE=DATETIME:20100223T060000\n";
break;
// No DTSTART, so intentionally broken
case 'X' :
- $calendarData.="\n";
+ $calendarData .= "\n";
break;
}
- $calendarData.='ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:lisa@example.com
+ $calendarData .= 'ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:lisa@example.com
SEQUENCE:2
END:VEVENT
END:VCALENDAR';
@@ -121,7 +102,7 @@ END:VCALENDAR';
static function getTestTODO($type = 'due') {
- switch($type) {
+ switch ($type) {
case 'due' :
$extra = "DUE:20100104T000000Z";
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/ValidateICalTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/ValidateICalTest.php
index be166d9e6..629df90c1 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/ValidateICalTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/ValidateICalTest.php
@@ -21,20 +21,20 @@ class ValidateICalTest extends \PHPUnit_Framework_TestCase {
function setUp() {
- $calendars = array(
- array(
- 'id' => 'calendar1',
- 'principaluri' => 'principals/admin',
- 'uri' => 'calendar1',
- '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new Xml\Property\SupportedCalendarComponentSet( ['VEVENT','VTODO','VJOURNAL'] ),
- ),
- array(
- 'id' => 'calendar2',
- 'principaluri' => 'principals/admin',
- 'uri' => 'calendar2',
- '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new Xml\Property\SupportedCalendarComponentSet( ['VTODO','VJOURNAL'] ),
- )
- );
+ $calendars = [
+ [
+ 'id' => 'calendar1',
+ 'principaluri' => 'principals/admin',
+ 'uri' => 'calendar1',
+ '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new Xml\Property\SupportedCalendarComponentSet(['VEVENT', 'VTODO', 'VJOURNAL']),
+ ],
+ [
+ 'id' => 'calendar2',
+ 'principaluri' => 'principals/admin',
+ 'uri' => 'calendar2',
+ '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new Xml\Property\SupportedCalendarComponentSet(['VTODO', 'VJOURNAL']),
+ ]
+ ];
$this->calBackend = new Backend\Mock($calendars, []);
$principalBackend = new DAVACL\PrincipalBackend\Mock();
@@ -66,10 +66,10 @@ class ValidateICalTest extends \PHPUnit_Framework_TestCase {
function testCreateFile() {
- $request = HTTP\Sapi::createFromServerArray(array(
+ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'PUT',
- 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
- ));
+ 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
+ ]);
$response = $this->request($request);
@@ -79,66 +79,168 @@ class ValidateICalTest extends \PHPUnit_Framework_TestCase {
function testCreateFileValid() {
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'PUT',
- 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
- ));
- $request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
+ $request = new HTTP\Request(
+ 'PUT',
+ '/calendars/admin/calendar1/blabla.ics',
+ ['Prefer' => 'handling=strict']
+ );
+
+ $ics = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:foo
+BEGIN:VEVENT
+UID:foo
+DTSTAMP:20160406T052348Z
+DTSTART:20160706T140000Z
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+ $request->setBody($ics);
$response = $this->request($request);
$this->assertEquals(201, $response->status, 'Incorrect status returned! Full response body: ' . $response->body);
- $this->assertEquals(array(
+ $this->assertEquals([
'X-Sabre-Version' => [DAV\Version::VERSION],
- 'Content-Length' => ['0'],
- 'ETag' => ['"' . md5("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n") . '"'],
- ), $response->getHeaders());
+ 'Content-Length' => ['0'],
+ 'ETag' => ['"' . md5($ics) . '"'],
+ ], $response->getHeaders());
- $expected = array(
+ $expected = [
'uri' => 'blabla.ics',
- 'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n",
+ 'calendardata' => $ics,
'calendarid' => 'calendar1',
'lastmodified' => null,
+ ];
+
+ $this->assertEquals($expected, $this->calBackend->getCalendarObject('calendar1', 'blabla.ics'));
+
+ }
+
+ function testCreateFileNoVersion() {
+
+ $request = new HTTP\Request(
+ 'PUT',
+ '/calendars/admin/calendar1/blabla.ics',
+ ['Prefer' => 'handling=strict']
);
- $this->assertEquals($expected, $this->calBackend->getCalendarObject('calendar1','blabla.ics'));
+ $ics = <<<ICS
+BEGIN:VCALENDAR
+PRODID:foo
+BEGIN:VEVENT
+UID:foo
+DTSTAMP:20160406T052348Z
+DTSTART:20160706T140000Z
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+ $request->setBody($ics);
+
+ $response = $this->request($request);
+
+ $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: ' . $response->body);
}
- function testCreateFileNoComponents() {
+ function testCreateFileNoVersionFixed() {
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'PUT',
- 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
- ));
- $request->setBody("BEGIN:VCALENDAR\r\nEND:VCALENDAR\r\n");
+ $request = new HTTP\Request(
+ 'PUT',
+ '/calendars/admin/calendar1/blabla.ics',
+ ['Prefer' => 'handling=lenient']
+ );
+
+ $ics = <<<ICS
+BEGIN:VCALENDAR
+PRODID:foo
+BEGIN:VEVENT
+UID:foo
+DTSTAMP:20160406T052348Z
+DTSTART:20160706T140000Z
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+ $request->setBody($ics);
$response = $this->request($request);
- $this->assertEquals(400, $response->status, 'Incorrect status returned! Full response body: ' . $response->body);
+ $this->assertEquals(201, $response->status, 'Incorrect status returned! Full response body: ' . $response->body);
+ $this->assertEquals([
+ 'X-Sabre-Version' => [DAV\Version::VERSION],
+ 'Content-Length' => ['0'],
+ 'X-Sabre-Ew-Gross' => ['iCalendar validation warning: VERSION MUST appear exactly once in a VCALENDAR component'],
+ ], $response->getHeaders());
+
+ $ics = <<<ICS
+BEGIN:VCALENDAR\r
+VERSION:2.0\r
+PRODID:foo\r
+BEGIN:VEVENT\r
+UID:foo\r
+DTSTAMP:20160406T052348Z\r
+DTSTART:20160706T140000Z\r
+END:VEVENT\r
+END:VCALENDAR\r
+
+ICS;
+
+ $expected = [
+ 'uri' => 'blabla.ics',
+ 'calendardata' => $ics,
+ 'calendarid' => 'calendar1',
+ 'lastmodified' => null,
+ ];
+
+ $this->assertEquals($expected, $this->calBackend->getCalendarObject('calendar1', 'blabla.ics'));
+
+ }
+
+ function testCreateFileNoComponents() {
+
+ $request = new HTTP\Request(
+ 'PUT',
+ '/calendars/admin/calendar1/blabla.ics',
+ ['Prefer' => 'handling=strict']
+ );
+ $ics = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:foo
+END:VCALENDAR
+ICS;
+
+ $request->setBody($ics);
+
+ $response = $this->request($request);
+ $this->assertEquals(403, $response->status, 'Incorrect status returned! Full response body: ' . $response->body);
}
function testCreateFileNoUID() {
- $request = HTTP\Sapi::createFromServerArray(array(
+ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'PUT',
- 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
- ));
+ 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
+ ]);
$request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
$response = $this->request($request);
- $this->assertEquals(400, $response->status, 'Incorrect status returned! Full response body: ' . $response->body);
+ $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: ' . $response->body);
}
function testCreateFileVCard() {
- $request = HTTP\Sapi::createFromServerArray(array(
+ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'PUT',
- 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
- ));
+ 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
+ ]);
$request->setBody("BEGIN:VCARD\r\nEND:VCARD\r\n");
$response = $this->request($request);
@@ -149,53 +251,53 @@ class ValidateICalTest extends \PHPUnit_Framework_TestCase {
function testCreateFile2Components() {
- $request = HTTP\Sapi::createFromServerArray(array(
+ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'PUT',
- 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
- ));
+ 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
+ ]);
$request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nBEGIN:VJOURNAL\r\nUID:foo\r\nEND:VJOURNAL\r\nEND:VCALENDAR\r\n");
$response = $this->request($request);
- $this->assertEquals(400, $response->status, 'Incorrect status returned! Full response body: ' . $response->body);
+ $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: ' . $response->body);
}
function testCreateFile2UIDS() {
- $request = HTTP\Sapi::createFromServerArray(array(
+ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'PUT',
- 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
- ));
+ 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
+ ]);
$request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nBEGIN:VEVENT\r\nUID:bar\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
$response = $this->request($request);
- $this->assertEquals(400, $response->status, 'Incorrect status returned! Full response body: ' . $response->body);
+ $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: ' . $response->body);
}
function testCreateFileWrongComponent() {
- $request = HTTP\Sapi::createFromServerArray(array(
+ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'PUT',
- 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
- ));
+ 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
+ ]);
$request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r\nBEGIN:VFREEBUSY\r\nUID:foo\r\nEND:VFREEBUSY\r\nEND:VCALENDAR\r\n");
$response = $this->request($request);
- $this->assertEquals(400, $response->status, 'Incorrect status returned! Full response body: ' . $response->body);
+ $this->assertEquals(403, $response->status, 'Incorrect status returned! Full response body: ' . $response->body);
}
function testUpdateFile() {
- $this->calBackend->createCalendarObject('calendar1','blabla.ics','foo');
- $request = HTTP\Sapi::createFromServerArray(array(
+ $this->calBackend->createCalendarObject('calendar1', 'blabla.ics', 'foo');
+ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'PUT',
- 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
- ));
+ 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
+ ]);
$response = $this->request($request);
@@ -205,35 +307,45 @@ class ValidateICalTest extends \PHPUnit_Framework_TestCase {
function testUpdateFileParsableBody() {
- $this->calBackend->createCalendarObject('calendar1','blabla.ics','foo');
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'PUT',
- 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
- ));
- $body = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n";
- $request->setBody($body);
-
+ $this->calBackend->createCalendarObject('calendar1', 'blabla.ics', 'foo');
+ $request = new HTTP\Request(
+ 'PUT',
+ '/calendars/admin/calendar1/blabla.ics'
+ );
+ $ics = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:foo
+BEGIN:VEVENT
+UID:foo
+DTSTAMP:20160406T052348Z
+DTSTART:20160706T140000Z
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+ $request->setBody($ics);
$response = $this->request($request);
$this->assertEquals(204, $response->status);
- $expected = array(
+ $expected = [
'uri' => 'blabla.ics',
- 'calendardata' => $body,
+ 'calendardata' => $ics,
'calendarid' => 'calendar1',
'lastmodified' => null,
- );
+ ];
- $this->assertEquals($expected, $this->calBackend->getCalendarObject('calendar1','blabla.ics'));
+ $this->assertEquals($expected, $this->calBackend->getCalendarObject('calendar1', 'blabla.ics'));
}
function testCreateFileInvalidComponent() {
- $request = HTTP\Sapi::createFromServerArray(array(
+ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'PUT',
- 'REQUEST_URI' => '/calendars/admin/calendar2/blabla.ics',
- ));
+ 'REQUEST_URI' => '/calendars/admin/calendar2/blabla.ics',
+ ]);
$request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
$response = $this->request($request);
@@ -244,11 +356,11 @@ class ValidateICalTest extends \PHPUnit_Framework_TestCase {
function testUpdateFileInvalidComponent() {
- $this->calBackend->createCalendarObject('calendar2','blabla.ics','foo');
- $request = HTTP\Sapi::createFromServerArray(array(
+ $this->calBackend->createCalendarObject('calendar2', 'blabla.ics', 'foo');
+ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'PUT',
- 'REQUEST_URI' => '/calendars/admin/calendar2/blabla.ics',
- ));
+ 'REQUEST_URI' => '/calendars/admin/calendar2/blabla.ics',
+ ]);
$request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
$response = $this->request($request);
@@ -266,11 +378,24 @@ class ValidateICalTest extends \PHPUnit_Framework_TestCase {
*/
function testCreateFileModified() {
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'PUT',
- 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics',
- ));
- $request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:foo\r\nSUMMARY:Meeting in M\xfcnster\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
+ $request = new HTTP\Request(
+ 'PUT',
+ '/calendars/admin/calendar1/blabla.ics'
+ );
+ $ics = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:foo
+BEGIN:VEVENT
+UID:foo
+SUMMARY:Meeting in M\xfcnster
+DTSTAMP:20160406T052348Z
+DTSTART:20160706T140000Z
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+ $request->setBody($ics);
$response = $this->request($request);