aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php')
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php97
1 files changed, 32 insertions, 65 deletions
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));
-
- }
}