diff options
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/CalDAV')
34 files changed, 1655 insertions, 1865 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php index 406dbe0e8..80de750dc 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV\Backend; use Sabre\CalDAV; @@ -7,14 +9,14 @@ use Sabre\DAV; use Sabre\DAV\PropPatch; use Sabre\DAV\Xml\Element\Sharee; -abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { - +abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase +{ use DAV\DbTestHelperTrait; protected $pdo; - function setUp() { - + public function setUp() + { $this->dropTables([ 'calendarobjects', 'calendars', @@ -26,72 +28,66 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $this->createSchema('calendars'); $this->pdo = $this->getDb(); - } - function testConstruct() { - + public function testConstruct() + { $backend = new PDO($this->pdo); $this->assertTrue($backend instanceof PDO); - } /** * @depends testConstruct */ - function testGetCalendarsForUserNoCalendars() { - + public function testGetCalendarsForUserNoCalendars() + { $backend = new PDO($this->pdo); $calendars = $backend->getCalendarsForUser('principals/user2'); $this->assertEquals([], $calendars); - } /** * @depends testConstruct */ - function testCreateCalendarAndFetch() { - + public function testCreateCalendarAndFetch() + { $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!', - '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp('transparent'), + '{DAV:}displayname' => 'Hello!', + '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp('transparent'), ]); $calendars = $backend->getCalendarsForUser('principals/user2'); $elementCheck = [ - 'uri' => 'somerandomid', - '{DAV:}displayname' => 'Hello!', - '{urn:ietf:params:xml:ns:caldav}calendar-description' => '', + '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, + 'share-access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, ]; $this->assertInternalType('array', $calendars); $this->assertEquals(1, count($calendars)); foreach ($elementCheck as $name => $value) { - $this->assertArrayHasKey($name, $calendars[0]); $this->assertEquals($value, $calendars[0][$name]); - } - } /** * @depends testConstruct */ - function testUpdateCalendarAndFetch() { - + public function testUpdateCalendarAndFetch() + { $backend = new PDO($this->pdo); //Creating a new calendar $newId = $backend->createCalendar('principals/user2', 'somerandomid', []); $propPatch = new PropPatch([ - '{DAV:}displayname' => 'myCalendar', + '{DAV:}displayname' => 'myCalendar', '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp('transparent'), ]); @@ -107,12 +103,12 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { // Checking if all the information is still correct $elementCheck = [ - 'id' => $newId, - 'uri' => 'somerandomid', - '{DAV:}displayname' => 'myCalendar', - '{urn:ietf:params:xml:ns:caldav}calendar-description' => '', - '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => '', - '{http://calendarserver.org/ns/}getctag' => 'http://sabre.io/ns/sync/2', + 'id' => $newId, + 'uri' => 'somerandomid', + '{DAV:}displayname' => 'myCalendar', + '{urn:ietf:params:xml:ns:caldav}calendar-description' => '', + '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => '', + '{http://calendarserver.org/ns/}getctag' => 'http://sabre.io/ns/sync/2', '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp('transparent'), ]; @@ -120,40 +116,36 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $this->assertEquals(1, count($calendars)); foreach ($elementCheck as $name => $value) { - $this->assertArrayHasKey($name, $calendars[0]); $this->assertEquals($value, $calendars[0][$name]); - } - } /** * @depends testConstruct * @expectedException \InvalidArgumentException */ - function testUpdateCalendarBadId() { - + public function testUpdateCalendarBadId() + { $backend = new PDO($this->pdo); //Creating a new calendar $newId = $backend->createCalendar('principals/user2', 'somerandomid', []); $propPatch = new PropPatch([ - '{DAV:}displayname' => 'myCalendar', + '{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() { - + public function testUpdateCalendarUnknownProperty() + { $backend = new PDO($this->pdo); //Creating a new calendar @@ -161,7 +153,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $propPatch = new PropPatch([ '{DAV:}displayname' => 'myCalendar', - '{DAV:}yourmom' => 'wittycomment', + '{DAV:}yourmom' => 'wittycomment', ]); // Updating the calendar @@ -170,63 +162,59 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { // Verifying the result of the update $this->assertEquals([ - '{DAV:}yourmom' => 403, + '{DAV:}yourmom' => 403, '{DAV:}displayname' => 424, ], $propPatch->getResult()); - } /** * @depends testCreateCalendarAndFetch */ - function testDeleteCalendar() { - + public function testDeleteCalendar() + { $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!', + '{DAV:}displayname' => 'Hello!', ]); $backend->deleteCalendar($returnedId); $calendars = $backend->getCalendarsForUser('principals/user2'); $this->assertEquals([], $calendars); - } /** * @depends testCreateCalendarAndFetch * @expectedException \InvalidArgumentException */ - function testDeleteCalendarBadID() { - + public 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!', + '{DAV:}displayname' => 'Hello!', ]); $backend->deleteCalendar('bad-id'); - } /** * @depends testCreateCalendarAndFetch * @expectedException \Sabre\DAV\Exception */ - function testCreateCalendarIncorrectComponentSet() {; - + public function testCreateCalendarIncorrectComponentSet() + { $backend = new PDO($this->pdo); //Creating a new calendar $newId = $backend->createCalendar('principals/user2', 'somerandomid', [ '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => 'blabla', ]); - } - function testCreateCalendarObject() { - + public function testCreateCalendarObject() + { $backend = new PDO($this->pdo); $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); @@ -242,17 +230,17 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { } $this->assertEquals([ - 'etag' => md5($object), - 'size' => strlen($object), - 'calendardata' => $object, + 'etag' => md5($object), + 'size' => strlen($object), + 'calendardata' => $object, 'firstoccurence' => strtotime('20120101'), - 'lastoccurence' => strtotime('20120101') + (3600 * 24), - 'componenttype' => 'VEVENT', + 'lastoccurence' => strtotime('20120101') + (3600 * 24), + 'componenttype' => 'VEVENT', ], $row); - } - function testGetMultipleObjects() { + public function testGetMultipleObjects() + { $backend = new PDO($this->pdo); $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); @@ -263,18 +251,18 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $check = [ [ - 'id' => 1, - 'etag' => '"' . md5($object) . '"', - 'uri' => 'id-1', - 'size' => strlen($object), + 'id' => 1, + 'etag' => '"'.md5($object).'"', + 'uri' => 'id-1', + 'size' => strlen($object), 'calendardata' => $object, 'lastmodified' => null, ], [ - 'id' => 2, - 'etag' => '"' . md5($object) . '"', - 'uri' => 'id-2', - 'size' => strlen($object), + 'id' => 2, + 'etag' => '"'.md5($object).'"', + 'uri' => 'id-2', + 'size' => strlen($object), 'calendardata' => $object, 'lastmodified' => null, ], @@ -283,62 +271,54 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $result = $backend->getMultipleCalendarObjects($returnedId, ['id-1', 'id-2']); foreach ($check as $index => $props) { - foreach ($props as $key => $expected) { - $actual = $result[$index][$key]; switch ($key) { - case 'lastmodified' : + case 'lastmodified': $this->assertInternalType('int', $actual); break; - case 'calendardata' : + case 'calendardata': if (is_resource($actual)) { $actual = stream_get_contents($actual); } // no break intentional - default : + default: $this->assertEquals($expected, $actual); - } - } - } - } /** * @depends testGetMultipleObjects * @expectedException \InvalidArgumentException */ - function testGetMultipleObjectsBadId() { - + public function testGetMultipleObjectsBadId() + { $backend = new PDO($this->pdo); $backend->getMultipleCalendarObjects('bad-id', ['foo-bar']); - } /** - * @expectedException Sabre\DAV\Exception\BadRequest + * @expectedException \Sabre\DAV\Exception\BadRequest * @depends testCreateCalendarObject */ - function testCreateCalendarObjectNoComponent() { - + public function testCreateCalendarObjectNoComponent() + { $backend = new PDO($this->pdo); $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); $object = "BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r\nEND:VCALENDAR\r\n"; $backend->createCalendarObject($returnedId, 'random-id', $object); - } /** * @depends testCreateCalendarObject */ - function testCreateCalendarObjectDuration() { - + public function testCreateCalendarObjectDuration() + { $backend = new PDO($this->pdo); $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); @@ -354,37 +334,34 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { } $this->assertEquals([ - 'etag' => md5($object), - 'size' => strlen($object), - 'calendardata' => $object, + 'etag' => md5($object), + 'size' => strlen($object), + 'calendardata' => $object, 'firstoccurence' => strtotime('20120101'), - 'lastoccurence' => strtotime('20120101') + (3600 * 48), - 'componenttype' => 'VEVENT', + 'lastoccurence' => strtotime('20120101') + (3600 * 48), + 'componenttype' => 'VEVENT', ], $row); - } /** * @depends testCreateCalendarObject * @expectedException \InvalidArgumentException */ - function testCreateCalendarObjectBadId() { - + public 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 */ - function testCreateCalendarObjectNoDTEND() { - + public function testCreateCalendarObjectNoDTEND() + { $backend = new PDO($this->pdo); $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); @@ -399,21 +376,20 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { } $this->assertEquals([ - 'etag' => md5($object), - 'size' => strlen($object), - 'calendardata' => $object, + 'etag' => md5($object), + 'size' => strlen($object), + 'calendardata' => $object, 'firstoccurence' => strtotime('2012-01-01 10:00:00'), - 'lastoccurence' => strtotime('2012-01-01 10:00:00'), - 'componenttype' => 'VEVENT', + 'lastoccurence' => strtotime('2012-01-01 10:00:00'), + 'componenttype' => 'VEVENT', ], $row); - } /** * @depends testCreateCalendarObject */ - function testCreateCalendarObjectWithDTEND() { - + public function testCreateCalendarObjectWithDTEND() + { $backend = new PDO($this->pdo); $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); @@ -428,21 +404,20 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { } $this->assertEquals([ - 'etag' => md5($object), - 'size' => strlen($object), - 'calendardata' => $object, + 'etag' => md5($object), + 'size' => strlen($object), + 'calendardata' => $object, 'firstoccurence' => strtotime('2012-01-01 10:00:00'), - 'lastoccurence' => strtotime('2012-01-01 11:00:00'), - 'componenttype' => 'VEVENT', + 'lastoccurence' => strtotime('2012-01-01 11:00:00'), + 'componenttype' => 'VEVENT', ], $row); - } /** * @depends testCreateCalendarObject */ - function testCreateCalendarObjectInfiniteRecurrence() { - + public function testCreateCalendarObjectInfiniteRecurrence() + { $backend = new PDO($this->pdo); $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); @@ -457,21 +432,20 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { } $this->assertEquals([ - 'etag' => md5($object), - 'size' => strlen($object), - 'calendardata' => $object, + 'etag' => md5($object), + 'size' => strlen($object), + 'calendardata' => $object, 'firstoccurence' => strtotime('2012-01-01 10:00:00'), - 'lastoccurence' => strtotime(PDO::MAX_DATE), - 'componenttype' => 'VEVENT', + 'lastoccurence' => strtotime(PDO::MAX_DATE), + 'componenttype' => 'VEVENT', ], $row); - } /** * @depends testCreateCalendarObject */ - function testCreateCalendarObjectEndingRecurrence() { - + public function testCreateCalendarObjectEndingRecurrence() + { $backend = new PDO($this->pdo); $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); @@ -486,21 +460,20 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { } $this->assertEquals([ - 'etag' => md5($object), - 'size' => strlen($object), - 'calendardata' => $object, + 'etag' => md5($object), + 'size' => strlen($object), + 'calendardata' => $object, 'firstoccurence' => strtotime('2012-01-01 10:00:00'), - 'lastoccurence' => strtotime('2012-01-01 11:00:00') + (3600 * 24 * 999), - 'componenttype' => 'VEVENT', + 'lastoccurence' => strtotime('2012-01-01 11:00:00') + (3600 * 24 * 999), + 'componenttype' => 'VEVENT', ], $row); - } /** * @depends testCreateCalendarObject */ - function testCreateCalendarObjectTask() { - + public function testCreateCalendarObjectTask() + { $backend = new PDO($this->pdo); $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); @@ -515,21 +488,20 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { } $this->assertEquals([ - 'etag' => md5($object), - 'size' => strlen($object), - 'calendardata' => $object, + 'etag' => md5($object), + 'size' => strlen($object), + 'calendardata' => $object, 'firstoccurence' => null, - 'lastoccurence' => null, - 'componenttype' => 'VTODO', + 'lastoccurence' => null, + 'componenttype' => 'VTODO', ], $row); - } /** * @depends testCreateCalendarObject */ - function testGetCalendarObjects() { - + public function testGetCalendarObjects() + { $backend = new PDO($this->pdo); $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); @@ -543,36 +515,33 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $this->assertEquals('random-id', $data['uri']); $this->assertEquals(strlen($object), $data['size']); - } /** * @depends testGetCalendarObjects * @expectedException \InvalidArgumentException */ - function testGetCalendarObjectsBadId() { - + public function testGetCalendarObjectsBadId() + { $backend = new PDO($this->pdo); $backend->getCalendarObjects('bad-id'); - } /** * @depends testGetCalendarObjects * @expectedException \InvalidArgumentException */ - function testGetCalendarObjectBadId() { - + public function testGetCalendarObjectBadId() + { $backend = new PDO($this->pdo); $backend->getCalendarObject('bad-id', 'foo-bar'); - } /** * @depends testCreateCalendarObject */ - function testGetCalendarObjectByUID() { - + public function testGetCalendarObjectByUID() + { $backend = new PDO($this->pdo); $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); @@ -586,14 +555,13 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { 'somerandomid/random-id', $backend->getCalendarObjectByUID('principals/user2', 'foo') ); - } /** * @depends testCreateCalendarObject */ - function testUpdateCalendarObject() { - + public function testUpdateCalendarObject() + { $backend = new PDO($this->pdo); $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); @@ -610,26 +578,23 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $this->assertEquals($object2, $data['calendardata']); $this->assertEquals('random-id', $data['uri']); - - } /** * @depends testUpdateCalendarObject * @expectedException \InvalidArgumentException */ - function testUpdateCalendarObjectBadId() { - + public function testUpdateCalendarObjectBadId() + { $backend = new PDO($this->pdo); $backend->updateCalendarObject('bad-id', 'object-id', 'objectdata'); - } /** * @depends testCreateCalendarObject */ - function testDeleteCalendarObject() { - + public function testDeleteCalendarObject() + { $backend = new PDO($this->pdo); $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); @@ -639,222 +604,215 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $data = $backend->getCalendarObject($returnedId, 'random-id'); $this->assertNull($data); - } /** * @depends testDeleteCalendarObject * @expectedException \InvalidArgumentException */ - function testDeleteCalendarObjectBadId() { - + public 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() { - + public function testCalendarQueryNoResult() + { $abstract = new PDO($this->pdo); $filters = [ - 'name' => 'VCALENDAR', + 'name' => 'VCALENDAR', 'comp-filters' => [ [ - 'name' => 'VJOURNAL', - 'comp-filters' => [], - 'prop-filters' => [], + 'name' => 'VJOURNAL', + 'comp-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => null, + 'time-range' => null, ], ], - 'prop-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => null, + 'time-range' => null, ]; $this->assertEquals([ ], $abstract->calendarQuery([1, 1], $filters)); - } /** * @expectedException \InvalidArgumentException * @depends testCalendarQueryNoResult */ - function testCalendarQueryBadId() { - + public function testCalendarQueryBadId() + { $abstract = new PDO($this->pdo); $filters = [ - 'name' => 'VCALENDAR', + 'name' => 'VCALENDAR', 'comp-filters' => [ [ - 'name' => 'VJOURNAL', - 'comp-filters' => [], - 'prop-filters' => [], + 'name' => 'VJOURNAL', + 'comp-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => null, + 'time-range' => null, ], ], - 'prop-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => null, + 'time-range' => null, ]; $abstract->calendarQuery('bad-id', $filters); - } - function testCalendarQueryTodo() { - + public function testCalendarQueryTodo() + { $backend = new PDO($this->pdo); - $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], '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', + 'name' => 'VCALENDAR', 'comp-filters' => [ [ - 'name' => 'VTODO', - 'comp-filters' => [], - 'prop-filters' => [], + 'name' => 'VTODO', + 'comp-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => null, + 'time-range' => null, ], ], - 'prop-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => null, + 'time-range' => null, ]; $this->assertEquals([ - "todo", + 'todo', ], $backend->calendarQuery([1, 1], $filters)); - } - function testCalendarQueryTodoNotMatch() { + public function testCalendarQueryTodoNotMatch() + { $backend = new PDO($this->pdo); - $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], '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', + 'name' => 'VCALENDAR', 'comp-filters' => [ [ - 'name' => 'VTODO', + 'name' => 'VTODO', 'comp-filters' => [], 'prop-filters' => [ [ - 'name' => 'summary', - 'text-match' => null, - 'time-range' => null, - 'param-filters' => [], + 'name' => 'summary', + 'text-match' => null, + 'time-range' => null, + 'param-filters' => [], 'is-not-defined' => false, ], ], 'is-not-defined' => false, - 'time-range' => null, + 'time-range' => null, ], ], - 'prop-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => null, + 'time-range' => null, ]; $this->assertEquals([ ], $backend->calendarQuery([1, 1], $filters)); - } - function testCalendarQueryNoFilter() { - + public function testCalendarQueryNoFilter() + { $backend = new PDO($this->pdo); - $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], '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', - 'comp-filters' => [], - 'prop-filters' => [], + 'name' => 'VCALENDAR', + 'comp-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => null, + 'time-range' => null, ]; $result = $backend->calendarQuery([1, 1], $filters); $this->assertTrue(in_array('todo', $result)); $this->assertTrue(in_array('event', $result)); - } - function testCalendarQueryTimeRange() { - + public function testCalendarQueryTimeRange() + { $backend = new PDO($this->pdo); - $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"); + $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', + 'name' => 'VCALENDAR', 'comp-filters' => [ [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [], + 'name' => 'VEVENT', + 'comp-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => [ + 'time-range' => [ 'start' => new \DateTime('20120103'), - 'end' => new \DateTime('20120104'), + 'end' => new \DateTime('20120104'), ], ], ], - 'prop-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => null, + 'time-range' => null, ]; $this->assertEquals([ - "event2", + 'event2', ], $backend->calendarQuery([1, 1], $filters)); - } - function testCalendarQueryTimeRangeNoEnd() { + public function testCalendarQueryTimeRangeNoEnd() + { $backend = new PDO($this->pdo); - $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"); + $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', + 'name' => 'VCALENDAR', 'comp-filters' => [ [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [], + 'name' => 'VEVENT', + 'comp-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => [ + 'time-range' => [ 'start' => new \DateTime('20120102'), - 'end' => null, + 'end' => null, ], ], ], - 'prop-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => null, + 'time-range' => null, ]; $this->assertEquals([ - "event2", + 'event2', ], $backend->calendarQuery([1, 1], $filters)); - } - function testGetChanges() { - + public function testGetChanges() + { $backend = new PDO($this->pdo); $id = $backend->createCalendar( 'principals/user1', @@ -865,37 +823,37 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $this->assertEquals([ 'syncToken' => 1, - 'modified' => [], - 'deleted' => [], - 'added' => [], + 'modified' => [], + 'deleted' => [], + 'added' => [], ], $result); $currentToken = $result['syncToken']; $dummyTodo = "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n"; - $backend->createCalendarObject($id, "todo1.ics", $dummyTodo); - $backend->createCalendarObject($id, "todo2.ics", $dummyTodo); - $backend->createCalendarObject($id, "todo3.ics", $dummyTodo); - $backend->updateCalendarObject($id, "todo1.ics", $dummyTodo); - $backend->deleteCalendarObject($id, "todo2.ics"); + $backend->createCalendarObject($id, 'todo1.ics', $dummyTodo); + $backend->createCalendarObject($id, 'todo2.ics', $dummyTodo); + $backend->createCalendarObject($id, 'todo3.ics', $dummyTodo); + $backend->updateCalendarObject($id, 'todo1.ics', $dummyTodo); + $backend->deleteCalendarObject($id, 'todo2.ics'); $result = $backend->getChangesForCalendar($id, $currentToken, 1); $this->assertEquals([ 'syncToken' => 6, - 'modified' => ["todo1.ics"], - 'deleted' => ["todo2.ics"], - 'added' => ["todo3.ics"], + 'modified' => ['todo1.ics'], + 'deleted' => ['todo2.ics'], + 'added' => ['todo3.ics'], ], $result); $result = $backend->getChangesForCalendar($id, null, 1); $this->assertEquals([ 'syncToken' => 6, - 'modified' => [], - 'deleted' => [], - 'added' => ["todo1.ics", "todo3.ics"], + 'modified' => [], + 'deleted' => [], + 'added' => ['todo1.ics', 'todo3.ics'], ], $result); } @@ -903,8 +861,8 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { * @depends testGetChanges * @expectedException \InvalidArgumentException */ - function testGetChangesBadId() { - + public function testGetChangesBadId() + { $backend = new PDO($this->pdo); $id = $backend->createCalendar( 'principals/user1', @@ -912,16 +870,15 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { [] ); $backend->getChangesForCalendar('bad-id', null, 1); - } - function testCreateSubscriptions() { - + public function testCreateSubscriptions() + { $props = [ - '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false), - '{DAV:}displayname' => 'cal', - '{http://apple.com/ns/ical/}refreshrate' => 'P1W', - '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF', + '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false), + '{DAV:}displayname' => 'cal', + '{http://apple.com/ns/ical/}refreshrate' => 'P1W', + '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF', '{http://calendarserver.org/ns/}subscribed-strip-todos' => true, //'{http://calendarserver.org/ns/}subscribed-strip-alarms' => true, '{http://calendarserver.org/ns/}subscribed-strip-attachments' => true, @@ -944,29 +901,27 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { foreach ($expected as $k => $v) { $this->assertEquals($subs[0][$k], $expected[$k]); } - } /** * @expectedException \Sabre\DAV\Exception\Forbidden */ - function testCreateSubscriptionFail() { - + public function testCreateSubscriptionFail() + { $props = [ ]; $backend = new PDO($this->pdo); $backend->createSubscription('principals/user1', 'sub1', $props); - } - function testUpdateSubscriptions() { - + public function testUpdateSubscriptions() + { $props = [ - '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false), - '{DAV:}displayname' => 'cal', - '{http://apple.com/ns/ical/}refreshrate' => 'P1W', - '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF', + '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false), + '{DAV:}displayname' => 'cal', + '{http://apple.com/ns/ical/}refreshrate' => 'P1W', + '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF', '{http://calendarserver.org/ns/}subscribed-strip-todos' => true, //'{http://calendarserver.org/ns/}subscribed-strip-alarms' => true, '{http://calendarserver.org/ns/}subscribed-strip-attachments' => true, @@ -976,7 +931,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $backend->createSubscription('principals/user1', 'sub1', $props); $newProps = [ - '{DAV:}displayname' => 'new displayname', + '{DAV:}displayname' => 'new displayname', '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal2.ics', false), ]; @@ -1000,16 +955,15 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { foreach ($expected as $k => $v) { $this->assertEquals($subs[0][$k], $expected[$k]); } - } - function testUpdateSubscriptionsFail() { - + public function testUpdateSubscriptionsFail() + { $props = [ - '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false), - '{DAV:}displayname' => 'cal', - '{http://apple.com/ns/ical/}refreshrate' => 'P1W', - '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF', + '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false), + '{DAV:}displayname' => 'cal', + '{http://apple.com/ns/ical/}refreshrate' => 'P1W', + '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF', '{http://calendarserver.org/ns/}subscribed-strip-todos' => true, //'{http://calendarserver.org/ns/}subscribed-strip-alarms' => true, '{http://calendarserver.org/ns/}subscribed-strip-attachments' => true, @@ -1019,29 +973,28 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $backend->createSubscription('principals/user1', 'sub1', $props); $propPatch = new DAV\PropPatch([ - '{DAV:}displayname' => 'new displayname', + '{DAV:}displayname' => 'new displayname', '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal2.ics', false), - '{DAV:}unknown' => 'foo', + '{DAV:}unknown' => 'foo', ]); $backend->updateSubscription(1, $propPatch); $propPatch->commit(); $this->assertEquals([ - '{DAV:}unknown' => 403, - '{DAV:}displayname' => 424, + '{DAV:}unknown' => 403, + '{DAV:}displayname' => 424, '{http://calendarserver.org/ns/}source' => 424, ], $propPatch->getResult()); - } - function testDeleteSubscriptions() { - + public function testDeleteSubscriptions() + { $props = [ - '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false), - '{DAV:}displayname' => 'cal', - '{http://apple.com/ns/ical/}refreshrate' => 'P1W', - '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF', + '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false), + '{DAV:}displayname' => 'cal', + '{http://apple.com/ns/ical/}refreshrate' => 'P1W', + '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF', '{http://calendarserver.org/ns/}subscribed-strip-todos' => true, //'{http://calendarserver.org/ns/}subscribed-strip-alarms' => true, '{http://calendarserver.org/ns/}subscribed-strip-attachments' => true, @@ -1051,7 +1004,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $backend->createSubscription('principals/user1', 'sub1', $props); $newProps = [ - '{DAV:}displayname' => 'new displayname', + '{DAV:}displayname' => 'new displayname', '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal2.ics', false), ]; @@ -1061,8 +1014,8 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $this->assertEquals(0, count($subs)); } - function testSchedulingMethods() { - + public function testSchedulingMethods() + { $backend = new PDO($this->pdo); $calData = "BEGIN:VCALENDAR\r\nEND:VCALENDAR\r\n"; @@ -1075,9 +1028,9 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $expected = [ 'calendardata' => $calData, - 'uri' => 'schedule1.ics', - 'etag' => '"' . md5($calData) . '"', - 'size' => strlen($calData) + 'uri' => 'schedule1.ics', + 'etag' => '"'.md5($calData).'"', + 'size' => strlen($calData), ]; $result = $backend->getSchedulingObject('principals/user1', 'schedule1.ics'); @@ -1104,11 +1057,10 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $result = $backend->getSchedulingObject('principals/user1', 'schedule1.ics'); $this->assertNull($result); - } - function testGetInvites() { - + public function testGetInvites() + { $backend = new PDO($this->pdo); // creating a new calendar @@ -1118,23 +1070,22 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $result = $backend->getInvites($calendar['id']); $expected = [ new Sharee([ - 'href' => 'principals/user1', - 'principal' => 'principals/user1', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, + '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() { - + public function testGetInvitesBadId() + { $backend = new PDO($this->pdo); // creating a new calendar @@ -1142,14 +1093,13 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $calendar = $backend->getCalendarsForUser('principals/user1')[0]; $backend->getInvites('bad-id'); - } /** * @depends testCreateCalendarAndFetch */ - function testUpdateInvites() { - + public function testUpdateInvites() + { $backend = new PDO($this->pdo); // creating a new calendar @@ -1157,9 +1107,9 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $calendar = $backend->getCalendarsForUser('principals/user1')[0]; $ownerSharee = new Sharee([ - 'href' => 'principals/user1', - 'principal' => 'principals/user1', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, + 'href' => 'principals/user1', + 'principal' => 'principals/user1', + 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, ]); @@ -1168,12 +1118,12 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $calendar['id'], [ new Sharee([ - 'href' => 'mailto:user@example.org', - 'principal' => 'principals/user2', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, + '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'], - ]) + 'properties' => ['{DAV:}displayname' => 'User 2'], + ]), ] ); @@ -1181,26 +1131,26 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $expected = [ $ownerSharee, new Sharee([ - 'href' => 'mailto:user@example.org', - 'principal' => 'principals/user2', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, + 'href' => 'mailto:user@example.org', + 'principal' => 'principals/user2', + 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, - 'properties' => [ + 'properties' => [ '{DAV:}displayname' => 'User 2', ], - ]) + ]), ]; $this->assertEquals($expected, $result); // Checking calendar_instances too $expectedCalendar = [ - 'id' => [1,2], - 'principaluri' => 'principals/user2', + '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', + '{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'); @@ -1208,21 +1158,20 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $this->assertEquals( $v, $calendars[0][$k], - "Key " . $k . " in calendars array did not have the expected value." + '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, + 'href' => 'mailto:user@example.org', + 'principal' => 'principals/user2', + 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE, 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, - ]) + ]), ] ); @@ -1230,14 +1179,14 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $expected = [ $ownerSharee, new Sharee([ - 'href' => 'mailto:user@example.org', - 'principal' => 'principals/user2', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE, + 'href' => 'mailto:user@example.org', + 'principal' => 'principals/user2', + 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE, 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, - 'properties' => [ + 'properties' => [ '{DAV:}displayname' => 'User 2', ], - ]) + ]), ]; $this->assertEquals($expected, $result); @@ -1246,15 +1195,15 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $calendar['id'], [ new Sharee([ - 'href' => 'mailto:user@example.org', + 'href' => 'mailto:user@example.org', 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS, - ]) + ]), ] ); $result = $backend->getInvites($calendar['id']); $expected = [ - $ownerSharee + $ownerSharee, ]; $this->assertEquals($expected, $result); @@ -1263,45 +1212,43 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $calendar['id'], [ new Sharee([ - 'href' => 'principals/user2', + '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, + '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() { - + public function testUpdateInvitesBadId() + { $backend = new PDO($this->pdo); // Add a new invite $backend->updateInvites( 'bad-id', [] ); - } /** * @depends testUpdateInvites */ - function testUpdateInvitesNoPrincipal() { - + public function testUpdateInvitesNoPrincipal() + { $backend = new PDO($this->pdo); // creating a new calendar @@ -1309,9 +1256,9 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $calendar = $backend->getCalendarsForUser('principals/user1')[0]; $ownerSharee = new Sharee([ - 'href' => 'principals/user1', - 'principal' => 'principals/user1', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, + 'href' => 'principals/user1', + 'principal' => 'principals/user1', + 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, ]); @@ -1320,12 +1267,12 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $calendar['id'], [ new Sharee([ - 'href' => 'mailto:user@example.org', - 'principal' => null, - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, + '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'], - ]) + 'properties' => ['{DAV:}displayname' => 'User 2'], + ]), ] ); @@ -1333,24 +1280,23 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $expected = [ $ownerSharee, new Sharee([ - 'href' => 'mailto:user@example.org', - 'principal' => null, - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, + 'href' => 'mailto:user@example.org', + 'principal' => null, + 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_INVALID, - 'properties' => [ + '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() { - + public function testDeleteSharedCalendar() + { $backend = new PDO($this->pdo); // creating a new calendar @@ -1358,9 +1304,9 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $calendar = $backend->getCalendarsForUser('principals/user1')[0]; $ownerSharee = new Sharee([ - 'href' => 'principals/user1', - 'principal' => 'principals/user1', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, + 'href' => 'principals/user1', + 'principal' => 'principals/user1', + 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, ]); @@ -1369,23 +1315,23 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $calendar['id'], [ new Sharee([ - 'href' => 'mailto:user@example.org', - 'principal' => 'principals/user2', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, + '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'], - ]) + 'properties' => ['{DAV:}displayname' => 'User 2'], + ]), ] ); $expectedCalendar = [ - 'id' => [1,2], - 'principaluri' => 'principals/user2', + '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', + '{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'); @@ -1393,7 +1339,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $this->assertEquals( $v, $calendars[0][$k], - "Key " . $k . " in calendars array did not have the expected value." + 'Key '.$k.' in calendars array did not have the expected value.' ); } @@ -1408,24 +1354,21 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $result = $backend->getInvites($calendar['id']); $expected = [ new Sharee([ - 'href' => 'principals/user1', - 'principal' => 'principals/user1', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, + '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() { - + public function testSetPublishStatus() + { $backend = new PDO($this->pdo); $backend->setPublishStatus([1, 1], true); - } - } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractTest.php index 7f642efc9..166de1dab 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractTest.php @@ -1,14 +1,16 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV\Backend; use Sabre\DAV\PropPatch; -class AbstractTest extends \PHPUnit_Framework_TestCase { - - function testUpdateCalendar() { - +class AbstractTest extends \PHPUnit\Framework\TestCase +{ + public function testUpdateCalendar() + { $abstract = new AbstractMock(); $propPatch = new PropPatch(['{DAV:}displayname' => 'anything']); @@ -16,36 +18,34 @@ class AbstractTest extends \PHPUnit_Framework_TestCase { $result = $propPatch->commit(); $this->assertFalse($result); - } - function testCalendarQuery() { - + public function testCalendarQuery() + { $abstract = new AbstractMock(); $filters = [ - 'name' => 'VCALENDAR', + 'name' => 'VCALENDAR', 'comp-filters' => [ [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [], + 'name' => 'VEVENT', + 'comp-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => null, + 'time-range' => null, ], ], - 'prop-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => null, + 'time-range' => null, ]; $this->assertEquals([ 'event1.ics', ], $abstract->calendarQuery(1, $filters)); - } - function testGetCalendarObjectByUID() { - + public function testGetCalendarObjectByUID() + { $abstract = new AbstractMock(); $this->assertNull( $abstract->getCalendarObjectByUID('principal1', 'zim') @@ -60,11 +60,10 @@ class AbstractTest extends \PHPUnit_Framework_TestCase { $this->assertNull( $abstract->getCalendarObjectByUID('principal1', 'shared') ); - } - function testGetMultipleCalendarObjects() { - + public function testGetMultipleCalendarObjects() + { $abstract = new AbstractMock(); $result = $abstract->getMultipleCalendarObjects(1, [ 'event1.ics', @@ -73,106 +72,113 @@ class AbstractTest extends \PHPUnit_Framework_TestCase { $expected = [ [ - 'id' => 1, - 'calendarid' => 1, - 'uri' => 'event1.ics', + 'id' => 1, + 'calendarid' => 1, + 'uri' => 'event1.ics', 'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n", ], [ - 'id' => 2, - 'calendarid' => 1, - 'uri' => 'task1.ics', + 'id' => 2, + 'calendarid' => 1, + 'uri' => 'task1.ics', 'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n", ], ]; $this->assertEquals($expected, $result); - - } - } -class AbstractMock extends AbstractBackend { - - function getCalendarsForUser($principalUri) { - +class AbstractMock extends AbstractBackend +{ + public function getCalendarsForUser($principalUri) + { return [ [ - 'id' => 1, + 'id' => 1, 'principaluri' => 'principal1', - 'uri' => 'cal1', + 'uri' => 'cal1', ], [ - 'id' => 2, - 'principaluri' => 'principal1', + 'id' => 2, + 'principaluri' => 'principal1', '{http://sabredav.org/ns}owner-principal' => 'principal2', - 'uri' => 'cal1', + 'uri' => 'cal1', ], ]; + } + + public function createCalendar($principalUri, $calendarUri, array $properties) + { + } + public function deleteCalendar($calendarId) + { } - function createCalendar($principalUri, $calendarUri, array $properties) { } - function deleteCalendar($calendarId) { } - function getCalendarObjects($calendarId) { + public function getCalendarObjects($calendarId) + { switch ($calendarId) { case 1: return [ [ - 'id' => 1, + 'id' => 1, 'calendarid' => 1, - 'uri' => 'event1.ics', + 'uri' => 'event1.ics', ], [ - 'id' => 2, + 'id' => 2, 'calendarid' => 1, - 'uri' => 'task1.ics', + 'uri' => 'task1.ics', ], ]; case 2: return [ [ - 'id' => 3, + 'id' => 3, 'calendarid' => 2, - 'uri' => 'shared-event.ics', - ] + 'uri' => 'shared-event.ics', + ], ]; } - } - function getCalendarObject($calendarId, $objectUri) { - + public function getCalendarObject($calendarId, $objectUri) + { switch ($objectUri) { - - case 'event1.ics' : + case 'event1.ics': return [ - 'id' => 1, - 'calendarid' => 1, - 'uri' => 'event1.ics', + 'id' => 1, + 'calendarid' => 1, + 'uri' => 'event1.ics', 'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n", ]; - case 'task1.ics' : + case 'task1.ics': return [ - 'id' => 2, - 'calendarid' => 1, - 'uri' => 'task1.ics', + 'id' => 2, + 'calendarid' => 1, + 'uri' => 'task1.ics', 'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n", ]; - case 'shared-event.ics' : + case 'shared-event.ics': return [ - 'id' => 3, - 'calendarid' => 2, - 'uri' => 'event1.ics', + 'id' => 3, + 'calendarid' => 2, + 'uri' => 'event1.ics', 'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:shared\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n", ]; - } + } + public function createCalendarObject($calendarId, $objectUri, $calendarData) + { } - function createCalendarObject($calendarId, $objectUri, $calendarData) { } - function updateCalendarObject($calendarId, $objectUri, $calendarData) { } - function deleteCalendarObject($calendarId, $objectUri) { } + public function updateCalendarObject($calendarId, $objectUri, $calendarData) + { + } + + public function deleteCalendarObject($calendarId, $objectUri) + { + } } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php index cc665cd8f..9f18eeb72 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php @@ -1,17 +1,19 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV\Backend; use Sabre\CalDAV; use Sabre\DAV; -class Mock extends AbstractBackend { - +class Mock extends AbstractBackend +{ protected $calendarData; protected $calendars; - function __construct(array $calendars = [], array $calendarData = []) { - + public function __construct(array $calendars = [], array $calendarData = []) + { foreach ($calendars as &$calendar) { if (!isset($calendar['id'])) { $calendar['id'] = DAV\UUIDUtil::getUUID(); @@ -20,7 +22,6 @@ class Mock extends AbstractBackend { $this->calendars = $calendars; $this->calendarData = $calendarData; - } /** @@ -38,10 +39,11 @@ class Mock extends AbstractBackend { * common one is '{DAV:}displayname'. * * @param string $principalUri + * * @return array */ - function getCalendarsForUser($principalUri) { - + public function getCalendarsForUser($principalUri) + { $r = []; foreach ($this->calendars as $row) { if ($row['principaluri'] == $principalUri) { @@ -50,7 +52,6 @@ class Mock extends AbstractBackend { } return $r; - } /** @@ -64,21 +65,21 @@ class Mock extends AbstractBackend { * * @param string $principalUri * @param string $calendarUri - * @param array $properties + * @param array $properties + * * @return string|int */ - function createCalendar($principalUri, $calendarUri, array $properties) { - + public function createCalendar($principalUri, $calendarUri, array $properties) + { $id = DAV\UUIDUtil::getUUID(); $this->calendars[] = array_merge([ - 'id' => $id, - 'principaluri' => $principalUri, - 'uri' => $calendarUri, - '{' . CalDAV\Plugin::NS_CALDAV . '}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet(['VEVENT', 'VTODO']), + 'id' => $id, + 'principaluri' => $principalUri, + 'uri' => $calendarUri, + '{'.CalDAV\Plugin::NS_CALDAV.'}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet(['VEVENT', 'VTODO']), ], $properties); return $id; - } /** @@ -93,16 +94,13 @@ class Mock extends AbstractBackend { * * Read the PropPatch documentation for more info and examples. * - * @param mixed $calendarId + * @param mixed $calendarId * @param \Sabre\DAV\PropPatch $propPatch - * @return void */ - function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) { - - $propPatch->handleRemaining(function($props) use ($calendarId) { - + public 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)) { @@ -111,30 +109,25 @@ class Mock extends AbstractBackend { $this->calendars[$k][$propName] = $propValue; } } - return true; + return true; } - } - }); - } /** - * Delete a calendar and all it's objects + * Delete a calendar and all it's objects. * * @param string $calendarId - * @return void */ - function deleteCalendar($calendarId) { - + public function deleteCalendar($calendarId) + { foreach ($this->calendars as $k => $calendar) { if ($calendar['id'] === $calendarId) { unset($this->calendars[$k]); } } - } /** @@ -157,12 +150,14 @@ class Mock extends AbstractBackend { * calendardata. * * @param string $calendarId + * * @return array */ - function getCalendarObjects($calendarId) { - - if (!isset($this->calendarData[$calendarId])) + public function getCalendarObjects($calendarId) + { + if (!isset($this->calendarData[$calendarId])) { return []; + } $objects = $this->calendarData[$calendarId]; @@ -171,8 +166,8 @@ class Mock extends AbstractBackend { $object['uri'] = $uri; $object['lastmodified'] = null; } - return $objects; + return $objects; } /** @@ -187,12 +182,13 @@ class Mock extends AbstractBackend { * * This method must return null if the object did not exist. * - * @param mixed $calendarId + * @param mixed $calendarId * @param string $objectUri + * * @return array|null */ - function getCalendarObject($calendarId, $objectUri) { - + public function getCalendarObject($calendarId, $objectUri) + { if (!isset($this->calendarData[$calendarId][$objectUri])) { return null; } @@ -200,8 +196,8 @@ class Mock extends AbstractBackend { $object['calendarid'] = $calendarId; $object['uri'] = $objectUri; $object['lastmodified'] = null; - return $object; + return $object; } /** @@ -210,17 +206,16 @@ class Mock extends AbstractBackend { * @param string $calendarId * @param string $objectUri * @param string $calendarData - * @return void */ - function createCalendarObject($calendarId, $objectUri, $calendarData) { - + public function createCalendarObject($calendarId, $objectUri, $calendarData) + { $this->calendarData[$calendarId][$objectUri] = [ 'calendardata' => $calendarData, - 'calendarid' => $calendarId, - 'uri' => $objectUri, + 'calendarid' => $calendarId, + 'uri' => $objectUri, ]; - return '"' . md5($calendarData) . '"'; + return '"'.md5($calendarData).'"'; } /** @@ -229,17 +224,16 @@ class Mock extends AbstractBackend { * @param string $calendarId * @param string $objectUri * @param string $calendarData - * @return void */ - function updateCalendarObject($calendarId, $objectUri, $calendarData) { - + public function updateCalendarObject($calendarId, $objectUri, $calendarData) + { $this->calendarData[$calendarId][$objectUri] = [ 'calendardata' => $calendarData, - 'calendarid' => $calendarId, - 'uri' => $objectUri, + 'calendarid' => $calendarId, + 'uri' => $objectUri, ]; - return '"' . md5($calendarData) . '"'; + return '"'.md5($calendarData).'"'; } /** @@ -247,12 +241,9 @@ class Mock extends AbstractBackend { * * @param string $calendarId * @param string $objectUri - * @return void */ - function deleteCalendarObject($calendarId, $objectUri) { - + public function deleteCalendarObject($calendarId, $objectUri) + { 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 e068ff1e7..66388def4 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/PDOMySQLTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/PDOMySQLTest.php @@ -1,9 +1,10 @@ <?php -namespace Sabre\CalDAV\Backend; +declare(strict_types=1); -class PDOMySQLTest extends AbstractPDOTest { +namespace Sabre\CalDAV\Backend; +class PDOMySQLTest extends AbstractPDOTest +{ 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 90ad5a171..4470e5810 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/PDOSqliteTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/PDOSqliteTest.php @@ -1,9 +1,10 @@ <?php -namespace Sabre\CalDAV\Backend; +declare(strict_types=1); -class PDOSqliteTest extends AbstractPDOTest { +namespace Sabre\CalDAV\Backend; +class PDOSqliteTest extends AbstractPDOTest +{ public $driver = 'sqlite'; - } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php index c92cde661..d6073514f 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php @@ -1,11 +1,13 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV; require_once 'Sabre/CalDAV/TestUtil.php'; -class CalendarObjectTest extends \PHPUnit_Framework_TestCase { - +class CalendarObjectTest extends \PHPUnit\Framework\TestCase +{ /** * @var Sabre\CalDAV\Backend_PDO */ @@ -16,25 +18,23 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase { protected $calendar; protected $principalBackend; - function setup() { - + public function setup() + { $this->backend = TestUtil::getBackend(); $calendars = $this->backend->getCalendarsForUser('principals/user1'); $this->assertEquals(2, count($calendars)); $this->calendar = new Calendar($this->backend, $calendars[0]); - } - function teardown() { - + public function teardown() + { unset($this->calendar); unset($this->backend); - } - function testSetup() { - + public function testSetup() + { $children = $this->calendar->getChildren(); $this->assertTrue($children[0] instanceof CalendarObject); @@ -42,54 +42,50 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase { $this->assertInternalType('string', $children[0]->get()); $this->assertInternalType('string', $children[0]->getETag()); $this->assertEquals('text/calendar; charset=utf-8', $children[0]->getContentType()); - } /** - * @expectedException InvalidArgumentException + * @expectedException \InvalidArgumentException */ - function testInvalidArg1() { - + public function testInvalidArg1() + { $obj = new CalendarObject( new Backend\Mock([], []), [], [] ); - } /** - * @expectedException InvalidArgumentException + * @expectedException \InvalidArgumentException */ - function testInvalidArg2() { - + public function testInvalidArg2() + { $obj = new CalendarObject( new Backend\Mock([], []), [], ['calendarid' => '1'] ); - } /** * @depends testSetup */ - function testPut() { - + public function testPut() + { $children = $this->calendar->getChildren(); $this->assertTrue($children[0] instanceof CalendarObject); $newData = TestUtil::getTestCalendarData(); $children[0]->put($newData); $this->assertEquals($newData, $children[0]->get()); - } /** * @depends testSetup */ - function testPutStream() { - + public function testPutStream() + { $children = $this->calendar->getChildren(); $this->assertTrue($children[0] instanceof CalendarObject); $newData = TestUtil::getTestCalendarData(); @@ -99,15 +95,13 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase { rewind($stream); $children[0]->put($stream); $this->assertEquals($newData, $children[0]->get()); - } - /** * @depends testSetup */ - function testDelete() { - + public function testDelete() + { $children = $this->calendar->getChildren(); $this->assertTrue($children[0] instanceof CalendarObject); @@ -116,14 +110,13 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase { $children2 = $this->calendar->getChildren(); $this->assertEquals(count($children) - 1, count($children2)); - } /** * @depends testSetup */ - function testGetLastModified() { - + public function testGetLastModified() + { $children = $this->calendar->getChildren(); $this->assertTrue($children[0] instanceof CalendarObject); @@ -131,14 +124,13 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase { $lastMod = $obj->getLastModified(); $this->assertTrue(is_int($lastMod) || ctype_digit($lastMod) || is_null($lastMod)); - } /** * @depends testSetup */ - function testGetSize() { - + public function testGetSize() + { $children = $this->calendar->getChildren(); $this->assertTrue($children[0] instanceof CalendarObject); @@ -146,31 +138,28 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase { $size = $obj->getSize(); $this->assertInternalType('int', $size); - } - function testGetOwner() { - + public function testGetOwner() + { $children = $this->calendar->getChildren(); $this->assertTrue($children[0] instanceof CalendarObject); $obj = $children[0]; $this->assertEquals('principals/user1', $obj->getOwner()); - } - function testGetGroup() { - + public function testGetGroup() + { $children = $this->calendar->getChildren(); $this->assertTrue($children[0] instanceof CalendarObject); $obj = $children[0]; $this->assertNull($obj->getGroup()); - } - function testGetACL() { - + public function testGetACL() + { $expected = [ [ 'privilege' => '{DAV:}read', @@ -204,11 +193,10 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase { $obj = $children[0]; $this->assertEquals($expected, $obj->getACL()); - } - function testDefaultACL() { - + public function testDefaultACL() + { $backend = new Backend\Mock([], []); $calendarObject = new CalendarObject($backend, ['principaluri' => 'principals/user1'], ['calendarid' => 1, 'uri' => 'foo']); $expected = [ @@ -229,31 +217,28 @@ class CalendarObjectTest extends \PHPUnit_Framework_TestCase { ], ]; $this->assertEquals($expected, $calendarObject->getACL()); - - } /** * @expectedException \Sabre\DAV\Exception\Forbidden */ - function testSetACL() { - + public function testSetACL() + { $children = $this->calendar->getChildren(); $this->assertTrue($children[0] instanceof CalendarObject); $obj = $children[0]; $obj->setACL([]); - } - function testGet() { - + public function testGet() + { $children = $this->calendar->getChildren(); $this->assertTrue($children[0] instanceof CalendarObject); $obj = $children[0]; - $expected = "BEGIN:VCALENDAR + $expected = 'BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Apple Inc.//iCal 4.0.1//EN CALSCALE:GREGORIAN @@ -284,100 +269,91 @@ DTEND;TZID=Asia/Seoul:20100223T070000 ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:lisa@example.com SEQUENCE:2 END:VEVENT -END:VCALENDAR"; - - +END:VCALENDAR'; $this->assertEquals($expected, $obj->get()); - } - function testGetRefetch() { - + public function testGetRefetch() + { $backend = new Backend\Mock([], [ 1 => [ 'foo' => [ 'calendardata' => 'foo', - 'uri' => 'foo' + 'uri' => 'foo', ], - ] + ], ]); $obj = new CalendarObject($backend, ['id' => 1], ['uri' => 'foo']); $this->assertEquals('foo', $obj->get()); - } - function testGetEtag1() { - + public function testGetEtag1() + { $objectInfo = [ 'calendardata' => 'foo', - 'uri' => 'foo', - 'etag' => 'bar', - 'calendarid' => 1 + 'uri' => 'foo', + 'etag' => 'bar', + 'calendarid' => 1, ]; $backend = new Backend\Mock([], []); $obj = new CalendarObject($backend, [], $objectInfo); $this->assertEquals('bar', $obj->getETag()); - } - function testGetEtag2() { - + public function testGetEtag2() + { $objectInfo = [ 'calendardata' => 'foo', - 'uri' => 'foo', - 'calendarid' => 1 + 'uri' => 'foo', + 'calendarid' => 1, ]; $backend = new Backend\Mock([], []); $obj = new CalendarObject($backend, [], $objectInfo); - $this->assertEquals('"' . md5('foo') . '"', $obj->getETag()); - + $this->assertEquals('"'.md5('foo').'"', $obj->getETag()); } - function testGetSupportedPrivilegesSet() { - + public function testGetSupportedPrivilegesSet() + { $objectInfo = [ 'calendardata' => 'foo', - 'uri' => 'foo', - 'calendarid' => 1 + 'uri' => 'foo', + 'calendarid' => 1, ]; $backend = new Backend\Mock([], []); $obj = new CalendarObject($backend, [], $objectInfo); $this->assertNull($obj->getSupportedPrivilegeSet()); - } - function testGetSize1() { - + public function testGetSize1() + { $objectInfo = [ 'calendardata' => 'foo', - 'uri' => 'foo', - 'calendarid' => 1 + 'uri' => 'foo', + 'calendarid' => 1, ]; $backend = new Backend\Mock([], []); $obj = new CalendarObject($backend, [], $objectInfo); $this->assertEquals(3, $obj->getSize()); - } - function testGetSize2() { - + public function testGetSize2() + { $objectInfo = [ - 'uri' => 'foo', + 'uri' => 'foo', 'calendarid' => 1, - 'size' => 4, + 'size' => 4, ]; $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 ca06d8ffa..660832ba4 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryVAlarmTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryVAlarmTest.php @@ -1,17 +1,19 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV; use Sabre\VObject; -class CalendarQueryVAlarmTest extends \PHPUnit_Framework_TestCase { - +class CalendarQueryVAlarmTest extends \PHPUnit\Framework\TestCase +{ /** * This test is specifically for a time-range query on a VALARM, contained - * in a VEVENT that's recurring + * in a VEVENT that's recurring. */ - function testValarm() { - + public function testValarm() + { $vcalendar = new VObject\Component\VCalendar(); $vevent = $vcalendar->createComponent('VEVENT'); @@ -23,29 +25,28 @@ class CalendarQueryVAlarmTest extends \PHPUnit_Framework_TestCase { $valarm->TRIGGER = '-P15D'; $vevent->add($valarm); - $vcalendar->add($vevent); $filter = [ - 'name' => 'VCALENDAR', + 'name' => 'VCALENDAR', 'is-not-defined' => false, - 'time-range' => null, - 'prop-filters' => [], - 'comp-filters' => [ + 'time-range' => null, + 'prop-filters' => [], + 'comp-filters' => [ [ - 'name' => 'VEVENT', + 'name' => 'VEVENT', 'is-not-defined' => false, - 'time-range' => null, - 'prop-filters' => [], - 'comp-filters' => [ + 'time-range' => null, + 'prop-filters' => [], + 'comp-filters' => [ [ - 'name' => 'VALARM', + 'name' => 'VALARM', 'is-not-defined' => false, - 'prop-filters' => [], - 'comp-filters' => [], - 'time-range' => [ + 'prop-filters' => [], + 'comp-filters' => [], + 'time-range' => [ 'start' => new \DateTime('2012-05-10'), - 'end' => new \DateTime('2012-05-20'), + 'end' => new \DateTime('2012-05-20'), ], ], ], @@ -73,8 +74,8 @@ class CalendarQueryVAlarmTest extends \PHPUnit_Framework_TestCase { $this->assertFalse($validator->validate($vcalendar, $filter)); } - function testAlarmWayBefore() { - + public function testAlarmWayBefore() + { $vcalendar = new VObject\Component\VCalendar(); $vevent = $vcalendar->createComponent('VEVENT'); @@ -88,25 +89,25 @@ class CalendarQueryVAlarmTest extends \PHPUnit_Framework_TestCase { $vcalendar->add($vevent); $filter = [ - 'name' => 'VCALENDAR', + 'name' => 'VCALENDAR', 'is-not-defined' => false, - 'time-range' => null, - 'prop-filters' => [], - 'comp-filters' => [ + 'time-range' => null, + 'prop-filters' => [], + 'comp-filters' => [ [ - 'name' => 'VEVENT', + 'name' => 'VEVENT', 'is-not-defined' => false, - 'time-range' => null, - 'prop-filters' => [], - 'comp-filters' => [ + 'time-range' => null, + 'prop-filters' => [], + 'comp-filters' => [ [ - 'name' => 'VALARM', + 'name' => 'VALARM', 'is-not-defined' => false, - 'prop-filters' => [], - 'comp-filters' => [], - 'time-range' => [ + 'prop-filters' => [], + 'comp-filters' => [], + 'time-range' => [ 'start' => new \DateTime('2011-12-10'), - 'end' => new \DateTime('2011-12-20'), + 'end' => new \DateTime('2011-12-20'), ], ], ], @@ -116,7 +117,5 @@ class CalendarQueryVAlarmTest extends \PHPUnit_Framework_TestCase { $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 f3305163b..9dc8ce188 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php @@ -1,13 +1,15 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV; use Sabre\VObject; -class CalendarQueryValidatorTest extends \PHPUnit_Framework_TestCase { - - function testTopLevelFail() { - +class CalendarQueryValidatorTest extends \PHPUnit\Framework\TestCase +{ + public function testTopLevelFail() + { $validator = new CalendarQueryValidator(); $vcal = <<<ICS BEGIN:VCALENDAR @@ -17,39 +19,38 @@ END:VCALENDAR ICS; $vcal = VObject\Reader::read($vcal); $this->assertFalse($validator->validate($vcal, ['name' => 'VFOO'])); - } /** * @param string $icalObject - * @param array $filters - * @param int $outcome + * @param array $filters + * @param int $outcome * @dataProvider provider */ - function testValid($icalObject, $filters, $outcome) { - + public function testValid($icalObject, $filters, $outcome) + { $validator = new CalendarQueryValidator(); // Wrapping filter in a VCALENDAR component filter, as this is always // there anyway. $filters = [ - 'name' => 'VCALENDAR', - 'comp-filters' => [$filters], - 'prop-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) { - case 0 : + case 0: $this->assertFalse($validator->validate($vObject, $filters)); break; - case 1 : + case 1: $this->assertTrue($validator->validate($vObject, $filters)); break; - case -1 : + case -1: try { $validator->validate($vObject, $filters); $this->fail('This test was supposed to fail'); @@ -62,13 +63,11 @@ ICS; $this->assertTrue(true); } break; - } - } - function provider() { - + public function provider() + { $blob1 = <<<yow BEGIN:VCALENDAR BEGIN:VEVENT @@ -194,7 +193,6 @@ END:VTODO END:VCALENDAR yow; - $blob16 = <<<yow BEGIN:VCALENDAR BEGIN:VTODO @@ -301,7 +299,6 @@ END:VEVENT END:VCALENDAR yow; - $blob27 = <<<yow BEGIN:VCALENDAR BEGIN:VTODO @@ -396,11 +393,11 @@ END:VCALENDAR yow; $filter1 = [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [], + 'name' => 'VEVENT', + 'comp-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => null, + 'time-range' => null, ]; $filter2 = $filter1; $filter2['name'] = 'VTODO'; @@ -415,21 +412,21 @@ yow; $filter5 = $filter1; $filter5['comp-filters'] = [ [ - 'name' => 'VALARM', + 'name' => 'VALARM', 'is-not-defined' => false, - 'comp-filters' => [], - 'prop-filters' => [], - 'time-range' => null, + 'comp-filters' => [], + 'prop-filters' => [], + 'time-range' => null, ], ]; $filter6 = $filter1; $filter6['prop-filters'] = [ [ - 'name' => 'SUMMARY', + 'name' => 'SUMMARY', 'is-not-defined' => false, - 'param-filters' => [], - 'time-range' => null, - 'text-match' => null, + 'param-filters' => [], + 'time-range' => null, + 'text-match' => null, ], ]; $filter7 = $filter6; @@ -448,13 +445,13 @@ yow; $filter11 = $filter1; $filter11['prop-filters'] = [ [ - 'name' => 'DTSTART', + 'name' => 'DTSTART', 'is-not-defined' => false, - 'param-filters' => [ + 'param-filters' => [ [ - 'name' => 'VALUE', + 'name' => 'VALUE', 'is-not-defined' => false, - 'text-match' => null, + 'text-match' => null, ], ], 'time-range' => null, @@ -474,8 +471,8 @@ yow; // Param text filter $filter15 = $filter11; $filter15['prop-filters'][0]['param-filters'][0]['text-match'] = [ - 'collation' => 'i;ascii-casemap', - 'value' => 'dAtE', + 'collation' => 'i;ascii-casemap', + 'value' => 'dAtE', 'negate-condition' => false, ]; $filter16 = $filter15; @@ -492,13 +489,13 @@ yow; $filter19 = $filter5; $filter19['comp-filters'][0]['prop-filters'] = [ [ - 'name' => 'action', + 'name' => 'action', 'is-not-defined' => false, - 'time-range' => null, - 'param-filters' => [], - 'text-match' => [ - 'collation' => 'i;ascii-casemap', - 'value' => 'display', + 'time-range' => null, + 'param-filters' => [], + 'text-match' => [ + 'collation' => 'i;ascii-casemap', + 'value' => 'display', 'negate-condition' => false, ], ], @@ -506,13 +503,13 @@ yow; // Time range $filter20 = [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [], + 'name' => 'VEVENT', + 'comp-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => [ + '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 @@ -527,102 +524,102 @@ yow; $filter23 = $filter20; $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 = [ - 'name' => 'VTODO', - 'comp-filters' => [], - 'prop-filters' => [], + 'name' => 'VTODO', + 'comp-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => [ + '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'] = [ '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'] = [ '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 = [ - 'name' => 'VJOURNAL', - 'comp-filters' => [], - 'prop-filters' => [], + 'name' => 'VJOURNAL', + 'comp-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => [ + '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'] = [ '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 = [ - 'name' => 'VFREEBUSY', - 'comp-filters' => [], - 'prop-filters' => [], + 'name' => 'VFREEBUSY', + 'comp-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => [ + '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 = [ - 'name' => 'VEVENT', + 'name' => 'VEVENT', 'comp-filters' => [], 'prop-filters' => [ [ - 'name' => 'DTSTART', + 'name' => 'DTSTART', 'is-not-defined' => false, - 'param-filters' => [], - 'time-range' => [ + '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 = [ - 'name' => 'VEVENT', + 'name' => 'VEVENT', 'prop-filters' => [], 'comp-filters' => [ [ - 'name' => 'VALARM', + 'name' => 'VALARM', 'is-not-defined' => false, - 'comp-filters' => [], - 'prop-filters' => [], - 'time-range' => [ + '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'] = [ '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; @@ -636,55 +633,54 @@ yow; // Time range filter on non-datetime property $filter37 = [ - 'name' => 'VEVENT', + 'name' => 'VEVENT', 'comp-filters' => [], 'prop-filters' => [ [ - 'name' => 'SUMMARY', + 'name' => 'SUMMARY', 'is-not-defined' => false, - 'param-filters' => [], - 'time-range' => [ + '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 = [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [], + 'name' => 'VEVENT', + 'comp-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => [ + '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')), - ] + 'end' => new \DateTime('2012-08-01 00:00:00', new \DateTimeZone('UTC')), + ], ]; $filter39 = [ - 'name' => 'VEVENT', + 'name' => 'VEVENT', 'comp-filters' => [ [ - 'name' => 'VALARM', - 'comp-filters' => [], - 'prop-filters' => [], + 'name' => 'VALARM', + 'comp-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => [ + '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')), - ] + 'end' => new \DateTime('2012-10-01 00:00:00', new \DateTimeZone('UTC')), + ], ], ], - 'prop-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => null, + 'time-range' => null, ]; return [ - // Component check [$blob1, $filter1, 1], @@ -823,7 +819,5 @@ yow; // Event in timerange, but filtered alarm is in the far future (88). [$blob34, $filter39, 0], ]; - } - } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php index df85b6ded..7d6414a80 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php @@ -1,13 +1,15 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV; use Sabre\DAV\PropPatch; require_once 'Sabre/CalDAV/TestUtil.php'; -class CalendarTest extends \PHPUnit_Framework_TestCase { - +class CalendarTest extends \PHPUnit\Framework\TestCase +{ /** * @var Sabre\CalDAV\Backend\PDO */ @@ -22,34 +24,30 @@ class CalendarTest extends \PHPUnit_Framework_TestCase { */ protected $calendars; - function setup() { - + public function setup() + { $this->backend = TestUtil::getBackend(); $this->calendars = $this->backend->getCalendarsForUser('principals/user1'); $this->assertEquals(2, count($this->calendars)); $this->calendar = new Calendar($this->backend, $this->calendars[0]); - - } - function teardown() { - + public function teardown() + { unset($this->backend); - } - function testSimple() { - + public function testSimple() + { $this->assertEquals($this->calendars[0]['uri'], $this->calendar->getName()); - } /** * @depends testSimple */ - function testUpdateProperties() { - + public function testUpdateProperties() + { $propPatch = new PropPatch([ '{DAV:}displayname' => 'NewName', ]); @@ -61,87 +59,80 @@ class CalendarTest extends \PHPUnit_Framework_TestCase { $calendars2 = $this->backend->getCalendarsForUser('principals/user1'); $this->assertEquals('NewName', $calendars2[0]['{DAV:}displayname']); - } /** * @depends testSimple */ - function testGetProperties() { - + public function testGetProperties() + { $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(['VEVENT', 'VTODO'], $result['{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set']->getValue()); - } /** - * @expectedException Sabre\DAV\Exception\NotFound + * @expectedException \Sabre\DAV\Exception\NotFound * @depends testSimple */ - function testGetChildNotFound() { - + public function testGetChildNotFound() + { $this->calendar->getChild('randomname'); - } /** * @depends testSimple */ - function testGetChildren() { - + public function testGetChildren() + { $children = $this->calendar->getChildren(); $this->assertEquals(1, count($children)); $this->assertTrue($children[0] instanceof CalendarObject); - } /** * @depends testGetChildren */ - function testChildExists() { - + public function testChildExists() + { $this->assertFalse($this->calendar->childExists('foo')); $children = $this->calendar->getChildren(); $this->assertTrue($this->calendar->childExists($children[0]->getName())); } - - /** - * @expectedException Sabre\DAV\Exception\MethodNotAllowed + * @expectedException \Sabre\DAV\Exception\MethodNotAllowed */ - function testCreateDirectory() { - + public function testCreateDirectory() + { $this->calendar->createDirectory('hello'); - } /** - * @expectedException Sabre\DAV\Exception\MethodNotAllowed + * @expectedException \Sabre\DAV\Exception\MethodNotAllowed */ - function testSetName() { - + public function testSetName() + { $this->calendar->setName('hello'); - } - function testGetLastModified() { - + public function testGetLastModified() + { $this->assertNull($this->calendar->getLastModified()); - } - function testCreateFile() { - + public function testCreateFile() + { $file = fopen('php://memory', 'r+'); fwrite($file, TestUtil::getTestCalendarData()); rewind($file); @@ -150,11 +141,10 @@ class CalendarTest extends \PHPUnit_Framework_TestCase { $file = $this->calendar->getChild('hello'); $this->assertTrue($file instanceof CalendarObject); - } - function testCreateFileNoSupportedComponents() { - + public function testCreateFileNoSupportedComponents() + { $file = fopen('php://memory', 'r+'); fwrite($file, TestUtil::getTestCalendarData()); rewind($file); @@ -164,31 +154,28 @@ class CalendarTest extends \PHPUnit_Framework_TestCase { $file = $calendar->getChild('hello'); $this->assertTrue($file instanceof CalendarObject); - } - function testDelete() { - + public function testDelete() + { $this->calendar->delete(); $calendars = $this->backend->getCalendarsForUser('principals/user1'); $this->assertEquals(1, count($calendars)); } - function testGetOwner() { - + public function testGetOwner() + { $this->assertEquals('principals/user1', $this->calendar->getOwner()); - } - function testGetGroup() { - + public function testGetGroup() + { $this->assertNull($this->calendar->getGroup()); - } - function testGetACL() { - + public function testGetACL() + { $expected = [ [ 'privilege' => '{DAV:}read', @@ -206,7 +193,7 @@ class CalendarTest extends \PHPUnit_Framework_TestCase { 'protected' => true, ], [ - 'privilege' => '{' . Plugin::NS_CALDAV . '}read-free-busy', + 'privilege' => '{'.Plugin::NS_CALDAV.'}read-free-busy', 'principal' => '{DAV:}authenticated', 'protected' => true, ], @@ -222,35 +209,29 @@ class CalendarTest extends \PHPUnit_Framework_TestCase { ], ]; $this->assertEquals($expected, $this->calendar->getACL()); - } /** * @expectedException \Sabre\DAV\Exception\Forbidden */ - function testSetACL() { - + public function testSetACL() + { $this->calendar->setACL([]); - } - function testGetSyncToken() { - + public function testGetSyncToken() + { $this->assertNull($this->calendar->getSyncToken()); - } - function testGetSyncTokenNoSyncSupport() { - + public function testGetSyncTokenNoSyncSupport() + { $calendar = new Calendar(new Backend\Mock([], []), []); $this->assertNull($calendar->getSyncToken()); - } - function testGetChanges() { - + public function testGetChanges() + { $this->assertNull($this->calendar->getChanges(1, 1)); - } - } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php index 9a3d47828..49252744d 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php @@ -1,29 +1,31 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV; use Sabre\HTTP; use Sabre\VObject; /** - * This unittests is created to find out why recurring events have wrong DTSTART value + * This unittests is created to find out why recurring events have wrong DTSTART value. * * * @copyright Copyright (C) fruux GmbH (https://fruux.com/) * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class ExpandEventsDTSTARTandDTENDTest extends \Sabre\DAVServerTest { - +class ExpandEventsDTSTARTandDTENDTest extends \Sabre\DAVServerTest +{ protected $setupCalDAV = true; protected $caldavCalendars = [ [ - 'id' => 1, - 'name' => 'Calendar', + 'id' => 1, + 'name' => 'Calendar', 'principaluri' => 'principals/user1', - 'uri' => 'calendar1', - ] + 'uri' => 'calendar1', + ], ]; protected $caldavCalendarObjects = [ @@ -52,13 +54,13 @@ END:VCALENDAR ], ]; - function testExpand() { - + public 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" ?> @@ -91,7 +93,7 @@ END:VCALENDAR try { $vObject = VObject\Reader::read($body); } catch (VObject\ParseException $e) { - $this->fail('Could not parse object. Error:' . $e->getMessage() . ' full object: ' . $response->getBodyAsString()); + $this->fail('Could not parse object. Error:'.$e->getMessage().' full object: '.$response->getBodyAsString()); } // check if DTSTARTs and DTENDs are correct @@ -99,15 +101,14 @@ END:VCALENDAR /** @var $vevent Sabre\VObject\Component\VEvent */ foreach ($vevent->children() as $child) { /** @var $child Sabre\VObject\Property */ - if ($child->name == 'DTSTART') { + if ('DTSTART' == $child->name) { // DTSTART has to be one of three valid values - $this->assertContains($child->getValue(), ['20120207T171500Z', '20120208T171500Z', '20120209T171500Z'], 'DTSTART is not a valid value: ' . $child->getValue()); - } elseif ($child->name == 'DTEND') { + $this->assertContains($child->getValue(), ['20120207T171500Z', '20120208T171500Z', '20120209T171500Z'], 'DTSTART is not a valid value: '.$child->getValue()); + } elseif ('DTEND' == $child->name) { // DTEND has to be one of three valid values - $this->assertContains($child->getValue(), ['20120207T181500Z', '20120208T181500Z', '20120209T181500Z'], 'DTEND is not a valid value: ' . $child->getValue()); + $this->assertContains($child->getValue(), ['20120207T181500Z', '20120208T181500Z', '20120209T181500Z'], 'DTEND is not a valid value: '.$child->getValue()); } } } } - } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php index efc49673f..3a982fcfa 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php @@ -1,28 +1,30 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV; use Sabre\HTTP; use Sabre\VObject; /** - * This unittests is created to find out why recurring events have wrong DTSTART value + * This unittests is created to find out why recurring events have wrong DTSTART value. * * @copyright Copyright (C) fruux GmbH (https://fruux.com/) * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class ExpandEventsDTSTARTandDTENDbyDayTest extends \Sabre\DAVServerTest { - +class ExpandEventsDTSTARTandDTENDbyDayTest extends \Sabre\DAVServerTest +{ protected $setupCalDAV = true; protected $caldavCalendars = [ [ - 'id' => 1, - 'name' => 'Calendar', + 'id' => 1, + 'name' => 'Calendar', 'principaluri' => 'principals/user1', - 'uri' => 'calendar1', - ] + 'uri' => 'calendar1', + ], ]; protected $caldavCalendarObjects = [ @@ -43,13 +45,13 @@ END:VCALENDAR ], ]; - function testExpandRecurringByDayEvent() { - + public function testExpandRecurringByDayEvent() + { $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,15 +90,14 @@ END:VCALENDAR /** @var $vevent Sabre\VObject\Component\VEvent */ foreach ($vevent->children() as $child) { /** @var $child Sabre\VObject\Property */ - if ($child->name == 'DTSTART') { + if ('DTSTART' == $child->name) { // DTSTART has to be one of two valid values - $this->assertContains($child->getValue(), ['20120214T171500Z', '20120216T171500Z'], 'DTSTART is not a valid value: ' . $child->getValue()); - } elseif ($child->name == 'DTEND') { + $this->assertContains($child->getValue(), ['20120214T171500Z', '20120216T171500Z'], 'DTSTART is not a valid value: '.$child->getValue()); + } elseif ('DTEND' == $child->name) { // DTEND has to be one of two valid values - $this->assertContains($child->getValue(), ['20120214T181500Z', '20120216T181500Z'], 'DTEND is not a valid value: ' . $child->getValue()); + $this->assertContains($child->getValue(), ['20120214T181500Z', '20120216T181500Z'], 'DTEND is not a valid value: '.$child->getValue()); } } } } - } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php index 3a22e03d4..90897f1c5 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV; use Sabre\HTTP; @@ -15,17 +17,17 @@ use Sabre\VObject; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class ExpandEventsDoubleEventsTest extends \Sabre\DAVServerTest { - +class ExpandEventsDoubleEventsTest extends \Sabre\DAVServerTest +{ protected $setupCalDAV = true; protected $caldavCalendars = [ [ - 'id' => 1, - 'name' => 'Calendar', + 'id' => 1, + 'name' => 'Calendar', 'principaluri' => 'principals/user1', - 'uri' => 'calendar1', - ] + 'uri' => 'calendar1', + ], ]; protected $caldavCalendarObjects = [ @@ -54,13 +56,13 @@ END:VCALENDAR ], ]; - function testExpand() { - + public 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" ?> @@ -93,11 +95,9 @@ END:VCALENDAR $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'])); - } - } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/FreeBusyReportTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/FreeBusyReportTest.php index 7604c7f4c..3d4b36313 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/FreeBusyReportTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/FreeBusyReportTest.php @@ -1,15 +1,14 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV; use Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/CalDAV/Backend/Mock.php'; -require_once 'Sabre/HTTP/ResponseMock.php'; - -class FreeBusyReportTest extends \PHPUnit_Framework_TestCase { - +class FreeBusyReportTest extends \PHPUnit\Framework\TestCase +{ /** * @var Plugin */ @@ -19,8 +18,8 @@ class FreeBusyReportTest extends \PHPUnit_Framework_TestCase { */ protected $server; - function setUp() { - + public function setUp() + { $obj1 = <<<ics BEGIN:VCALENDAR BEGIN:VEVENT @@ -54,48 +53,44 @@ ics; $calendarData = [ 1 => [ 'obj1' => [ - 'calendarid' => 1, - 'uri' => 'event1.ics', + 'calendarid' => 1, + 'uri' => 'event1.ics', 'calendardata' => $obj1, ], 'obj2' => [ - 'calendarid' => 1, - 'uri' => 'event2.ics', - 'calendardata' => $obj2 + 'calendarid' => 1, + 'uri' => 'event2.ics', + 'calendardata' => $obj2, ], 'obj3' => [ - 'calendarid' => 1, - 'uri' => 'event3.ics', - 'calendardata' => $obj3 - ] + 'calendarid' => 1, + 'uri' => 'event3.ics', + 'calendardata' => $obj3, + ], ], ]; - $caldavBackend = new Backend\Mock([], $calendarData); $calendar = new Calendar($caldavBackend, [ - '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", + '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", ]); $this->server = new DAV\Server([$calendar]); - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_URI' => '/calendar', - ]); + $request = new HTTP\Request('GET', '/calendar'); $this->server->httpRequest = $request; $this->server->httpResponse = new HTTP\ResponseMock(); $this->plugin = new Plugin(); $this->server->addPlugin($this->plugin); - } - function testFreeBusyReport() { - + public function testFreeBusyReport() + { $reportXML = <<<XML <?xml version="1.0"?> <c:free-busy-query xmlns:c="urn:ietf:params:xml:ns:caldav"> @@ -108,17 +103,16 @@ XML; $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(false !== strpos($this->server->httpResponse->body, 'BEGIN:VFREEBUSY')); + $this->assertTrue(false !== strpos($this->server->httpResponse->body, '20111005T120000Z/20111005T130000Z')); + $this->assertTrue(false !== strpos($this->server->httpResponse->body, '20111006T100000Z/20111006T110000Z')); } /** - * @expectedException Sabre\DAV\Exception\BadRequest + * @expectedException \Sabre\DAV\Exception\BadRequest */ - function testFreeBusyReportNoTimeRange() { - + public function testFreeBusyReportNoTimeRange() + { $reportXML = <<<XML <?xml version="1.0"?> <c:free-busy-query xmlns:c="urn:ietf:params:xml:ns:caldav"> @@ -126,17 +120,14 @@ XML; XML; $report = $this->server->xml->parse($reportXML, null, $rootElem); - } /** - * @expectedException Sabre\DAV\Exception\NotImplemented + * @expectedException \Sabre\DAV\Exception\NotImplemented */ - function testFreeBusyReportWrongNode() { - - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_URI' => '/', - ]); + public function testFreeBusyReportWrongNode() + { + $request = new HTTP\Request('REPORT', '/'); $this->server->httpRequest = $request; $reportXML = <<<XML @@ -148,15 +139,15 @@ XML; $report = $this->server->xml->parse($reportXML, null, $rootElem); $this->plugin->report($rootElem, $report, null); - } /** - * @expectedException Sabre\DAV\Exception + * @expectedException \Sabre\DAV\Exception */ - function testFreeBusyReportNoACLPlugin() { - + public function testFreeBusyReportNoACLPlugin() + { $this->server = new DAV\Server(); + $this->server->httpRequest = new HTTP\Request('REPORT', '/'); $this->plugin = new Plugin(); $this->server->addPlugin($this->plugin); @@ -169,6 +160,5 @@ XML; $report = $this->server->xml->parse($reportXML, null, $rootElem); $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 5fd8d29a1..6cb2b609e 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php @@ -1,27 +1,29 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV; use Sabre\HTTP; /** - * This unittest is created to check if queries for time-range include the start timestamp or not + * This unittest is created to check if queries for time-range include the start timestamp or not. * * @copyright Copyright (C) fruux GmbH (https://fruux.com/) * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class GetEventsByTimerangeTest extends \Sabre\DAVServerTest { - +class GetEventsByTimerangeTest extends \Sabre\DAVServerTest +{ protected $setupCalDAV = true; protected $caldavCalendars = [ [ - 'id' => 1, - 'name' => 'Calendar', + 'id' => 1, + 'name' => 'Calendar', 'principaluri' => 'principals/user1', - 'uri' => 'calendar1', - ] + 'uri' => 'calendar1', + ], ]; protected $caldavCalendarObjects = [ @@ -45,14 +47,14 @@ END:VCALENDAR ], ]; - function testQueryTimerange() { - + public function testQueryTimerange() + { $request = new HTTP\Request( 'REPORT', '/calendars/user1/calendar1', [ 'Content-Type' => 'application/xml', - 'Depth' => '1', + 'Depth' => '1', ] ); @@ -75,8 +77,6 @@ END:VCALENDAR $response = $this->request($request); - $this->assertTrue(strpos($response->body, 'BEGIN:VCALENDAR') !== false); - + $this->assertTrue(false !== strpos($response->body, 'BEGIN:VCALENDAR')); } - } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/ICSExportPluginTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/ICSExportPluginTest.php index 75412577e..c139e5b5c 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/ICSExportPluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/ICSExportPluginTest.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV; use Sabre\DAV; @@ -7,14 +9,14 @@ use Sabre\DAVACL; use Sabre\HTTP; use Sabre\VObject; -class ICSExportPluginTest extends \Sabre\DAVServerTest { - +class ICSExportPluginTest extends \Sabre\DAVServerTest +{ protected $setupCalDAV = true; protected $icsExportPlugin; - function setUp() { - + public function setUp() + { parent::setUp(); $this->icsExportPlugin = new ICSExportPlugin(); $this->server->addPlugin( @@ -25,7 +27,7 @@ class ICSExportPluginTest extends \Sabre\DAVServerTest { 'principals/admin', 'UUID-123467', [ - '{DAV:}displayname' => 'Hello!', + '{DAV:}displayname' => 'Hello!', '{http://apple.com/ns/ical/}calendar-color' => '#AA0000FF', ] ); @@ -56,23 +58,20 @@ END:VTODO END:VCALENDAR ICS ); - - } - function testInit() { - + public function testInit() + { $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 testBeforeMethod() { - + public function testBeforeMethod() + { $request = new HTTP\Request( 'GET', '/calendars/admin/UUID-123467?export' @@ -89,15 +88,15 @@ ICS $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->assertTrue(false !== strpos((string) $obj->PRODID, DAV\Version::VERSION)); $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('Hello!', $obj->{'X-WR-CALNAME'}); + $this->assertEquals('#AA0000FF', $obj->{'X-APPLE-CALENDAR-COLOR'}); } - function testBeforeMethodNoVersion() { + public function testBeforeMethodNoVersion() + { $request = new HTTP\Request( 'GET', '/calendars/admin/UUID-123467?export' @@ -115,25 +114,23 @@ ICS $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->assertFalse(false !== strpos((string) $obj->PRODID, DAV\Version::VERSION)); $this->assertEquals(1, count($obj->VTIMEZONE)); $this->assertEquals(1, count($obj->VEVENT)); - } - function testBeforeMethodNoExport() { - + public function testBeforeMethodNoExport() + { $request = new HTTP\Request( 'GET', '/calendars/admin/UUID-123467' ); $response = new HTTP\Response(); $this->assertNull($this->icsExportPlugin->httpGet($request, $response)); - } - function testACLIntegrationBlocked() { - + public function testACLIntegrationBlocked() + { $aclPlugin = new DAVACL\Plugin(); $aclPlugin->allowUnauthenticatedAccess = false; $this->server->addPlugin( @@ -146,11 +143,10 @@ ICS ); $this->request($request, 403); - } - function testACLIntegrationNotBlocked() { - + public function testACLIntegrationNotBlocked() + { $aclPlugin = new DAVACL\Plugin(); $aclPlugin->allowUnauthenticatedAccess = false; $this->server->addPlugin( @@ -176,34 +172,31 @@ ICS $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->assertTrue(false !== strpos((string) $obj->PRODID, DAV\Version::VERSION)); $this->assertEquals(1, count($obj->VTIMEZONE)); $this->assertEquals(1, count($obj->VEVENT)); - } - function testBadStartParam() { - + public function testBadStartParam() + { $request = new HTTP\Request( 'GET', '/calendars/admin/UUID-123467?export&start=foo' ); $this->request($request, 400); - } - function testBadEndParam() { - + public function testBadEndParam() + { $request = new HTTP\Request( 'GET', '/calendars/admin/UUID-123467?export&end=foo' ); $this->request($request, 400); - } - function testFilterStartEnd() { - + public function testFilterStartEnd() + { $request = new HTTP\Request( 'GET', '/calendars/admin/UUID-123467?export&start=1&end=2' @@ -212,23 +205,21 @@ ICS $obj = VObject\Reader::read($response->getBody()); - $this->assertEquals(0, count($obj->VTIMEZONE)); - $this->assertEquals(0, count($obj->VEVENT)); - + $this->assertNull($obj->VTIMEZONE); + $this->assertNull($obj->VEVENT); } - function testExpandNoStart() { - + public function testExpandNoStart() + { $request = new HTTP\Request( 'GET', '/calendars/admin/UUID-123467?export&expand=1&end=2' ); $this->request($request, 400); - } - function testExpand() { - + public function testExpand() + { $request = new HTTP\Request( 'GET', '/calendars/admin/UUID-123467?export&start=1&end=2000000000&expand=1' @@ -237,13 +228,12 @@ ICS $obj = VObject\Reader::read($response->getBody()); - $this->assertEquals(0, count($obj->VTIMEZONE)); + $this->assertNull($obj->VTIMEZONE); $this->assertEquals(1, count($obj->VEVENT)); - } - function testJCal() { - + public function testJCal() + { $request = new HTTP\Request( 'GET', '/calendars/admin/UUID-123467?export', @@ -252,11 +242,10 @@ ICS $response = $this->request($request, 200); $this->assertEquals('application/calendar+json', $response->getHeader('Content-Type')); - } - function testJCalInUrl() { - + public function testJCalInUrl() + { $request = new HTTP\Request( 'GET', '/calendars/admin/UUID-123467?export&accept=jcal' @@ -264,11 +253,10 @@ ICS $response = $this->request($request, 200); $this->assertEquals('application/calendar+json', $response->getHeader('Content-Type')); - } - function testNegotiateDefault() { - + public function testNegotiateDefault() + { $request = new HTTP\Request( 'GET', '/calendars/admin/UUID-123467?export', @@ -277,11 +265,10 @@ ICS $response = $this->request($request, 200); $this->assertEquals('text/calendar', $response->getHeader('Content-Type')); - } - function testFilterComponentVEVENT() { - + public function testFilterComponentVEVENT() + { $request = new HTTP\Request( 'GET', '/calendars/admin/UUID-123467?export&componentType=VEVENT' @@ -292,12 +279,11 @@ ICS $obj = VObject\Reader::read($response->body); $this->assertEquals(1, count($obj->VTIMEZONE)); $this->assertEquals(1, count($obj->VEVENT)); - $this->assertEquals(0, count($obj->VTODO)); - + $this->assertNull($obj->VTODO); } - function testFilterComponentVTODO() { - + public function testFilterComponentVTODO() + { $request = new HTTP\Request( 'GET', '/calendars/admin/UUID-123467?export&componentType=VTODO' @@ -307,25 +293,23 @@ ICS $obj = VObject\Reader::read($response->body); - $this->assertEquals(0, count($obj->VTIMEZONE)); - $this->assertEquals(0, count($obj->VEVENT)); + $this->assertNull($obj->VTIMEZONE); + $this->assertNull($obj->VEVENT); $this->assertEquals(1, count($obj->VTODO)); - } - function testFilterComponentBadComponent() { - + public function testFilterComponentBadComponent() + { $request = new HTTP\Request( 'GET', '/calendars/admin/UUID-123467?export&componentType=VVOODOO' ); $response = $this->request($request, 400); - } - function testContentDisposition() { - + public function testContentDisposition() + { $request = new HTTP\Request( 'GET', '/calendars/admin/UUID-123467?export' @@ -334,14 +318,13 @@ ICS $response = $this->request($request, 200); $this->assertEquals('text/calendar', $response->getHeader('Content-Type')); $this->assertEquals( - 'attachment; filename="UUID-123467-' . date('Y-m-d') . '.ics"', + 'attachment; filename="UUID-123467-'.date('Y-m-d').'.ics"', $response->getHeader('Content-Disposition') ); - } - function testContentDispositionJson() { - + public function testContentDispositionJson() + { $request = new HTTP\Request( 'GET', '/calendars/admin/UUID-123467?export', @@ -351,19 +334,18 @@ ICS $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"', + 'attachment; filename="UUID-123467-'.date('Y-m-d').'.json"', $response->getHeader('Content-Disposition') ); - } - function testContentDispositionBadChars() { - + public function testContentDispositionBadChars() + { $this->caldavBackend->createCalendar( 'principals/admin', 'UUID-b_ad"(ch)ars', [ - '{DAV:}displayname' => 'Test bad characters', + '{DAV:}displayname' => 'Test bad characters', '{http://apple.com/ns/ical/}calendar-color' => '#AA0000FF', ] ); @@ -377,10 +359,8 @@ ICS $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"', + '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 a1a9b7c04..02d39fe84 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue166Test.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue166Test.php @@ -1,13 +1,15 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV; use Sabre\VObject; -class Issue166Test extends \PHPUnit_Framework_TestCase { - - function testFlaw() { - +class Issue166Test extends \PHPUnit\Framework\TestCase +{ + public function testFlaw() + { $input = <<<HI BEGIN:VCALENDAR PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN @@ -38,26 +40,24 @@ HI; $validator = new CalendarQueryValidator(); $filters = [ - 'name' => 'VCALENDAR', + 'name' => 'VCALENDAR', 'comp-filters' => [ [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [], + 'name' => 'VEVENT', + 'comp-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => [ + 'time-range' => [ 'start' => new \DateTime('2011-12-01'), - 'end' => new \DateTime('2012-02-01'), + 'end' => new \DateTime('2012-02-01'), ], ], ], - 'prop-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => null, + 'time-range' => null, ]; $input = VObject\Reader::read($input); $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 e2b85c2bc..83120fe6a 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue172Test.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue172Test.php @@ -1,13 +1,16 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV; use Sabre\VObject; -class Issue172Test extends \PHPUnit_Framework_TestCase { - +class Issue172Test extends \PHPUnit\Framework\TestCase +{ // DateTimeZone() native name: America/Los_Angeles (GMT-8 in January) - function testBuiltInTimezoneName() { + public function testBuiltInTimezoneName() + { $input = <<<HI BEGIN:VCALENDAR VERSION:2.0 @@ -19,16 +22,16 @@ END:VCALENDAR HI; $validator = new CalendarQueryValidator(); $filters = [ - 'name' => 'VCALENDAR', + 'name' => 'VCALENDAR', 'comp-filters' => [ [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [], + 'name' => 'VEVENT', + 'comp-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => [ + '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'), + 'end' => new \DateTime('2012-01-18 21:00:00 GMT-08:00'), ], ], ], @@ -39,7 +42,8 @@ HI; } // Pacific Standard Time, translates to America/Los_Angeles (GMT-8 in January) - function testOutlookTimezoneName() { + public function testOutlookTimezoneName() + { $input = <<<HI BEGIN:VCALENDAR VERSION:2.0 @@ -66,16 +70,16 @@ END:VCALENDAR HI; $validator = new CalendarQueryValidator(); $filters = [ - 'name' => 'VCALENDAR', + 'name' => 'VCALENDAR', 'comp-filters' => [ [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [], + 'name' => 'VEVENT', + 'comp-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => [ + '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'), + 'end' => new \DateTime('2012-01-13 10:30:00 GMT-08:00'), ], ], ], @@ -86,7 +90,8 @@ HI; } // X-LIC-LOCATION, translates to America/Los_Angeles (GMT-8 in January) - function testLibICalLocationName() { + public function testLibICalLocationName() + { $input = <<<HI BEGIN:VCALENDAR VERSION:2.0 @@ -114,16 +119,16 @@ END:VCALENDAR HI; $validator = new CalendarQueryValidator(); $filters = [ - 'name' => 'VCALENDAR', + 'name' => 'VCALENDAR', 'comp-filters' => [ [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [], + 'name' => 'VEVENT', + 'comp-filters' => [], + 'prop-filters' => [], 'is-not-defined' => false, - 'time-range' => [ + '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'), + 'end' => new \DateTime('2012-01-13 10:30:00 GMT-08:00'), ], ], ], diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue203Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue203Test.php index 369e9a70c..0700024cf 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue203Test.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue203Test.php @@ -1,28 +1,30 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV; use Sabre\HTTP; use Sabre\VObject; /** - * This unittest is created to find out why an overwritten DAILY event has wrong DTSTART, DTEND, SUMMARY and RECURRENCEID + * This unittest is created to find out why an overwritten DAILY event has wrong DTSTART, DTEND, SUMMARY and RECURRENCEID. * * @copyright Copyright (C) fruux GmbH (https://fruux.com/) * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Issue203Test extends \Sabre\DAVServerTest { - +class Issue203Test extends \Sabre\DAVServerTest +{ protected $setupCalDAV = true; protected $caldavCalendars = [ [ - 'id' => 1, - 'name' => 'Calendar', + 'id' => 1, + 'name' => 'Calendar', 'principaluri' => 'principals/user1', - 'uri' => 'calendar1', - ] + 'uri' => 'calendar1', + ], ]; protected $caldavCalendarObjects = [ @@ -56,13 +58,13 @@ END:VCALENDAR ], ]; - function testIssue203() { - + public function testIssue203() + { $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" ?> @@ -96,24 +98,22 @@ END:VCALENDAR $this->assertEquals(2, count($vObject->VEVENT)); - $expectedEvents = [ [ 'DTSTART' => '20120326T135200Z', - 'DTEND' => '20120326T145200Z', + 'DTEND' => '20120326T145200Z', 'SUMMARY' => 'original summary', ], [ - 'DTSTART' => '20120328T135200Z', - 'DTEND' => '20120328T145200Z', - 'SUMMARY' => 'overwritten summary', + 'DTSTART' => '20120328T135200Z', + 'DTEND' => '20120328T145200Z', + 'SUMMARY' => 'overwritten summary', 'RECURRENCE-ID' => '20120327T135200Z', - ] + ], ]; // try to match agains $expectedEvents array foreach ($expectedEvents as $expectedEvent) { - $matching = false; foreach ($vObject->VEVENT as $vevent) { @@ -131,7 +131,7 @@ END:VCALENDAR break; } - $this->assertTrue($matching, 'Did not find the following event in the response: ' . var_export($expectedEvent, true)); + $this->assertTrue($matching, 'Did not find the following event in the response: '.var_export($expectedEvent, true)); } } } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue205Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue205Test.php index ce40a90b0..60c944d1d 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue205Test.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue205Test.php @@ -1,28 +1,30 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV; use Sabre\HTTP; use Sabre\VObject; /** - * This unittest is created to check if a VALARM TRIGGER of PT0S is supported + * This unittest is created to check if a VALARM TRIGGER of PT0S is supported. * * @copyright Copyright (C) fruux GmbH (https://fruux.com/) * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Issue205Test extends \Sabre\DAVServerTest { - +class Issue205Test extends \Sabre\DAVServerTest +{ protected $setupCalDAV = true; protected $caldavCalendars = [ [ - 'id' => 1, - 'name' => 'Calendar', + 'id' => 1, + 'name' => 'Calendar', 'principaluri' => 'principals/user1', - 'uri' => 'calendar1', - ] + 'uri' => 'calendar1', + ], ]; protected $caldavCalendarObjects = [ @@ -49,13 +51,13 @@ END:VCALENDAR ], ]; - function testIssue205() { - + public function testIssue205() + { $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" ?> @@ -79,8 +81,8 @@ END:VCALENDAR $response = $this->request($request); - $this->assertFalse(strpos($response->body, '<s:exception>Exception</s:exception>'), 'Exception occurred: ' . $response->body); - $this->assertFalse(strpos($response->body, 'Unknown or bad format'), 'DateTime unknown format Exception: ' . $response->body); + $this->assertFalse(strpos($response->body, '<s:exception>Exception</s:exception>'), 'Exception occurred: '.$response->body); + $this->assertFalse(strpos($response->body, 'Unknown or bad format'), 'DateTime unknown format Exception: '.$response->body); // Everts super awesome xml parser. $body = substr( @@ -93,6 +95,5 @@ END:VCALENDAR $vObject = VObject\Reader::read($body); $this->assertEquals(1, count($vObject->VEVENT)); - } } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue211Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue211Test.php index 950629fd8..10c9af50c 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue211Test.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue211Test.php @@ -1,27 +1,29 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV; use Sabre\HTTP; /** - * This unittest is created to check for an endless loop in Sabre\CalDAV\CalendarQueryValidator + * This unittest is created to check for an endless loop in Sabre\CalDAV\CalendarQueryValidator. * * @copyright Copyright (C) fruux GmbH (https://fruux.com/) * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Issue211Test extends \Sabre\DAVServerTest { - +class Issue211Test extends \Sabre\DAVServerTest +{ protected $setupCalDAV = true; protected $caldavCalendars = [ [ - 'id' => 1, - 'name' => 'Calendar', + 'id' => 1, + 'name' => 'Calendar', 'principaluri' => 'principals/user1', - 'uri' => 'calendar1', - ] + 'uri' => 'calendar1', + ], ]; protected $caldavCalendarObjects = [ @@ -53,13 +55,13 @@ END:VCALENDAR ], ]; - function testIssue211() { - + public function testIssue211() + { $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" ?> @@ -84,6 +86,5 @@ END:VCALENDAR // if this assert is reached, the endless loop is gone // There should be no matching events $this->assertFalse(strpos('BEGIN:VEVENT', $response->body)); - } } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue220Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue220Test.php index c3c0b5b48..46f5ca205 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue220Test.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue220Test.php @@ -1,27 +1,29 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV; use Sabre\HTTP; /** - * This unittest is created to check for an endless loop in CalendarQueryValidator + * This unittest is created to check for an endless loop in CalendarQueryValidator. * * @copyright Copyright (C) fruux GmbH (https://fruux.com/) * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Issue220Test extends \Sabre\DAVServerTest { - +class Issue220Test extends \Sabre\DAVServerTest +{ protected $setupCalDAV = true; protected $caldavCalendars = [ [ - 'id' => 1, - 'name' => 'Calendar', + 'id' => 1, + 'name' => 'Calendar', 'principaluri' => 'principals/user1', - 'uri' => 'calendar1', - ] + 'uri' => 'calendar1', + ], ]; protected $caldavCalendarObjects = [ @@ -63,13 +65,13 @@ END:VCALENDAR ], ]; - function testIssue220() { - + public function testIssue220() + { $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" ?> @@ -91,8 +93,8 @@ END:VCALENDAR $response = $this->request($request); - $this->assertFalse(strpos($response->body, '<s:exception>PHPUnit_Framework_Error_Warning</s:exception>'), 'Error Warning occurred: ' . $response->body); - $this->assertFalse(strpos($response->body, 'Invalid argument supplied for foreach()'), 'Invalid argument supplied for foreach(): ' . $response->body); + $this->assertFalse(strpos($response->body, '<s:exception>PHPUnit_Framework_Error_Warning</s:exception>'), 'Error Warning occurred: '.$response->body); + $this->assertFalse(strpos($response->body, 'Invalid argument supplied for foreach()'), 'Invalid argument supplied for foreach(): '.$response->body); $this->assertEquals(207, $response->status); } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue228Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue228Test.php index d0783701d..a8b855ca3 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue228Test.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue228Test.php @@ -1,27 +1,29 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV; use Sabre\HTTP; /** - * This unittest is created to check if the time-range filter is working correctly with all-day-events + * This unittest is created to check if the time-range filter is working correctly with all-day-events. * * @copyright Copyright (C) fruux GmbH (https://fruux.com/) * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Issue228Test extends \Sabre\DAVServerTest { - +class Issue228Test extends \Sabre\DAVServerTest +{ protected $setupCalDAV = true; protected $caldavCalendars = [ [ - 'id' => 1, - 'name' => 'Calendar', + 'id' => 1, + 'name' => 'Calendar', 'principaluri' => 'principals/user1', - 'uri' => 'calendar1', - ] + 'uri' => 'calendar1', + ], ]; protected $caldavCalendarObjects = [ @@ -43,13 +45,13 @@ END:VCALENDAR ], ]; - function testIssue228() { - + public function testIssue228() + { $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" ?> @@ -74,6 +76,5 @@ END:VCALENDAR // We must check if absolutely nothing was returned from this query. $this->assertFalse(strpos($response->body, 'BEGIN:VCALENDAR')); - } } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/CollectionTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/CollectionTest.php index 6585f85c3..eceb0b87f 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/CollectionTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/CollectionTest.php @@ -1,58 +1,56 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV\Notifications; use Sabre\CalDAV; -class CollectionTest extends \PHPUnit_Framework_TestCase { - +class CollectionTest extends \PHPUnit\Framework\TestCase +{ protected $caldavBackend; protected $principalUri; protected $notification; - function getInstance() { - + public function getInstance() + { $this->principalUri = 'principals/user1'; $this->notification = new CalDAV\Xml\Notification\SystemStatus(1, '"1"'); $this->caldavBackend = new CalDAV\Backend\MockSharing([], [], [ 'principals/user1' => [ - $this->notification - ] + $this->notification, + ], ]); return new Collection($this->caldavBackend, $this->principalUri); - } - function testGetChildren() { - + public function testGetChildren() + { $col = $this->getInstance(); $this->assertEquals('notifications', $col->getName()); $this->assertEquals([ - new Node($this->caldavBackend, $this->principalUri, $this->notification) + new Node($this->caldavBackend, $this->principalUri, $this->notification), ], $col->getChildren()); - } - function testGetOwner() { - + public function testGetOwner() + { $col = $this->getInstance(); $this->assertEquals('principals/user1', $col->getOwner()); - } - function testGetGroup() { - + public function testGetGroup() + { $col = $this->getInstance(); $this->assertNull($col->getGroup()); - } - function testGetACL() { - + public function testGetACL() + { $col = $this->getInstance(); $expected = [ [ @@ -63,23 +61,20 @@ class CollectionTest extends \PHPUnit_Framework_TestCase { ]; $this->assertEquals($expected, $col->getACL()); - } /** * @expectedException \Sabre\DAV\Exception\Forbidden */ - function testSetACL() { - + public function testSetACL() + { $col = $this->getInstance(); $col->setACL([]); - } - function testGetSupportedPrivilegeSet() { - + public function testGetSupportedPrivilegeSet() + { $col = $this->getInstance(); $this->assertNull($col->getSupportedPrivilegeSet()); - } } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/NodeTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/NodeTest.php index 6c6e02da8..cb19ef962 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/NodeTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/NodeTest.php @@ -1,69 +1,66 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV\Notifications; use Sabre\CalDAV; -class NodeTest extends \PHPUnit_Framework_TestCase { - +class NodeTest extends \PHPUnit\Framework\TestCase +{ protected $systemStatus; protected $caldavBackend; - function getInstance() { - + public function getInstance() + { $principalUri = 'principals/user1'; $this->systemStatus = new CalDAV\Xml\Notification\SystemStatus(1, '"1"'); $this->caldavBackend = new CalDAV\Backend\MockSharing([], [], [ 'principals/user1' => [ - $this->systemStatus - ] + $this->systemStatus, + ], ]); $node = new Node($this->caldavBackend, 'principals/user1', $this->systemStatus); - return $node; + return $node; } - function testGetId() { - + public function testGetId() + { $node = $this->getInstance(); - $this->assertEquals($this->systemStatus->getId() . '.xml', $node->getName()); - + $this->assertEquals($this->systemStatus->getId().'.xml', $node->getName()); } - function testGetEtag() { - + public function testGetEtag() + { $node = $this->getInstance(); $this->assertEquals('"1"', $node->getETag()); - } - function testGetNotificationType() { - + public function testGetNotificationType() + { $node = $this->getInstance(); $this->assertEquals($this->systemStatus, $node->getNotificationType()); - } - function testDelete() { - + public function testDelete() + { $node = $this->getInstance(); $node->delete(); $this->assertEquals([], $this->caldavBackend->getNotificationsForPrincipal('principals/user1')); - } - function testGetGroup() { - + public function testGetGroup() + { $node = $this->getInstance(); $this->assertNull($node->getGroup()); - } - function testGetACL() { - + public function testGetACL() + { $node = $this->getInstance(); $expected = [ [ @@ -74,23 +71,20 @@ class NodeTest extends \PHPUnit_Framework_TestCase { ]; $this->assertEquals($expected, $node->getACL()); - } /** * @expectedException \Sabre\DAV\Exception\Forbidden */ - function testSetACL() { - + public function testSetACL() + { $node = $this->getInstance(); $node->setACL([]); - } - function testGetSupportedPrivilegeSet() { - + public function testGetSupportedPrivilegeSet() + { $node = $this->getInstance(); $this->assertNull($node->getSupportedPrivilegeSet()); - } } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php index 859f6aa0c..711cc0ac7 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV; use DateTime; @@ -8,8 +10,8 @@ use Sabre\DAV; use Sabre\DAVACL; use Sabre\HTTP; -class PluginTest extends \PHPUnit_Framework_TestCase { - +class PluginTest extends \PHPUnit\Framework\TestCase +{ /** * @var DAV\Server */ @@ -24,37 +26,37 @@ class PluginTest extends \PHPUnit_Framework_TestCase { */ protected $caldavBackend; - function setup() { - + public function setup() + { $caldavNS = '{urn:ietf:params:xml:ns:caldav}'; $this->caldavBackend = new Backend\Mock([ [ - 'id' => 1, - 'uri' => 'UUID-123467', - 'principaluri' => 'principals/user1', - '{DAV:}displayname' => 'user1 calendar', - $caldavNS . 'calendar-description' => 'Calendar description', - '{http://apple.com/ns/ical/}calendar-order' => '1', - '{http://apple.com/ns/ical/}calendar-color' => '#FF0000', - $caldavNS . 'supported-calendar-component-set' => new Xml\Property\SupportedCalendarComponentSet(['VEVENT', 'VTODO']), + 'id' => 1, + 'uri' => 'UUID-123467', + 'principaluri' => 'principals/user1', + '{DAV:}displayname' => 'user1 calendar', + $caldavNS.'calendar-description' => 'Calendar description', + '{http://apple.com/ns/ical/}calendar-order' => '1', + '{http://apple.com/ns/ical/}calendar-color' => '#FF0000', + $caldavNS.'supported-calendar-component-set' => new Xml\Property\SupportedCalendarComponentSet(['VEVENT', 'VTODO']), ], [ - 'id' => 2, - 'uri' => 'UUID-123468', - 'principaluri' => 'principals/user1', - '{DAV:}displayname' => 'user1 calendar2', - $caldavNS . 'calendar-description' => 'Calendar description', - '{http://apple.com/ns/ical/}calendar-order' => '1', - '{http://apple.com/ns/ical/}calendar-color' => '#FF0000', - $caldavNS . 'supported-calendar-component-set' => new Xml\Property\SupportedCalendarComponentSet(['VEVENT', 'VTODO']), - ] + 'id' => 2, + 'uri' => 'UUID-123468', + 'principaluri' => 'principals/user1', + '{DAV:}displayname' => 'user1 calendar2', + $caldavNS.'calendar-description' => 'Calendar description', + '{http://apple.com/ns/ical/}calendar-order' => '1', + '{http://apple.com/ns/ical/}calendar-color' => '#FF0000', + $caldavNS.'supported-calendar-component-set' => new Xml\Property\SupportedCalendarComponentSet(['VEVENT', 'VTODO']), + ], ], [ 1 => [ 'UUID-2345' => [ 'calendardata' => TestUtil::getTestCalendarData(), - ] - ] + ], + ], ]); $principalBackend = new DAVACL\PrincipalBackend\Mock(); $principalBackend->setGroupMemberSet('principals/admin/calendar-proxy-read', ['principals/user1']); @@ -89,41 +91,45 @@ class PluginTest extends \PHPUnit_Framework_TestCase { $authBackend = new DAV\Auth\Backend\Mock(); $authBackend->setPrincipal('principals/user1'); $authPlugin = new DAV\Auth\Plugin($authBackend); - $authPlugin->beforeMethod(new \Sabre\HTTP\Request(), new \Sabre\HTTP\Response()); + $authPlugin->beforeMethod(new \Sabre\HTTP\Request('GET', '/'), new \Sabre\HTTP\Response()); $this->server->addPlugin($authPlugin); // This forces a login - $authPlugin->beforeMethod(new HTTP\Request(), new HTTP\Response()); + $authPlugin->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response()); $this->response = new HTTP\ResponseMock(); $this->server->httpResponse = $this->response; - } - function testSimple() { - + public function testSimple() + { $this->assertEquals(['MKCALENDAR'], $this->plugin->getHTTPMethods('calendars/user1/randomnewcalendar')); $this->assertEquals(['calendar-access', 'calendar-proxy'], $this->plugin->getFeatures()); $this->assertEquals( 'caldav', $this->plugin->getPluginInfo()['name'] ); - } - function testUnknownMethodPassThrough() { - + public function testUnknownMethodPassThrough() + { $request = new HTTP\Request('MKBREAKFAST', '/'); $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(501, $this->response->status, 'Incorrect status returned. Full response body:' . $this->response->body); - + $this->assertEquals(501, $this->response->status, 'Incorrect status returned. Full response body:'.$this->response->body); } - function testReportPassThrough() { + public function testGetWithoutContentType() + { + $request = new HTTP\Request('GET', '/'); + $this->plugin->httpAfterGet($request, $this->response); + $this->assertTrue(true); + } + public function testReportPassThrough() + { $request = new HTTP\Request('REPORT', '/', ['Content-Type' => 'application/xml']); $request->setBody('<?xml version="1.0"?><s:somereport xmlns:s="http://www.rooftopsolutions.nl/NS/example" />'); @@ -131,11 +137,10 @@ class PluginTest extends \PHPUnit_Framework_TestCase { $this->server->exec(); $this->assertEquals(415, $this->response->status); - } - function testMkCalendarBadLocation() { - + public function testMkCalendarBadLocation() + { $request = new HTTP\Request('MKCALENDAR', '/blabla'); $body = '<?xml version="1.0" encoding="utf-8" ?> @@ -181,11 +186,10 @@ class PluginTest extends \PHPUnit_Framework_TestCase { $this->server->exec(); $this->assertEquals(403, $this->response->status); - } - function testMkCalendarNoParentNode() { - + public function testMkCalendarNoParentNode() + { $request = new HTTP\Request('MKCALENDAR', '/doesntexist/calendar'); $body = '<?xml version="1.0" encoding="utf-8" ?> @@ -231,14 +235,13 @@ class PluginTest extends \PHPUnit_Framework_TestCase { $this->server->exec(); $this->assertEquals(409, $this->response->status); - } - function testMkCalendarExistingCalendar() { - + public function testMkCalendarExistingCalendar() + { $request = HTTP\Sapi::createFromServerArray([ 'REQUEST_METHOD' => 'MKCALENDAR', - 'REQUEST_URI' => '/calendars/user1/UUID-123467', + 'REQUEST_URI' => '/calendars/user1/UUID-123467', ]); $body = '<?xml version="1.0" encoding="utf-8" ?> @@ -284,11 +287,10 @@ class PluginTest extends \PHPUnit_Framework_TestCase { $this->server->exec(); $this->assertEquals(405, $this->response->status); - } - function testMkCalendarSucceed() { - + public function testMkCalendarSucceed() + { $request = new HTTP\Request('MKCALENDAR', '/calendars/user1/NEWCALENDAR'); $timezone = 'BEGIN:VCALENDAR @@ -325,7 +327,7 @@ END:VCALENDAR'; <C:supported-calendar-component-set> <C:comp name="VEVENT"/> </C:supported-calendar-component-set> - <C:calendar-timezone><![CDATA[' . $timezone . ']]></C:calendar-timezone> + <C:calendar-timezone><![CDATA['.$timezone.']]></C:calendar-timezone> </D:prop> </D:set> </C:mkcalendar>'; @@ -334,89 +336,87 @@ END:VCALENDAR'; $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(201, $this->response->status, 'Invalid response code received. Full response body: ' . $this->response->body); + $this->assertEquals(201, $this->response->status, 'Invalid response code received. Full response body: '.$this->response->body); $calendars = $this->caldavBackend->getCalendarsForUser('principals/user1'); $this->assertEquals(3, count($calendars)); $newCalendar = null; foreach ($calendars as $calendar) { - if ($calendar['uri'] === 'NEWCALENDAR') { + if ('NEWCALENDAR' === $calendar['uri']) { $newCalendar = $calendar; break; - } + } } $this->assertInternalType('array', $newCalendar); $keys = [ - 'uri' => 'NEWCALENDAR', - 'id' => null, - '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'Calendar restricted to events.', - '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => $timezone, - '{DAV:}displayname' => 'Lisa\'s Events', + 'uri' => 'NEWCALENDAR', + 'id' => null, + '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'Calendar restricted to events.', + '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => $timezone, + '{DAV:}displayname' => 'Lisa\'s Events', '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => null, ]; foreach ($keys as $key => $value) { - $this->assertArrayHasKey($key, $newCalendar); - if (is_null($value)) continue; + if (is_null($value)) { + continue; + } $this->assertEquals($value, $newCalendar[$key]); - } $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; $this->assertTrue($newCalendar[$sccs] instanceof Xml\Property\SupportedCalendarComponentSet); $this->assertEquals(['VEVENT'], $newCalendar[$sccs]->getValue()); - } - function testMkCalendarEmptyBodySucceed() { - + public function testMkCalendarEmptyBodySucceed() + { $request = new HTTP\Request('MKCALENDAR', '/calendars/user1/NEWCALENDAR'); $request->setBody(''); $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(201, $this->response->status, 'Invalid response code received. Full response body: ' . $this->response->body); + $this->assertEquals(201, $this->response->status, 'Invalid response code received. Full response body: '.$this->response->body); $calendars = $this->caldavBackend->getCalendarsForUser('principals/user1'); $this->assertEquals(3, count($calendars)); $newCalendar = null; foreach ($calendars as $calendar) { - if ($calendar['uri'] === 'NEWCALENDAR') { + if ('NEWCALENDAR' === $calendar['uri']) { $newCalendar = $calendar; break; - } + } } $this->assertInternalType('array', $newCalendar); $keys = [ - 'uri' => 'NEWCALENDAR', - 'id' => null, + 'uri' => 'NEWCALENDAR', + 'id' => null, '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => null, ]; foreach ($keys as $key => $value) { - $this->assertArrayHasKey($key, $newCalendar); - if (is_null($value)) continue; + if (is_null($value)) { + continue; + } $this->assertEquals($value, $newCalendar[$key]); - } $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; $this->assertTrue($newCalendar[$sccs] instanceof Xml\Property\SupportedCalendarComponentSet); $this->assertEquals(['VEVENT', 'VTODO'], $newCalendar[$sccs]->getValue()); - } - function testMkCalendarBadXml() { - + public function testMkCalendarBadXml() + { $request = new HTTP\Request('MKCALENDAR', '/blabla'); $body = 'This is not xml'; @@ -425,26 +425,24 @@ END:VCALENDAR'; $this->server->exec(); $this->assertEquals(400, $this->response->status); - } - function testPrincipalProperties() { - + public function testPrincipalProperties() + { $httpRequest = new HTTP\Request('FOO', '/blabla', ['Host' => 'sabredav.org']); $this->server->httpRequest = $httpRequest; $props = $this->server->getPropertiesForPath('/principals/user1', [ - '{' . Plugin::NS_CALDAV . '}calendar-home-set', - '{' . Plugin::NS_CALENDARSERVER . '}calendar-proxy-read-for', - '{' . Plugin::NS_CALENDARSERVER . '}calendar-proxy-write-for', - '{' . Plugin::NS_CALENDARSERVER . '}notification-URL', - '{' . Plugin::NS_CALENDARSERVER . '}email-address-set', + '{'.Plugin::NS_CALDAV.'}calendar-home-set', + '{'.Plugin::NS_CALENDARSERVER.'}calendar-proxy-read-for', + '{'.Plugin::NS_CALENDARSERVER.'}calendar-proxy-write-for', + '{'.Plugin::NS_CALENDARSERVER.'}notification-URL', + '{'.Plugin::NS_CALENDARSERVER.'}email-address-set', ]); $this->assertArrayHasKey(0, $props); $this->assertArrayHasKey(200, $props[0]); - $this->assertArrayHasKey('{urn:ietf:params:xml:ns:caldav}calendar-home-set', $props[0][200]); $prop = $props[0][200]['{urn:ietf:params:xml:ns:caldav}calendar-home-set']; $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $prop); @@ -460,15 +458,14 @@ END:VCALENDAR'; $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $prop); $this->assertEquals(['principals/admin/'], $prop->getHrefs()); - $this->assertArrayHasKey('{' . Plugin::NS_CALENDARSERVER . '}email-address-set', $props[0][200]); - $prop = $props[0][200]['{' . Plugin::NS_CALENDARSERVER . '}email-address-set']; + $this->assertArrayHasKey('{'.Plugin::NS_CALENDARSERVER.'}email-address-set', $props[0][200]); + $prop = $props[0][200]['{'.Plugin::NS_CALENDARSERVER.'}email-address-set']; $this->assertInstanceOf('Sabre\\CalDAV\\Xml\\Property\\EmailAddressSet', $prop); $this->assertEquals(['user1.sabredav@sabredav.org'], $prop->getValue()); - } - function testSupportedReportSetPropertyNonCalendar() { - + public function testSupportedReportSetPropertyNonCalendar() + { $props = $this->server->getPropertiesForPath('/calendars/user1', [ '{DAV:}supported-report-set', ]); @@ -487,14 +484,13 @@ END:VCALENDAR'; '{DAV:}principal-search-property-set', ]; $this->assertEquals($value, $prop->getValue()); - } /** * @depends testSupportedReportSetPropertyNonCalendar */ - function testSupportedReportSetProperty() { - + public function testSupportedReportSetProperty() + { $props = $this->server->getPropertiesForPath('/calendars/user1/UUID-123467', [ '{DAV:}supported-report-set', ]); @@ -513,14 +509,13 @@ END:VCALENDAR'; '{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()); - } - function testSupportedReportSetUserCalendars() { - + public function testSupportedReportSetUserCalendars() + { $this->server->addPlugin(new \Sabre\DAV\Sync\Plugin()); $props = $this->server->getPropertiesForPath('/calendars/user1', [ @@ -542,22 +537,21 @@ END:VCALENDAR'; '{DAV:}principal-search-property-set', ]; $this->assertEquals($value, $prop->getValue()); - } /** * @depends testSupportedReportSetProperty */ - function testCalendarMultiGetReport() { - + public function testCalendarMultiGetReport() + { $body = - '<?xml version="1.0"?>' . - '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' . - '<d:prop>' . - ' <c:calendar-data />' . - ' <d:getetag />' . - '</d:prop>' . - '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>' . + '<?xml version="1.0"?>'. + '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. + '<d:prop>'. + ' <c:calendar-data />'. + ' <d:getetag />'. + '</d:prop>'. + '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>'. '</c:calendar-multiget>'; $request = new HTTP\Request('REPORT', '/calendars/user1', ['Depth' => '1']); @@ -587,24 +581,23 @@ END:VCALENDAR'; XML; $this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString()); - } /** * @depends testCalendarMultiGetReport */ - function testCalendarMultiGetReportExpand() { - + public function testCalendarMultiGetReportExpand() + { $body = - '<?xml version="1.0"?>' . - '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' . - '<d:prop>' . - ' <c:calendar-data>' . - ' <c:expand start="20110101T000000Z" end="20111231T235959Z" />' . - ' </c:calendar-data>' . - ' <d:getetag />' . - '</d:prop>' . - '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>' . + '<?xml version="1.0"?>'. + '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. + '<d:prop>'. + ' <c:calendar-data>'. + ' <c:expand start="20110101T000000Z" end="20111231T235959Z" />'. + ' </c:calendar-data>'. + ' <d:getetag />'. + '</d:prop>'. + '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>'. '</c:calendar-multiget>'; $request = new HTTP\Request('REPORT', '/calendars/user1', ['Depth' => '1']); @@ -613,7 +606,7 @@ XML; $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(207, $this->response->status, 'Invalid HTTP status received. Full response body: ' . $this->response->body); + $this->assertEquals(207, $this->response->status, 'Invalid HTTP status received. Full response body: '.$this->response->body); $expectedIcal = TestUtil::getTestCalendarData(); $expectedIcal = \Sabre\VObject\Reader::read($expectedIcal); @@ -640,29 +633,28 @@ XML; XML; $this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString()); - } /** * @depends testSupportedReportSetProperty * @depends testCalendarMultiGetReport */ - function testCalendarQueryReport() { - + public function testCalendarQueryReport() + { $body = - '<?xml version="1.0"?>' . - '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' . - '<d:prop>' . - ' <c:calendar-data>' . - ' <c:expand start="20000101T000000Z" end="20101231T235959Z" />' . - ' </c:calendar-data>' . - ' <d:getetag />' . - '</d:prop>' . - '<c:filter>' . - ' <c:comp-filter name="VCALENDAR">' . - ' <c:comp-filter name="VEVENT" />' . - ' </c:comp-filter>' . - '</c:filter>' . + '<?xml version="1.0"?>'. + '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. + '<d:prop>'. + ' <c:calendar-data>'. + ' <c:expand start="20000101T000000Z" end="20101231T235959Z" />'. + ' </c:calendar-data>'. + ' <d:getetag />'. + '</d:prop>'. + '<c:filter>'. + ' <c:comp-filter name="VCALENDAR">'. + ' <c:comp-filter name="VEVENT" />'. + ' </c:comp-filter>'. + '</c:filter>'. '</c:calendar-query>'; $request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467', ['Depth' => '1']); @@ -671,7 +663,7 @@ XML; $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: ' . $this->response->body); + $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->body); $expectedIcal = TestUtil::getTestCalendarData(); $expectedIcal = \Sabre\VObject\Reader::read($expectedIcal); @@ -698,33 +690,32 @@ XML; XML; $this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString()); - } /** * @depends testSupportedReportSetProperty * @depends testCalendarMultiGetReport */ - function testCalendarQueryReportWindowsPhone() { - + public function testCalendarQueryReportWindowsPhone() + { $body = - '<?xml version="1.0"?>' . - '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' . - '<d:prop>' . - ' <c:calendar-data>' . - ' <c:expand start="20000101T000000Z" end="20101231T235959Z" />' . - ' </c:calendar-data>' . - ' <d:getetag />' . - '</d:prop>' . - '<c:filter>' . - ' <c:comp-filter name="VCALENDAR">' . - ' <c:comp-filter name="VEVENT" />' . - ' </c:comp-filter>' . - '</c:filter>' . + '<?xml version="1.0"?>'. + '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. + '<d:prop>'. + ' <c:calendar-data>'. + ' <c:expand start="20000101T000000Z" end="20101231T235959Z" />'. + ' </c:calendar-data>'. + ' <d:getetag />'. + '</d:prop>'. + '<c:filter>'. + ' <c:comp-filter name="VCALENDAR">'. + ' <c:comp-filter name="VEVENT" />'. + ' </c:comp-filter>'. + '</c:filter>'. '</c:calendar-query>'; $request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467', [ - 'Depth' => '0', + 'Depth' => '0', 'User-Agent' => 'MSFT-WP/8.10.14219 (gzip)', ]); @@ -733,7 +724,7 @@ XML; $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: ' . $this->response->body); + $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->body); $expectedIcal = TestUtil::getTestCalendarData(); $expectedIcal = \Sabre\VObject\Reader::read($expectedIcal); @@ -760,29 +751,28 @@ XML; XML; $this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString()); - } /** * @depends testSupportedReportSetProperty * @depends testCalendarMultiGetReport */ - function testCalendarQueryReportBadDepth() { - + public function testCalendarQueryReportBadDepth() + { $body = - '<?xml version="1.0"?>' . - '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' . - '<d:prop>' . - ' <c:calendar-data>' . - ' <c:expand start="20000101T000000Z" end="20101231T235959Z" />' . - ' </c:calendar-data>' . - ' <d:getetag />' . - '</d:prop>' . - '<c:filter>' . - ' <c:comp-filter name="VCALENDAR">' . - ' <c:comp-filter name="VEVENT" />' . - ' </c:comp-filter>' . - '</c:filter>' . + '<?xml version="1.0"?>'. + '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. + '<d:prop>'. + ' <c:calendar-data>'. + ' <c:expand start="20000101T000000Z" end="20101231T235959Z" />'. + ' </c:calendar-data>'. + ' <d:getetag />'. + '</d:prop>'. + '<c:filter>'. + ' <c:comp-filter name="VCALENDAR">'. + ' <c:comp-filter name="VEVENT" />'. + ' </c:comp-filter>'. + '</c:filter>'. '</c:calendar-query>'; $request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467', [ @@ -793,26 +783,25 @@ XML; $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(400, $this->response->status, 'Received an unexpected status. Full response body: ' . $this->response->body); - + $this->assertEquals(400, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->body); } /** * @depends testCalendarQueryReport */ - function testCalendarQueryReportNoCalData() { - + public function testCalendarQueryReportNoCalData() + { $body = - '<?xml version="1.0"?>' . - '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' . - '<d:prop>' . - ' <d:getetag />' . - '</d:prop>' . - '<c:filter>' . - ' <c:comp-filter name="VCALENDAR">' . - ' <c:comp-filter name="VEVENT" />' . - ' </c:comp-filter>' . - '</c:filter>' . + '<?xml version="1.0"?>'. + '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. + '<d:prop>'. + ' <d:getetag />'. + '</d:prop>'. + '<c:filter>'. + ' <c:comp-filter name="VCALENDAR">'. + ' <c:comp-filter name="VEVENT" />'. + ' </c:comp-filter>'. + '</c:filter>'. '</c:calendar-query>'; $request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467', [ @@ -823,7 +812,7 @@ XML; $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: ' . $this->response->body); + $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->body); $expected = <<<XML <?xml version="1.0"?> @@ -841,21 +830,20 @@ XML; XML; $this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString()); - } /** * @depends testCalendarQueryReport */ - function testCalendarQueryReportNoFilters() { - + public function testCalendarQueryReportNoFilters() + { $body = - '<?xml version="1.0"?>' . - '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' . - '<d:prop>' . - ' <c:calendar-data />' . - ' <d:getetag />' . - '</d:prop>' . + '<?xml version="1.0"?>'. + '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. + '<d:prop>'. + ' <c:calendar-data />'. + ' <d:getetag />'. + '</d:prop>'. '</c:calendar-query>'; $request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467'); @@ -864,30 +852,29 @@ XML; $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(400, $this->response->status, 'Received an unexpected status. Full response body: ' . $this->response->body); - + $this->assertEquals(400, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->body); } /** * @depends testSupportedReportSetProperty * @depends testCalendarMultiGetReport */ - function testCalendarQueryReport1Object() { - + public function testCalendarQueryReport1Object() + { $body = - '<?xml version="1.0"?>' . - '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' . - '<d:prop>' . - ' <c:calendar-data>' . - ' <c:expand start="20000101T000000Z" end="20101231T235959Z" />' . - ' </c:calendar-data>' . - ' <d:getetag />' . - '</d:prop>' . - '<c:filter>' . - ' <c:comp-filter name="VCALENDAR">' . - ' <c:comp-filter name="VEVENT" />' . - ' </c:comp-filter>' . - '</c:filter>' . + '<?xml version="1.0"?>'. + '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. + '<d:prop>'. + ' <c:calendar-data>'. + ' <c:expand start="20000101T000000Z" end="20101231T235959Z" />'. + ' </c:calendar-data>'. + ' <d:getetag />'. + '</d:prop>'. + '<c:filter>'. + ' <c:comp-filter name="VCALENDAR">'. + ' <c:comp-filter name="VEVENT" />'. + ' </c:comp-filter>'. + '</c:filter>'. '</c:calendar-query>'; $request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467/UUID-2345', ['Depth' => '0']); @@ -896,7 +883,7 @@ XML; $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: ' . $this->response->body); + $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->body); $expectedIcal = TestUtil::getTestCalendarData(); $expectedIcal = \Sabre\VObject\Reader::read($expectedIcal); @@ -923,26 +910,25 @@ XML; XML; $this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString()); - } /** * @depends testSupportedReportSetProperty * @depends testCalendarMultiGetReport */ - function testCalendarQueryReport1ObjectNoCalData() { - + public function testCalendarQueryReport1ObjectNoCalData() + { $body = - '<?xml version="1.0"?>' . - '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' . - '<d:prop>' . - ' <d:getetag />' . - '</d:prop>' . - '<c:filter>' . - ' <c:comp-filter name="VCALENDAR">' . - ' <c:comp-filter name="VEVENT" />' . - ' </c:comp-filter>' . - '</c:filter>' . + '<?xml version="1.0"?>'. + '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. + '<d:prop>'. + ' <d:getetag />'. + '</d:prop>'. + '<c:filter>'. + ' <c:comp-filter name="VCALENDAR">'. + ' <c:comp-filter name="VEVENT" />'. + ' </c:comp-filter>'. + '</c:filter>'. '</c:calendar-query>'; $request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467/UUID-2345', ['Depth' => '0']); @@ -951,7 +937,7 @@ XML; $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: ' . $this->response->body); + $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->body); $expected = <<<XML <?xml version="1.0"?> @@ -969,34 +955,32 @@ XML; XML; $this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString()); - } - function testHTMLActionsPanel() { - + public function testHTMLActionsPanel() + { $output = ''; $r = $this->server->emit('onHTMLActionsPanel', [$this->server->tree->getNodeForPath('calendars/user1'), &$output]); $this->assertFalse($r); - $this->assertTrue(!!strpos($output, 'Display name')); - + $this->assertTrue((bool) strpos($output, 'Display name')); } /** * @depends testCalendarMultiGetReport */ - function testCalendarMultiGetReportNoEnd() { - + public function testCalendarMultiGetReportNoEnd() + { $body = - '<?xml version="1.0"?>' . - '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' . - '<d:prop>' . - ' <c:calendar-data>' . - ' <c:expand start="20110101T000000Z" />' . - ' </c:calendar-data>' . - ' <d:getetag />' . - '</d:prop>' . - '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>' . + '<?xml version="1.0"?>'. + '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. + '<d:prop>'. + ' <c:calendar-data>'. + ' <c:expand start="20110101T000000Z" />'. + ' </c:calendar-data>'. + ' <d:getetag />'. + '</d:prop>'. + '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>'. '</c:calendar-multiget>'; $request = new HTTP\Request('REPORT', '/calendars/user1', ['Depth' => '1']); @@ -1005,25 +989,24 @@ XML; $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(400, $this->response->status, 'Invalid HTTP status received. Full response body: ' . $this->response->body); - + $this->assertEquals(400, $this->response->status, 'Invalid HTTP status received. Full response body: '.$this->response->body); } /** * @depends testCalendarMultiGetReport */ - function testCalendarMultiGetReportNoStart() { - + public function testCalendarMultiGetReportNoStart() + { $body = - '<?xml version="1.0"?>' . - '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' . - '<d:prop>' . - ' <c:calendar-data>' . - ' <c:expand end="20110101T000000Z" />' . - ' </c:calendar-data>' . - ' <d:getetag />' . - '</d:prop>' . - '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>' . + '<?xml version="1.0"?>'. + '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. + '<d:prop>'. + ' <c:calendar-data>'. + ' <c:expand end="20110101T000000Z" />'. + ' </c:calendar-data>'. + ' <d:getetag />'. + '</d:prop>'. + '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>'. '</c:calendar-multiget>'; $request = new HTTP\Request('REPORT', '/calendars/user1', ['Depth' => '1']); @@ -1032,25 +1015,24 @@ XML; $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(400, $this->response->status, 'Invalid HTTP status received. Full response body: ' . $this->response->body); - + $this->assertEquals(400, $this->response->status, 'Invalid HTTP status received. Full response body: '.$this->response->body); } /** * @depends testCalendarMultiGetReport */ - function testCalendarMultiGetReportEndBeforeStart() { - + public function testCalendarMultiGetReportEndBeforeStart() + { $body = - '<?xml version="1.0"?>' . - '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' . - '<d:prop>' . - ' <c:calendar-data>' . - ' <c:expand start="20200101T000000Z" end="20110101T000000Z" />' . - ' </c:calendar-data>' . - ' <d:getetag />' . - '</d:prop>' . - '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>' . + '<?xml version="1.0"?>'. + '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. + '<d:prop>'. + ' <c:calendar-data>'. + ' <c:expand start="20200101T000000Z" end="20110101T000000Z" />'. + ' </c:calendar-data>'. + ' <d:getetag />'. + '</d:prop>'. + '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>'. '</c:calendar-multiget>'; $request = new HTTP\Request('REPORT', '/calendars/user1', ['Depth' => '1']); @@ -1059,28 +1041,25 @@ XML; $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(400, $this->response->status, 'Invalid HTTP status received. Full response body: ' . $this->response->body); - + $this->assertEquals(400, $this->response->status, 'Invalid HTTP status received. Full response body: '.$this->response->body); } /** * @depends testSupportedReportSetPropertyNonCalendar */ - function testCalendarProperties() { - + public function testCalendarProperties() + { $ns = '{urn:ietf:params:xml:ns:caldav}'; $props = $this->server->getProperties('calendars/user1/UUID-123467', [ - $ns . 'max-resource-size', - $ns . 'supported-calendar-data', - $ns . 'supported-collation-set', + $ns.'max-resource-size', + $ns.'supported-calendar-data', + $ns.'supported-collation-set', ]); $this->assertEquals([ - $ns . 'max-resource-size' => 10000000, - $ns . 'supported-calendar-data' => new Xml\Property\SupportedCalendarData(), - $ns . 'supported-collation-set' => new Xml\Property\SupportedCollationSet(), + $ns.'max-resource-size' => 10000000, + $ns.'supported-calendar-data' => new Xml\Property\SupportedCalendarData(), + $ns.'supported-collation-set' => new Xml\Property\SupportedCollationSet(), ], $props); - } - } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/CollectionTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/CollectionTest.php index 23c248825..277de0664 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/CollectionTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/CollectionTest.php @@ -1,20 +1,20 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV\Principal; use Sabre\DAVACL; -class CollectionTest extends \PHPUnit_Framework_TestCase { - - function testGetChildForPrincipal() { - +class CollectionTest extends \PHPUnit\Framework\TestCase +{ + public function testGetChildForPrincipal() + { $back = new DAVACL\PrincipalBackend\Mock(); $col = new Collection($back); $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 fe07f0131..8036635b2 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyReadTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyReadTest.php @@ -1,102 +1,95 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV\Principal; use Sabre\DAVACL; -class ProxyReadTest extends \PHPUnit_Framework_TestCase { - +class ProxyReadTest extends \PHPUnit\Framework\TestCase +{ protected $backend; - function getInstance() { - + public function getInstance() + { $backend = new DAVACL\PrincipalBackend\Mock(); $principal = new ProxyRead($backend, [ 'uri' => 'principal/user', ]); $this->backend = $backend; - return $principal; - } - - function testGetName() { + return $principal; + } + public function testGetName() + { $i = $this->getInstance(); $this->assertEquals('calendar-proxy-read', $i->getName()); - } - function testGetDisplayName() { + public function testGetDisplayName() + { $i = $this->getInstance(); $this->assertEquals('calendar-proxy-read', $i->getDisplayName()); - } - function testGetLastModified() { - + public function testGetLastModified() + { $i = $this->getInstance(); $this->assertNull($i->getLastModified()); - } /** - * @expectedException Sabre\DAV\Exception\Forbidden + * @expectedException \Sabre\DAV\Exception\Forbidden */ - function testDelete() { - + public function testDelete() + { $i = $this->getInstance(); $i->delete(); - } /** - * @expectedException Sabre\DAV\Exception\Forbidden + * @expectedException \Sabre\DAV\Exception\Forbidden */ - function testSetName() { - + public function testSetName() + { $i = $this->getInstance(); $i->setName('foo'); - } - function testGetAlternateUriSet() { - + public function testGetAlternateUriSet() + { $i = $this->getInstance(); $this->assertEquals([], $i->getAlternateUriSet()); - } - function testGetPrincipalUri() { - + public function testGetPrincipalUri() + { $i = $this->getInstance(); $this->assertEquals('principal/user/calendar-proxy-read', $i->getPrincipalUrl()); - } - function testGetGroupMemberSet() { - + public function testGetGroupMemberSet() + { $i = $this->getInstance(); $this->assertEquals([], $i->getGroupMemberSet()); - } - function testGetGroupMembership() { - + public function testGetGroupMembership() + { $i = $this->getInstance(); $this->assertEquals([], $i->getGroupMembership()); - } - function testSetGroupMemberSet() { - + public function testSetGroupMemberSet() + { $i = $this->getInstance(); $i->setGroupMemberSet(['principals/foo']); $expected = [ - $i->getPrincipalUrl() => ['principals/foo'] + $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 6cdb9b30e..df1715ee5 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyWriteTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyWriteTest.php @@ -1,40 +1,39 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV\Principal; use Sabre\DAVACL; -class ProxyWriteTest extends ProxyReadTest { - - function getInstance() { - +class ProxyWriteTest extends ProxyReadTest +{ + public function getInstance() + { $backend = new DAVACL\PrincipalBackend\Mock(); $principal = new ProxyWrite($backend, [ 'uri' => 'principal/user', ]); $this->backend = $backend; - return $principal; + return $principal; } - function testGetName() { - + public function testGetName() + { $i = $this->getInstance(); $this->assertEquals('calendar-proxy-write', $i->getName()); - } - function testGetDisplayName() { + public function testGetDisplayName() + { $i = $this->getInstance(); $this->assertEquals('calendar-proxy-write', $i->getDisplayName()); - } - function testGetPrincipalUri() { - + public function testGetPrincipalUri() + { $i = $this->getInstance(); $this->assertEquals('principal/user/calendar-proxy-write', $i->getPrincipalUrl()); - } - } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/UserTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/UserTest.php index 420bb3b1a..2c690c65d 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/UserTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/UserTest.php @@ -1,13 +1,15 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV\Principal; use Sabre\DAVACL; -class UserTest extends \PHPUnit_Framework_TestCase { - - function getInstance() { - +class UserTest extends \PHPUnit\Framework\TestCase +{ + public function getInstance() + { $backend = new DAVACL\PrincipalBackend\Mock(); $backend->addPrincipal([ 'uri' => 'principals/user/calendar-proxy-read', @@ -18,89 +20,81 @@ class UserTest extends \PHPUnit_Framework_TestCase { $backend->addPrincipal([ 'uri' => 'principals/user/random', ]); + return new User($backend, [ 'uri' => 'principals/user', ]); - } /** - * @expectedException Sabre\DAV\Exception\Forbidden + * @expectedException \Sabre\DAV\Exception\Forbidden */ - function testCreateFile() { - + public function testCreateFile() + { $u = $this->getInstance(); $u->createFile('test'); - } /** - * @expectedException Sabre\DAV\Exception\Forbidden + * @expectedException \Sabre\DAV\Exception\Forbidden */ - function testCreateDirectory() { - + public function testCreateDirectory() + { $u = $this->getInstance(); $u->createDirectory('test'); - } - function testGetChildProxyRead() { - + public function testGetChildProxyRead() + { $u = $this->getInstance(); $child = $u->getChild('calendar-proxy-read'); $this->assertInstanceOf('Sabre\\CalDAV\\Principal\\ProxyRead', $child); - } - function testGetChildProxyWrite() { - + public function testGetChildProxyWrite() + { $u = $this->getInstance(); $child = $u->getChild('calendar-proxy-write'); $this->assertInstanceOf('Sabre\\CalDAV\\Principal\\ProxyWrite', $child); - } /** - * @expectedException Sabre\DAV\Exception\NotFound + * @expectedException \Sabre\DAV\Exception\NotFound */ - function testGetChildNotFound() { - + public function testGetChildNotFound() + { $u = $this->getInstance(); $child = $u->getChild('foo'); - } /** - * @expectedException Sabre\DAV\Exception\NotFound + * @expectedException \Sabre\DAV\Exception\NotFound */ - function testGetChildNotFound2() { - + public function testGetChildNotFound2() + { $u = $this->getInstance(); $child = $u->getChild('random'); - } - function testGetChildren() { - + public function testGetChildren() + { $u = $this->getInstance(); $children = $u->getChildren(); $this->assertEquals(2, count($children)); $this->assertInstanceOf('Sabre\\CalDAV\\Principal\\ProxyRead', $children[0]); $this->assertInstanceOf('Sabre\\CalDAV\\Principal\\ProxyWrite', $children[1]); - } - function testChildExist() { - + public function testChildExist() + { $u = $this->getInstance(); $this->assertTrue($u->childExists('calendar-proxy-read')); $this->assertTrue($u->childExists('calendar-proxy-write')); $this->assertFalse($u->childExists('foo')); - } - function testGetACL() { - + public function testGetACL() + { $expected = [ [ 'privilege' => '{DAV:}all', @@ -121,7 +115,5 @@ class UserTest extends \PHPUnit_Framework_TestCase { $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 04d4b1237..df70fe7ec 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Schedule/OutboxTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Schedule/OutboxTest.php @@ -1,14 +1,15 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV\Schedule; use Sabre\CalDAV; -use Sabre\DAV; - -class OutboxTest extends \PHPUnit_Framework_TestCase { - - function testSetup() { +class OutboxTest extends \PHPUnit\Framework\TestCase +{ + public function testSetup() + { $outbox = new Outbox('principals/user1'); $this->assertEquals('outbox', $outbox->getName()); $this->assertEquals([], $outbox->getChildren()); @@ -17,7 +18,7 @@ class OutboxTest extends \PHPUnit_Framework_TestCase { $this->assertEquals([ [ - 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-send', + 'privilege' => '{'.CalDAV\Plugin::NS_CALDAV.'}schedule-send', 'principal' => 'principals/user1', 'protected' => true, ], @@ -27,7 +28,7 @@ class OutboxTest extends \PHPUnit_Framework_TestCase { 'protected' => true, ], [ - 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-send', + 'privilege' => '{'.CalDAV\Plugin::NS_CALDAV.'}schedule-send', 'principal' => 'principals/user1/calendar-proxy-write', 'protected' => true, ], @@ -42,7 +43,5 @@ class OutboxTest extends \PHPUnit_Framework_TestCase { 'protected' => true, ], ], $outbox->getACL()); - } - } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/SharedCalendarTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/SharedCalendarTest.php index f71c19523..735bbef41 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/SharedCalendarTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/SharedCalendarTest.php @@ -1,24 +1,26 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV; use Sabre\DAV\Sharing; use Sabre\DAV\Xml\Element\Sharee; -class SharedCalendarTest extends \PHPUnit_Framework_TestCase { - +class SharedCalendarTest extends \PHPUnit\Framework\TestCase +{ protected $backend; - function getInstance(array $props = null) { - + public function getInstance(array $props = null) + { if (is_null($props)) { $props = [ - 'id' => 1, + '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, - 'share-access' => Sharing\Plugin::ACCESS_READWRITE, - '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', ]; } @@ -35,11 +37,10 @@ class SharedCalendarTest extends \PHPUnit_Framework_TestCase { $this->backend->updateInvites(1, [$sharee]); return new SharedCalendar($this->backend, $props); - } - function testGetInvites() { - + public function testGetInvites() + { $sharee = new Sharee(); $sharee->href = 'mailto:removeme@example.org'; $sharee->properties['{DAV:}displayname'] = 'To be removed'; @@ -50,15 +51,15 @@ class SharedCalendarTest extends \PHPUnit_Framework_TestCase { [$sharee], $this->getInstance()->getInvites() ); - } - function testGetOwner() { + public function testGetOwner() + { $this->assertEquals('principals/sharee', $this->getInstance()->getOwner()); } - function testGetACL() { - + public function testGetACL() + { $expected = [ [ 'privilege' => '{DAV:}write', @@ -96,18 +97,17 @@ class SharedCalendarTest extends \PHPUnit_Framework_TestCase { 'protected' => true, ], [ - 'privilege' => '{' . Plugin::NS_CALDAV . '}read-free-busy', + 'privilege' => '{'.Plugin::NS_CALDAV.'}read-free-busy', 'principal' => '{DAV:}authenticated', 'protected' => true, ], ]; $this->assertEquals($expected, $this->getInstance()->getACL()); - } - function testGetChildACL() { - + public function testGetChildACL() + { $expected = [ [ 'privilege' => '{DAV:}write', @@ -134,19 +134,17 @@ class SharedCalendarTest extends \PHPUnit_Framework_TestCase { 'principal' => 'principals/sharee/calendar-proxy-read', 'protected' => true, ], - ]; $this->assertEquals($expected, $this->getInstance()->getChildACL()); - } - function testUpdateInvites() { - + public function testUpdateInvites() + { $instance = $this->getInstance(); $newSharees = [ new Sharee(), - new Sharee() + new Sharee(), ]; $newSharees[0]->href = 'mailto:test@example.org'; $newSharees[0]->properties['{DAV:}displayname'] = 'Foo Bar'; @@ -159,18 +157,16 @@ class SharedCalendarTest extends \PHPUnit_Framework_TestCase { $instance->updateInvites($newSharees); $expected = [ - clone $newSharees[0] + clone $newSharees[0], ]; $expected[0]->inviteStatus = Sharing\Plugin::INVITE_NORESPONSE; $this->assertEquals($expected, $instance->getInvites()); - } - function testPublish() { - + public function testPublish() + { $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 9589176a3..57732cd06 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/SharingPluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/SharingPluginTest.php @@ -1,36 +1,38 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV; use Sabre\DAV; use Sabre\DAV\Xml\Element\Sharee; use Sabre\HTTP; -class SharingPluginTest extends \Sabre\DAVServerTest { - +class SharingPluginTest extends \Sabre\DAVServerTest +{ protected $setupCalDAV = true; protected $setupCalDAVSharing = true; protected $setupACL = true; protected $autoLogin = 'user1'; - function setUp() { - + public function setUp() + { $this->caldavCalendars = [ [ 'principaluri' => 'principals/user1', - 'id' => 1, - 'uri' => 'cal1', + 'id' => 1, + 'uri' => 'cal1', ], [ 'principaluri' => 'principals/user1', - 'id' => 2, - 'uri' => 'cal2', + 'id' => 2, + 'uri' => 'cal2', 'share-access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE, ], [ 'principaluri' => 'principals/user1', - 'id' => 3, - 'uri' => 'cal3', + 'id' => 3, + 'uri' => 'cal3', ], ]; @@ -38,86 +40,79 @@ class SharingPluginTest extends \Sabre\DAVServerTest { // Making the logged in user an admin, for full access: $this->aclPlugin->adminPrincipals[] = 'principals/user2'; - } - function testSimple() { - + public function testSimple() + { $this->assertInstanceOf('Sabre\\CalDAV\\SharingPlugin', $this->server->getPlugin('caldav-sharing')); $this->assertEquals( 'caldav-sharing', $this->caldavSharingPlugin->getPluginInfo()['name'] ); - } /** * @expectedException \LogicException */ - function testSetupWithoutCoreSharingPlugin() { - + public function testSetupWithoutCoreSharingPlugin() + { $server = new DAV\Server(); $server->addPlugin( new SharingPlugin() ); - } - function testGetFeatures() { - + public function testGetFeatures() + { $this->assertEquals(['calendarserver-sharing'], $this->caldavSharingPlugin->getFeatures()); - } - function testBeforeGetShareableCalendar() { - + public function testBeforeGetShareableCalendar() + { // Forcing the server to authenticate: - $this->authPlugin->beforeMethod(new HTTP\Request(), new HTTP\Response()); + $this->authPlugin->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response()); $props = $this->server->getProperties('calendars/user1/cal1', [ - '{' . Plugin::NS_CALENDARSERVER . '}invite', - '{' . Plugin::NS_CALENDARSERVER . '}allowed-sharing-modes', + '{'.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']); - + $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']); } - function testBeforeGetSharedCalendar() { - + public function testBeforeGetSharedCalendar() + { $props = $this->server->getProperties('calendars/user1/cal2', [ - '{' . Plugin::NS_CALENDARSERVER . '}shared-url', - '{' . Plugin::NS_CALENDARSERVER . '}invite', + '{'.Plugin::NS_CALENDARSERVER.'}shared-url', + '{'.Plugin::NS_CALENDARSERVER.'}invite', ]); - $this->assertInstanceOf('Sabre\\CalDAV\\Xml\\Property\\Invite', $props['{' . 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']); - } - function testUpdateResourceType() { - + public function testUpdateResourceType() + { $this->caldavBackend->updateInvites(1, [ new Sharee([ 'href' => 'mailto:joe@example.org', - ]) + ]), ] ); $result = $this->server->updateProperties('calendars/user1/cal1', [ - '{DAV:}resourcetype' => new DAV\Xml\Property\ResourceType(['{DAV:}collection']) + '{DAV:}resourcetype' => new DAV\Xml\Property\ResourceType(['{DAV:}collection']), ]); $this->assertEquals([ - '{DAV:}resourcetype' => 200 + '{DAV:}resourcetype' => 200, ], $result); $this->assertEquals(0, count($this->caldavBackend->getInvites(1))); - } - function testUpdatePropertiesPassThru() { - + public function testUpdatePropertiesPassThru() + { $result = $this->server->updateProperties('calendars/user1/cal3', [ '{DAV:}foo' => 'bar', ]); @@ -125,52 +120,48 @@ class SharingPluginTest extends \Sabre\DAVServerTest { $this->assertEquals([ '{DAV:}foo' => 200, ], $result); - } - function testUnknownMethodNoPOST() { - + public function testUnknownMethodNoPOST() + { $request = HTTP\Sapi::createFromServerArray([ 'REQUEST_METHOD' => 'PATCH', - 'REQUEST_URI' => '/', + 'REQUEST_URI' => '/', ]); $response = $this->request($request); $this->assertEquals(501, $response->status, $response->body); - } - function testUnknownMethodNoXML() { - + public function testUnknownMethodNoXML() + { $request = HTTP\Sapi::createFromServerArray([ 'REQUEST_METHOD' => 'POST', - 'REQUEST_URI' => '/', - 'CONTENT_TYPE' => 'text/plain', + 'REQUEST_URI' => '/', + 'CONTENT_TYPE' => 'text/plain', ]); $response = $this->request($request); $this->assertEquals(501, $response->status, $response->body); - } - function testUnknownMethodNoNode() { - + public function testUnknownMethodNoNode() + { $request = HTTP\Sapi::createFromServerArray([ 'REQUEST_METHOD' => 'POST', - 'REQUEST_URI' => '/foo', - 'CONTENT_TYPE' => 'text/xml', + 'REQUEST_URI' => '/foo', + 'CONTENT_TYPE' => 'text/xml', ]); $response = $this->request($request); $this->assertEquals(501, $response->status, $response->body); - } - function testShareRequest() { - + public function testShareRequest() + { $request = new HTTP\Request('POST', '/calendars/user1/cal1', ['Content-Type' => 'text/xml']); $xml = <<<RRR @@ -194,13 +185,13 @@ RRR; $this->assertEquals( [ new Sharee([ - 'href' => 'mailto:joe@example.org', + 'href' => 'mailto:joe@example.org', 'properties' => [ '{DAV:}displayname' => 'Joe Shmoe', ], - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE, + 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE, 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_NORESPONSE, - 'comment' => '', + 'comment' => '', ]), ], $this->caldavBackend->getInvites(1) @@ -214,11 +205,10 @@ RRR; $this->assertTrue( $props['{DAV:}resourcetype']->is('{http://calendarserver.org/ns/}shared-owner') ); - } - function testShareRequestNoShareableCalendar() { - + public function testShareRequestNoShareableCalendar() + { $request = new HTTP\Request( 'POST', '/calendars/user1/cal2', @@ -226,7 +216,7 @@ RRR; ); $xml = '<?xml version="1.0"?> -<cs:share xmlns:cs="' . Plugin::NS_CALENDARSERVER . '" xmlns:d="DAV:"> +<cs:share xmlns:cs="'.Plugin::NS_CALENDARSERVER.'" xmlns:d="DAV:"> <cs:set> <d:href>mailto:joe@example.org</d:href> <cs:common-name>Joe Shmoe</cs:common-name> @@ -241,19 +231,18 @@ RRR; $request->setBody($xml); $response = $this->request($request, 403); - } - function testInviteReply() { - + public function testInviteReply() + { $request = HTTP\Sapi::createFromServerArray([ 'REQUEST_METHOD' => 'POST', - 'REQUEST_URI' => '/calendars/user1', - 'CONTENT_TYPE' => 'text/xml', + 'REQUEST_URI' => '/calendars/user1', + 'CONTENT_TYPE' => 'text/xml', ]); $xml = '<?xml version="1.0"?> -<cs:invite-reply xmlns:cs="' . Plugin::NS_CALENDARSERVER . '" xmlns:d="DAV:"> +<cs:invite-reply xmlns:cs="'.Plugin::NS_CALENDARSERVER.'" xmlns:d="DAV:"> <cs:hosturl><d:href>/principals/owner</d:href></cs:hosturl> <cs:invite-accepted /> </cs:invite-reply> @@ -262,37 +251,35 @@ RRR; $request->setBody($xml); $response = $this->request($request); $this->assertEquals(200, $response->status, $response->body); - } - function testInviteBadXML() { - + public function testInviteBadXML() + { $request = HTTP\Sapi::createFromServerArray([ 'REQUEST_METHOD' => 'POST', - 'REQUEST_URI' => '/calendars/user1', - 'CONTENT_TYPE' => 'text/xml', + 'REQUEST_URI' => '/calendars/user1', + 'CONTENT_TYPE' => 'text/xml', ]); $xml = '<?xml version="1.0"?> -<cs:invite-reply xmlns:cs="' . Plugin::NS_CALENDARSERVER . '" xmlns:d="DAV:"> +<cs:invite-reply xmlns:cs="'.Plugin::NS_CALENDARSERVER.'" xmlns:d="DAV:"> </cs:invite-reply> '; $request->setBody($xml); $response = $this->request($request); $this->assertEquals(400, $response->status, $response->body); - } - function testInviteWrongUrl() { - + public function testInviteWrongUrl() + { $request = HTTP\Sapi::createFromServerArray([ 'REQUEST_METHOD' => 'POST', - 'REQUEST_URI' => '/calendars/user1/cal1', - 'CONTENT_TYPE' => 'text/xml', + '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:"> +<cs:invite-reply xmlns:cs="'.Plugin::NS_CALENDARSERVER.'" xmlns:d="DAV:"> <cs:hosturl><d:href>/principals/owner</d:href></cs:hosturl> </cs:invite-reply> '; @@ -303,27 +290,33 @@ RRR; // If the plugin did not handle this request, it must ensure that the // body is still accessible by other plugins. $this->assertEquals($xml, $request->getBody(true)); - } - function testPublish() { + public function testPostWithoutContentType() + { + $request = new HTTP\Request('POST', '/'); + $response = new HTTP\ResponseMock(); + + $this->caldavSharingPlugin->httpPost($request, $response); + $this->assertTrue(true); + } + public function testPublish() + { $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:" /> +<cs:publish-calendar xmlns:cs="'.Plugin::NS_CALENDARSERVER.'" xmlns:d="DAV:" /> '; $request->setBody($xml); $response = $this->request($request); $this->assertEquals(202, $response->status, $response->body); - } - - function testUnpublish() { - + public function testUnpublish() + { $request = new HTTP\Request( 'POST', '/calendars/user1/cal1', @@ -331,18 +324,17 @@ RRR; ); $xml = '<?xml version="1.0"?> -<cs:unpublish-calendar xmlns:cs="' . Plugin::NS_CALENDARSERVER . '" xmlns:d="DAV:" /> +<cs:unpublish-calendar xmlns:cs="'.Plugin::NS_CALENDARSERVER.'" xmlns:d="DAV:" /> '; $request->setBody($xml); $response = $this->request($request); $this->assertEquals(200, $response->status, $response->body); - } - function testPublishWrongUrl() { - + public function testPublishWrongUrl() + { $request = new HTTP\Request( 'POST', '/calendars/user1', @@ -350,34 +342,31 @@ RRR; ); $xml = '<?xml version="1.0"?> -<cs:publish-calendar xmlns:cs="' . Plugin::NS_CALENDARSERVER . '" xmlns:d="DAV:" /> +<cs:publish-calendar xmlns:cs="'.Plugin::NS_CALENDARSERVER.'" xmlns:d="DAV:" /> '; $request->setBody($xml); $this->request($request, 501); - } - function testUnpublishWrongUrl() { - + public function testUnpublishWrongUrl() + { $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:" /> +<cs:unpublish-calendar xmlns:cs="'.Plugin::NS_CALENDARSERVER.'" xmlns:d="DAV:" /> '; $request->setBody($xml); $this->request($request, 501); - } - function testUnknownXmlDoc() { - - + public function testUnknownXmlDoc() + { $request = new HTTP\Request( 'POST', '/calendars/user1/cal2', @@ -385,12 +374,11 @@ RRR; ); $xml = '<?xml version="1.0"?> -<cs:foo-bar xmlns:cs="' . Plugin::NS_CALENDARSERVER . '" xmlns:d="DAV:" />'; +<cs:foo-bar xmlns:cs="'.Plugin::NS_CALENDARSERVER.'" xmlns:d="DAV:" />'; $request->setBody($xml); $response = $this->request($request); $this->assertEquals(501, $response->status, $response->body); - } } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/TestUtil.php b/vendor/sabre/dav/tests/Sabre/CalDAV/TestUtil.php index 673d39c0a..72b5080af 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/TestUtil.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/TestUtil.php @@ -1,39 +1,41 @@ <?php -namespace Sabre\CalDAV; - -class TestUtil { +declare(strict_types=1); - static function getBackend() { +namespace Sabre\CalDAV; +class TestUtil +{ + public static function getBackend() + { $backend = new Backend\Mock(); $calendarId = $backend->createCalendar( 'principals/user1', 'UUID-123467', [ - '{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', [ - '{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 $backend; + return $backend; } - static function getTestCalendarData($type = 1) { - + public static function getTestCalendarData($type = 1) + { $calendarData = 'BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Apple Inc.//iCal 4.0.1//EN @@ -62,108 +64,104 @@ SUMMARY:Something here DTSTAMP:20100228T130202Z'; switch ($type) { - case 1 : + case 1: $calendarData .= "\nDTSTART;TZID=Asia/Seoul:20100223T060000\nDTEND;TZID=Asia/Seoul:20100223T070000\n"; break; - case 2 : + case 2: $calendarData .= "\nDTSTART:20100223T060000\nDTEND:20100223T070000\n"; break; - case 3 : + case 3: $calendarData .= "\nDTSTART;VALUE=DATE:20100223\nDTEND;VALUE=DATE:20100223\n"; break; - case 4 : + case 4: $calendarData .= "\nDTSTART;TZID=Asia/Seoul:20100223T060000\nDURATION:PT1H\n"; break; - case 5 : + case 5: $calendarData .= "\nDTSTART;TZID=Asia/Seoul:20100223T060000\nDURATION:-P5D\n"; break; - case 6 : + case 6: $calendarData .= "\nDTSTART;VALUE=DATE:20100223\n"; break; - case 7 : + case 7: $calendarData .= "\nDTSTART;VALUE=DATETIME:20100223T060000\n"; break; // No DTSTART, so intentionally broken - case 'X' : + case 'X': $calendarData .= "\n"; break; } - $calendarData .= 'ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:lisa@example.com SEQUENCE:2 END:VEVENT END:VCALENDAR'; return $calendarData; - } - static function getTestTODO($type = 'due') { - + public static function getTestTODO($type = 'due') + { switch ($type) { - - case 'due' : - $extra = "DUE:20100104T000000Z"; + case 'due': + $extra = 'DUE:20100104T000000Z'; break; - case 'due2' : - $extra = "DUE:20060104T000000Z"; + case 'due2': + $extra = 'DUE:20060104T000000Z'; break; - case 'due_date' : - $extra = "DUE;VALUE=DATE:20060104"; + case 'due_date': + $extra = 'DUE;VALUE=DATE:20060104'; break; - case 'due_tz' : - $extra = "DUE;TZID=Asia/Seoul:20060104T000000Z"; + case 'due_tz': + $extra = 'DUE;TZID=Asia/Seoul:20060104T000000Z'; break; - case 'due_dtstart' : + case 'due_dtstart': $extra = "DTSTART:20050223T060000Z\nDUE:20060104T000000Z"; break; - case 'due_dtstart2' : + case 'due_dtstart2': $extra = "DTSTART:20090223T060000Z\nDUE:20100104T000000Z"; break; - case 'dtstart' : + case 'dtstart': $extra = 'DTSTART:20100223T060000Z'; break; - case 'dtstart2' : + case 'dtstart2': $extra = 'DTSTART:20060223T060000Z'; break; - case 'dtstart_date' : + case 'dtstart_date': $extra = 'DTSTART;VALUE=DATE:20100223'; break; - case 'dtstart_tz' : + case 'dtstart_tz': $extra = 'DTSTART;TZID=Asia/Seoul:20100223T060000Z'; break; - case 'dtstart_duration' : + case 'dtstart_duration': $extra = "DTSTART:20061023T060000Z\nDURATION:PT1H"; break; - case 'dtstart_duration2' : + case 'dtstart_duration2': $extra = "DTSTART:20101023T060000Z\nDURATION:PT1H"; break; - case 'completed' : + case 'completed': $extra = 'COMPLETED:20060601T000000Z'; break; - case 'completed2' : + case 'completed2': $extra = 'COMPLETED:20090601T000000Z'; break; - case 'created' : + case 'created': $extra = 'CREATED:20060601T000000Z'; break; - case 'created2' : + case 'created2': $extra = 'CREATED:20090601T000000Z'; break; - case 'completedcreated' : + case 'completedcreated': $extra = "CREATED:20060601T000000Z\nCOMPLETED:20070101T000000Z"; break; - case 'completedcreated2' : + case 'completedcreated2': $extra = "CREATED:20090601T000000Z\nCOMPLETED:20100101T000000Z"; break; - case 'notime' : + case 'notime': $extra = 'X-FILLER:oh hello'; break; - default : - throw new Exception('Unknown type: ' . $type); - + default: + throw new Exception('Unknown type: '.$type); } $todo = 'BEGIN:VCALENDAR @@ -171,7 +169,7 @@ VERSION:2.0 PRODID:-//Example Corp.//CalDAV Client//EN BEGIN:VTODO DTSTAMP:20060205T235335Z -' . $extra . ' +'.$extra.' STATUS:NEEDS-ACTION SUMMARY:Task #1 UID:DDDEEB7915FA61233B861457@example.com @@ -183,7 +181,5 @@ END:VTODO END:VCALENDAR'; return $todo; - } - } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/ValidateICalTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/ValidateICalTest.php index 629df90c1..e6d1edace 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/ValidateICalTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/ValidateICalTest.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV; use Sabre\DAV; @@ -8,8 +10,8 @@ use Sabre\HTTP; require_once 'Sabre/HTTP/ResponseMock.php'; -class ValidateICalTest extends \PHPUnit_Framework_TestCase { - +class ValidateICalTest extends \PHPUnit\Framework\TestCase +{ /** * @var Sabre\DAV\Server */ @@ -19,21 +21,21 @@ class ValidateICalTest extends \PHPUnit_Framework_TestCase { */ protected $calBackend; - function setUp() { - + public function setUp() + { $calendars = [ [ - 'id' => 'calendar1', - 'principaluri' => 'principals/admin', - 'uri' => 'calendar1', + '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', + '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, []); @@ -52,33 +54,30 @@ class ValidateICalTest extends \PHPUnit_Framework_TestCase { $response = new HTTP\ResponseMock(); $this->server->httpResponse = $response; - } - function request(HTTP\Request $request) { - + public function request(HTTP\Request $request) + { $this->server->httpRequest = $request; $this->server->exec(); return $this->server->httpResponse; - } - function testCreateFile() { - + public function testCreateFile() + { $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); $this->assertEquals(415, $response->status); - } - function testCreateFileValid() { - + public function testCreateFileValid() + { $request = new HTTP\Request( 'PUT', '/calendars/admin/calendar1/blabla.ics', @@ -101,26 +100,25 @@ ICS; $response = $this->request($request); - $this->assertEquals(201, $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'], - 'ETag' => ['"' . md5($ics) . '"'], + 'Content-Length' => ['0'], + 'ETag' => ['"'.md5($ics).'"'], ], $response->getHeaders()); $expected = [ - 'uri' => 'blabla.ics', + 'uri' => 'blabla.ics', 'calendardata' => $ics, - 'calendarid' => 'calendar1', + 'calendarid' => 'calendar1', 'lastmodified' => null, ]; $this->assertEquals($expected, $this->calBackend->getCalendarObject('calendar1', 'blabla.ics')); - } - function testCreateFileNoVersion() { - + public function testCreateFileNoVersion() + { $request = new HTTP\Request( 'PUT', '/calendars/admin/calendar1/blabla.ics', @@ -142,12 +140,11 @@ ICS; $response = $this->request($request); - $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: ' . $response->body); - + $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->body); } - function testCreateFileNoVersionFixed() { - + public function testCreateFileNoVersionFixed() + { $request = new HTTP\Request( 'PUT', '/calendars/admin/calendar1/blabla.ics', @@ -169,10 +166,10 @@ ICS; $response = $this->request($request); - $this->assertEquals(201, $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-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()); @@ -190,18 +187,17 @@ END:VCALENDAR\r ICS; $expected = [ - 'uri' => 'blabla.ics', + 'uri' => 'blabla.ics', 'calendardata' => $ics, - 'calendarid' => 'calendar1', + 'calendarid' => 'calendar1', 'lastmodified' => null, ]; $this->assertEquals($expected, $this->calBackend->getCalendarObject('calendar1', 'blabla.ics')); - } - function testCreateFileNoComponents() { - + public function testCreateFileNoComponents() + { $request = new HTTP\Request( 'PUT', '/calendars/admin/calendar1/blabla.ics', @@ -217,96 +213,89 @@ ICS; $request->setBody($ics); $response = $this->request($request); - $this->assertEquals(403, $response->status, 'Incorrect status returned! Full response body: ' . $response->body); - + $this->assertEquals(403, $response->status, 'Incorrect status returned! Full response body: '.$response->body); } - function testCreateFileNoUID() { - + public function testCreateFileNoUID() + { $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(415, $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() { - + public function testCreateFileVCard() + { $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); - $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: ' . $response->body); - + $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->body); } - function testCreateFile2Components() { - + public function testCreateFile2Components() + { $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(415, $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() { - + public function testCreateFile2UIDS() + { $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(415, $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() { - + public function testCreateFileWrongComponent() + { $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(403, $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() { - + public function testUpdateFile() + { $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); $this->assertEquals(415, $response->status); - } - function testUpdateFileParsableBody() { - + public function testUpdateFileParsableBody() + { $this->calBackend->createCalendarObject('calendar1', 'blabla.ics', 'foo'); $request = new HTTP\Request( 'PUT', @@ -330,43 +319,40 @@ ICS; $this->assertEquals(204, $response->status); $expected = [ - 'uri' => 'blabla.ics', + 'uri' => 'blabla.ics', 'calendardata' => $ics, - 'calendarid' => 'calendar1', + 'calendarid' => 'calendar1', 'lastmodified' => null, ]; $this->assertEquals($expected, $this->calBackend->getCalendarObject('calendar1', 'blabla.ics')); - } - function testCreateFileInvalidComponent() { - + public function testCreateFileInvalidComponent() + { $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); - $this->assertEquals(403, $response->status, 'Incorrect status returned! Full response body: ' . $response->body); - + $this->assertEquals(403, $response->status, 'Incorrect status returned! Full response body: '.$response->body); } - function testUpdateFileInvalidComponent() { - + public function testUpdateFileInvalidComponent() + { $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); - $this->assertEquals(403, $response->status, 'Incorrect status returned! Full response body: ' . $response->body); - + $this->assertEquals(403, $response->status, 'Incorrect status returned! Full response body: '.$response->body); } /** @@ -376,8 +362,8 @@ ICS; * More importantly. If any transformation happens, the etag must no longer * be returned by the server. */ - function testCreateFileModified() { - + public function testCreateFileModified() + { $request = new HTTP\Request( 'PUT', '/calendars/admin/calendar1/blabla.ics' @@ -399,8 +385,7 @@ ICS; $response = $this->request($request); - $this->assertEquals(201, $response->status, 'Incorrect status returned! Full response body: ' . $response->body); + $this->assertEquals(201, $response->status, 'Incorrect status returned! Full response body: '.$response->body); $this->assertNull($response->getHeader('ETag')); - } } |