diff options
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/CalDAV')
23 files changed, 170 insertions, 261 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php index 80de750dc..9460b8922 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php @@ -15,7 +15,7 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase protected $pdo; - public function setUp() + public function setup(): void { $this->dropTables([ 'calendarobjects', @@ -67,7 +67,7 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase 'share-access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, ]; - $this->assertInternalType('array', $calendars); + $this->assertIsArray($calendars); $this->assertEquals(1, count($calendars)); foreach ($elementCheck as $name => $value) { @@ -112,7 +112,7 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp('transparent'), ]; - $this->assertInternalType('array', $calendars); + $this->assertIsArray($calendars); $this->assertEquals(1, count($calendars)); foreach ($elementCheck as $name => $value) { @@ -123,10 +123,10 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase /** * @depends testConstruct - * @expectedException \InvalidArgumentException */ public function testUpdateCalendarBadId() { + $this->expectException('InvalidArgumentException'); $backend = new PDO($this->pdo); //Creating a new calendar @@ -186,10 +186,10 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase /** * @depends testCreateCalendarAndFetch - * @expectedException \InvalidArgumentException */ public function testDeleteCalendarBadID() { + $this->expectException('InvalidArgumentException'); $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']), @@ -201,10 +201,10 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase /** * @depends testCreateCalendarAndFetch - * @expectedException \Sabre\DAV\Exception */ public function testCreateCalendarIncorrectComponentSet() { + $this->expectException('Sabre\DAV\Exception'); $backend = new PDO($this->pdo); //Creating a new calendar @@ -276,7 +276,7 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase switch ($key) { case 'lastmodified': - $this->assertInternalType('int', $actual); + $this->assertIsInt($actual); break; case 'calendardata': if (is_resource($actual)) { @@ -292,20 +292,20 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase /** * @depends testGetMultipleObjects - * @expectedException \InvalidArgumentException */ public function testGetMultipleObjectsBadId() { + $this->expectException('InvalidArgumentException'); $backend = new PDO($this->pdo); $backend->getMultipleCalendarObjects('bad-id', ['foo-bar']); } /** - * @expectedException \Sabre\DAV\Exception\BadRequest * @depends testCreateCalendarObject */ public function testCreateCalendarObjectNoComponent() { + $this->expectException('Sabre\DAV\Exception\BadRequest'); $backend = new PDO($this->pdo); $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); @@ -345,10 +345,10 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase /** * @depends testCreateCalendarObject - * @expectedException \InvalidArgumentException */ public function testCreateCalendarObjectBadId() { + $this->expectException('InvalidArgumentException'); $backend = new PDO($this->pdo); $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); @@ -519,20 +519,20 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase /** * @depends testGetCalendarObjects - * @expectedException \InvalidArgumentException */ public function testGetCalendarObjectsBadId() { + $this->expectException('InvalidArgumentException'); $backend = new PDO($this->pdo); $backend->getCalendarObjects('bad-id'); } /** * @depends testGetCalendarObjects - * @expectedException \InvalidArgumentException */ public function testGetCalendarObjectBadId() { + $this->expectException('InvalidArgumentException'); $backend = new PDO($this->pdo); $backend->getCalendarObject('bad-id', 'foo-bar'); } @@ -582,10 +582,10 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase /** * @depends testUpdateCalendarObject - * @expectedException \InvalidArgumentException */ public function testUpdateCalendarObjectBadId() { + $this->expectException('InvalidArgumentException'); $backend = new PDO($this->pdo); $backend->updateCalendarObject('bad-id', 'object-id', 'objectdata'); } @@ -608,10 +608,10 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase /** * @depends testDeleteCalendarObject - * @expectedException \InvalidArgumentException */ public function testDeleteCalendarObjectBadId() { + $this->expectException('InvalidArgumentException'); $backend = new PDO($this->pdo); $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); @@ -644,11 +644,11 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException \InvalidArgumentException * @depends testCalendarQueryNoResult */ public function testCalendarQueryBadId() { + $this->expectException('InvalidArgumentException'); $abstract = new PDO($this->pdo); $filters = [ 'name' => 'VCALENDAR', @@ -859,10 +859,10 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase /** * @depends testGetChanges - * @expectedException \InvalidArgumentException */ public function testGetChangesBadId() { + $this->expectException('InvalidArgumentException'); $backend = new PDO($this->pdo); $id = $backend->createCalendar( 'principals/user1', @@ -903,11 +903,9 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase } } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testCreateSubscriptionFail() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $props = [ ]; @@ -1026,6 +1024,15 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase $calData ); + $calDataResource = "BEGIN:VCALENDAR\r\nEND:VCALENDAR\r\n"; + $stream = fopen('data://text/plain,'.$calData, 'r'); + + $backend->createSchedulingObject( + 'principals/user1', + 'schedule1-resource.ics', + $stream + ); + $expected = [ 'calendardata' => $calData, 'uri' => 'schedule1.ics', @@ -1033,6 +1040,13 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase 'size' => strlen($calData), ]; + $expectedResource = [ + 'calendardata' => $calDataResource, + 'uri' => 'schedule1-resource.ics', + 'etag' => '"'.md5($calDataResource).'"', + 'size' => strlen($calDataResource), + ]; + $result = $backend->getSchedulingObject('principals/user1', 'schedule1.ics'); foreach ($expected as $k => $v) { $this->assertArrayHasKey($k, $result); @@ -1042,6 +1056,17 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase $this->assertEquals($v, $result[$k]); } + $resultResource = $backend->getSchedulingObject('principals/user1', 'schedule1-resource.ics'); + foreach ($expected as $k => $v) { + $this->assertArrayHasKey($k, $result); + if (is_resource($result[$k])) { + $result[$k] = stream_get_contents($result[$k]); + } + $this->assertEquals($v, $result[$k]); + } + + $backend->deleteSchedulingObject('principals/user1', 'schedule1-resource.ics'); + $results = $backend->getSchedulingObjects('principals/user1'); $this->assertEquals(1, count($results)); @@ -1082,10 +1107,10 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase /** * @depends testGetInvites - * @expectedException \InvalidArgumentException */ public function testGetInvitesBadId() { + $this->expectException('InvalidArgumentException'); $backend = new PDO($this->pdo); // creating a new calendar @@ -1232,10 +1257,10 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase /** * @depends testUpdateInvites - * @expectedException \InvalidArgumentException */ public function testUpdateInvitesBadId() { + $this->expectException('InvalidArgumentException'); $backend = new PDO($this->pdo); // Add a new invite $backend->updateInvites( @@ -1289,7 +1314,7 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase ], ]), ]; - $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. + $this->assertEqualsCanonicalizing($expected, $result); } /** @@ -1363,11 +1388,9 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase $this->assertEquals($expected, $result); } - /** - * @expectedException \Sabre\DAV\Exception\NotImplemented - */ public function testSetPublishStatus() { + $this->expectException('Sabre\DAV\Exception\NotImplemented'); $backend = new PDO($this->pdo); $backend->setPublishStatus([1, 1], true); } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php index 9f18eeb72..01ac1b39e 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php @@ -65,7 +65,6 @@ class Mock extends AbstractBackend * * @param string $principalUri * @param string $calendarUri - * @param array $properties * * @return string|int */ @@ -94,8 +93,7 @@ class Mock extends AbstractBackend * * Read the PropPatch documentation for more info and examples. * - * @param mixed $calendarId - * @param \Sabre\DAV\PropPatch $propPatch + * @param mixed $calendarId */ public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) { diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php index d6073514f..b7eb4539e 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php @@ -4,8 +4,6 @@ declare(strict_types=1); namespace Sabre\CalDAV; -require_once 'Sabre/CalDAV/TestUtil.php'; - class CalendarObjectTest extends \PHPUnit\Framework\TestCase { /** @@ -18,7 +16,7 @@ class CalendarObjectTest extends \PHPUnit\Framework\TestCase protected $calendar; protected $principalBackend; - public function setup() + public function setup(): void { $this->backend = TestUtil::getBackend(); @@ -27,7 +25,7 @@ class CalendarObjectTest extends \PHPUnit\Framework\TestCase $this->calendar = new Calendar($this->backend, $calendars[0]); } - public function teardown() + public function teardown(): void { unset($this->calendar); unset($this->backend); @@ -38,17 +36,15 @@ class CalendarObjectTest extends \PHPUnit\Framework\TestCase $children = $this->calendar->getChildren(); $this->assertTrue($children[0] instanceof CalendarObject); - $this->assertInternalType('string', $children[0]->getName()); - $this->assertInternalType('string', $children[0]->get()); - $this->assertInternalType('string', $children[0]->getETag()); + $this->assertIsString($children[0]->getName()); + $this->assertIsString($children[0]->get()); + $this->assertIsString($children[0]->getETag()); $this->assertEquals('text/calendar; charset=utf-8', $children[0]->getContentType()); } - /** - * @expectedException \InvalidArgumentException - */ public function testInvalidArg1() { + $this->expectException('InvalidArgumentException'); $obj = new CalendarObject( new Backend\Mock([], []), [], @@ -56,11 +52,9 @@ class CalendarObjectTest extends \PHPUnit\Framework\TestCase ); } - /** - * @expectedException \InvalidArgumentException - */ public function testInvalidArg2() { + $this->expectException('InvalidArgumentException'); $obj = new CalendarObject( new Backend\Mock([], []), [], @@ -137,7 +131,7 @@ class CalendarObjectTest extends \PHPUnit\Framework\TestCase $obj = $children[0]; $size = $obj->getSize(); - $this->assertInternalType('int', $size); + $this->assertIsInt($size); } public function testGetOwner() @@ -219,11 +213,9 @@ class CalendarObjectTest extends \PHPUnit\Framework\TestCase $this->assertEquals($expected, $calendarObject->getACL()); } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testSetACL() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $children = $this->calendar->getChildren(); $this->assertTrue($children[0] instanceof CalendarObject); diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php index 7d6414a80..18c3ec126 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php @@ -6,8 +6,6 @@ namespace Sabre\CalDAV; use Sabre\DAV\PropPatch; -require_once 'Sabre/CalDAV/TestUtil.php'; - class CalendarTest extends \PHPUnit\Framework\TestCase { /** @@ -24,7 +22,7 @@ class CalendarTest extends \PHPUnit\Framework\TestCase */ protected $calendars; - public function setup() + public function setup(): void { $this->backend = TestUtil::getBackend(); @@ -33,7 +31,7 @@ class CalendarTest extends \PHPUnit\Framework\TestCase $this->calendar = new Calendar($this->backend, $this->calendars[0]); } - public function teardown() + public function teardown(): void { unset($this->backend); } @@ -80,11 +78,11 @@ class CalendarTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException \Sabre\DAV\Exception\NotFound * @depends testSimple */ public function testGetChildNotFound() { + $this->expectException('Sabre\DAV\Exception\NotFound'); $this->calendar->getChild('randomname'); } @@ -110,19 +108,15 @@ class CalendarTest extends \PHPUnit\Framework\TestCase $this->assertTrue($this->calendar->childExists($children[0]->getName())); } - /** - * @expectedException \Sabre\DAV\Exception\MethodNotAllowed - */ public function testCreateDirectory() { + $this->expectException('Sabre\DAV\Exception\MethodNotAllowed'); $this->calendar->createDirectory('hello'); } - /** - * @expectedException \Sabre\DAV\Exception\MethodNotAllowed - */ public function testSetName() { + $this->expectException('Sabre\DAV\Exception\MethodNotAllowed'); $this->calendar->setName('hello'); } @@ -211,11 +205,9 @@ class CalendarTest extends \PHPUnit\Framework\TestCase $this->assertEquals($expected, $this->calendar->getACL()); } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testSetACL() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $this->calendar->setACL([]); } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php index 49252744d..93fc56dae 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php @@ -10,7 +10,6 @@ use Sabre\VObject; /** * 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 @@ -82,11 +81,12 @@ END:VCALENDAR $response = $this->request($request); + $bodyAsString = $response->getBodyAsString(); // Everts super awesome xml parser. $body = substr( - $response->body, - $start = strpos($response->body, 'BEGIN:VCALENDAR'), - strpos($response->body, 'END:VCALENDAR') - $start + 13 + $bodyAsString, + $start = strpos($bodyAsString, 'BEGIN:VCALENDAR'), + strpos($bodyAsString, 'END:VCALENDAR') - $start + 13 ); $body = str_replace(' ', '', $body); diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php index 3a982fcfa..50fb6c03c 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php @@ -73,11 +73,12 @@ END:VCALENDAR $response = $this->request($request); + $bodyAsString = $response->getBodyAsString(); // Everts super awesome xml parser. $body = substr( - $response->body, - $start = strpos($response->body, 'BEGIN:VCALENDAR'), - strpos($response->body, 'END:VCALENDAR') - $start + 13 + $bodyAsString, + $start = strpos($bodyAsString, 'BEGIN:VCALENDAR'), + strpos($bodyAsString, 'END:VCALENDAR') - $start + 13 ); $body = str_replace(' ', '', $body); diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php index 90897f1c5..5e5c153e0 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php @@ -84,11 +84,12 @@ END:VCALENDAR $response = $this->request($request); + $bodyAsString = $response->getBodyAsString(); // Everts super awesome xml parser. $body = substr( - $response->body, - $start = strpos($response->body, 'BEGIN:VCALENDAR'), - strpos($response->body, 'END:VCALENDAR') - $start + 13 + $bodyAsString, + $start = strpos($bodyAsString, 'BEGIN:VCALENDAR'), + strpos($bodyAsString, 'END:VCALENDAR') - $start + 13 ); $body = str_replace(' ', '', $body); diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/FreeBusyReportTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/FreeBusyReportTest.php index 3d4b36313..44823edab 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/FreeBusyReportTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/FreeBusyReportTest.php @@ -18,7 +18,7 @@ class FreeBusyReportTest extends \PHPUnit\Framework\TestCase */ protected $server; - public function setUp() + public function setup(): void { $obj1 = <<<ics BEGIN:VCALENDAR @@ -108,11 +108,9 @@ XML; $this->assertTrue(false !== strpos($this->server->httpResponse->body, '20111006T100000Z/20111006T110000Z')); } - /** - * @expectedException \Sabre\DAV\Exception\BadRequest - */ public function testFreeBusyReportNoTimeRange() { + $this->expectException('Sabre\DAV\Exception\BadRequest'); $reportXML = <<<XML <?xml version="1.0"?> <c:free-busy-query xmlns:c="urn:ietf:params:xml:ns:caldav"> @@ -122,11 +120,9 @@ XML; $report = $this->server->xml->parse($reportXML, null, $rootElem); } - /** - * @expectedException \Sabre\DAV\Exception\NotImplemented - */ public function testFreeBusyReportWrongNode() { + $this->expectException('Sabre\DAV\Exception\NotImplemented'); $request = new HTTP\Request('REPORT', '/'); $this->server->httpRequest = $request; @@ -141,11 +137,9 @@ XML; $this->plugin->report($rootElem, $report, null); } - /** - * @expectedException \Sabre\DAV\Exception - */ public function testFreeBusyReportNoACLPlugin() { + $this->expectException('Sabre\DAV\Exception'); $this->server = new DAV\Server(); $this->server->httpRequest = new HTTP\Request('REPORT', '/'); $this->plugin = new Plugin(); diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php index 6cb2b609e..e82a85dd8 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php @@ -77,6 +77,6 @@ END:VCALENDAR $response = $this->request($request); - $this->assertTrue(false !== strpos($response->body, 'BEGIN:VCALENDAR')); + $this->assertTrue(false !== strpos($response->getBodyAsString(), 'BEGIN:VCALENDAR')); } } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/ICSExportPluginTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/ICSExportPluginTest.php index c139e5b5c..8771f538b 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/ICSExportPluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/ICSExportPluginTest.php @@ -15,7 +15,7 @@ class ICSExportPluginTest extends \Sabre\DAVServerTest protected $icsExportPlugin; - public function setUp() + public function setup(): void { parent::setUp(); $this->icsExportPlugin = new ICSExportPlugin(); @@ -82,7 +82,7 @@ ICS $this->assertEquals(200, $response->getStatus()); $this->assertEquals('text/calendar', $response->getHeader('Content-Type')); - $obj = VObject\Reader::read($response->body); + $obj = VObject\Reader::read($response->getBodyAsString()); $this->assertEquals(8, count($obj->children())); $this->assertEquals(1, count($obj->VERSION)); @@ -108,7 +108,7 @@ ICS $this->assertEquals(200, $response->getStatus()); $this->assertEquals('text/calendar', $response->getHeader('Content-Type')); - $obj = VObject\Reader::read($response->body); + $obj = VObject\Reader::read($response->getBodyAsString()); $this->assertEquals(8, count($obj->children())); $this->assertEquals(1, count($obj->VERSION)); @@ -166,7 +166,7 @@ ICS $response = $this->request($request, 200); $this->assertEquals('text/calendar', $response->getHeader('Content-Type')); - $obj = VObject\Reader::read($response->body); + $obj = VObject\Reader::read($response->getBodyAsString()); $this->assertEquals(8, count($obj->children())); $this->assertEquals(1, count($obj->VERSION)); @@ -276,7 +276,7 @@ ICS $response = $this->request($request, 200); - $obj = VObject\Reader::read($response->body); + $obj = VObject\Reader::read($response->getBodyAsString()); $this->assertEquals(1, count($obj->VTIMEZONE)); $this->assertEquals(1, count($obj->VEVENT)); $this->assertNull($obj->VTODO); @@ -291,7 +291,7 @@ ICS $response = $this->request($request, 200); - $obj = VObject\Reader::read($response->body); + $obj = VObject\Reader::read($response->getBodyAsString()); $this->assertNull($obj->VTIMEZONE); $this->assertNull($obj->VEVENT); diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue203Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue203Test.php index 0700024cf..9a786c505 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue203Test.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue203Test.php @@ -86,11 +86,12 @@ END:VCALENDAR $response = $this->request($request); + $bodyAsString = $response->getBodyAsString(); // Everts super awesome xml parser. $body = substr( - $response->body, - $start = strpos($response->body, 'BEGIN:VCALENDAR'), - strpos($response->body, 'END:VCALENDAR') - $start + 13 + $bodyAsString, + $start = strpos($bodyAsString, 'BEGIN:VCALENDAR'), + strpos($bodyAsString, 'END:VCALENDAR') - $start + 13 ); $body = str_replace(' ', '', $body); diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue205Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue205Test.php index 60c944d1d..b021634ba 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue205Test.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue205Test.php @@ -81,14 +81,14 @@ 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->getBodyAsString(), '<s:exception>Exception</s:exception>'), 'Exception occurred: '.$response->getBodyAsString()); + $this->assertFalse(strpos($response->getBodyAsString(), 'Unknown or bad format'), 'DateTime unknown format Exception: '.$response->getBodyAsString()); // Everts super awesome xml parser. $body = substr( - $response->body, - $start = strpos($response->body, 'BEGIN:VCALENDAR'), - strpos($response->body, 'END:VCALENDAR') - $start + 13 + $response->getBodyAsString(), + $start = strpos($response->getBodyAsString(), 'BEGIN:VCALENDAR'), + strpos($response->getBodyAsString(), 'END:VCALENDAR') - $start + 13 ); $body = str_replace(' ', '', $body); diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue211Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue211Test.php index 10c9af50c..d7fa18c09 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue211Test.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue211Test.php @@ -85,6 +85,6 @@ 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)); + $this->assertFalse(strpos('BEGIN:VEVENT', $response->getBodyAsString())); } } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue220Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue220Test.php index 46f5ca205..8e51e49e2 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue220Test.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue220Test.php @@ -93,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->getBodyAsString(), '<s:exception>PHPUnit_Framework_Error_Warning</s:exception>'), 'Error Warning occurred: '.$response->getBodyAsString()); + $this->assertFalse(strpos($response->getBodyAsString(), 'Invalid argument supplied for foreach()'), 'Invalid argument supplied for foreach(): '.$response->getBodyAsString()); $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 a8b855ca3..1f698e7dd 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue228Test.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue228Test.php @@ -75,6 +75,6 @@ END:VCALENDAR $response = $this->request($request); // We must check if absolutely nothing was returned from this query. - $this->assertFalse(strpos($response->body, 'BEGIN:VCALENDAR')); + $this->assertFalse(strpos($response->getBodyAsString(), '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 eceb0b87f..594241e0d 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/CollectionTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/CollectionTest.php @@ -63,11 +63,9 @@ class CollectionTest extends \PHPUnit\Framework\TestCase $this->assertEquals($expected, $col->getACL()); } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testSetACL() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $col = $this->getInstance(); $col->setACL([]); } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/NodeTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/NodeTest.php index cb19ef962..623525e69 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/NodeTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/NodeTest.php @@ -73,11 +73,9 @@ class NodeTest extends \PHPUnit\Framework\TestCase $this->assertEquals($expected, $node->getACL()); } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testSetACL() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $node = $this->getInstance(); $node->setACL([]); } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php index 711cc0ac7..a4f08f7e5 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php @@ -26,7 +26,7 @@ class PluginTest extends \PHPUnit\Framework\TestCase */ protected $caldavBackend; - public function setup() + public function setup(): void { $caldavNS = '{urn:ietf:params:xml:ns:caldav}'; @@ -118,7 +118,7 @@ class PluginTest extends \PHPUnit\Framework\TestCase $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->getBodyAsString()); } public function testGetWithoutContentType() @@ -336,7 +336,7 @@ 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->getBodyAsString()); $calendars = $this->caldavBackend->getCalendarsForUser('principals/user1'); $this->assertEquals(3, count($calendars)); @@ -349,7 +349,7 @@ END:VCALENDAR'; } } - $this->assertInternalType('array', $newCalendar); + $this->assertIsArray($newCalendar); $keys = [ 'uri' => 'NEWCALENDAR', @@ -381,7 +381,7 @@ 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->getBodyAsString()); $calendars = $this->caldavBackend->getCalendarsForUser('principals/user1'); $this->assertEquals(3, count($calendars)); @@ -394,7 +394,7 @@ END:VCALENDAR'; } } - $this->assertInternalType('array', $newCalendar); + $this->assertIsArray($newCalendar); $keys = [ 'uri' => 'NEWCALENDAR', @@ -606,7 +606,8 @@ XML; $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(207, $this->response->status, 'Invalid HTTP status received. Full response body: '.$this->response->body); + $bodyAsString = $this->response->getBodyAsString(); + $this->assertEquals(207, $this->response->status, 'Invalid HTTP status received. Full response body: '.$bodyAsString); $expectedIcal = TestUtil::getTestCalendarData(); $expectedIcal = \Sabre\VObject\Reader::read($expectedIcal); @@ -632,7 +633,7 @@ XML; </d:multistatus> XML; - $this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString()); + $this->assertXmlStringEqualsXmlString($expected, $bodyAsString); } /** @@ -663,7 +664,8 @@ XML; $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->body); + $bodyAsString = $this->response->getBodyAsString(); + $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$bodyAsString); $expectedIcal = TestUtil::getTestCalendarData(); $expectedIcal = \Sabre\VObject\Reader::read($expectedIcal); @@ -689,7 +691,7 @@ XML; </d:multistatus> XML; - $this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString()); + $this->assertXmlStringEqualsXmlString($expected, $bodyAsString); } /** @@ -724,7 +726,8 @@ XML; $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->body); + $bodyAsString = $this->response->getBodyAsString(); + $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$bodyAsString); $expectedIcal = TestUtil::getTestCalendarData(); $expectedIcal = \Sabre\VObject\Reader::read($expectedIcal); @@ -750,7 +753,7 @@ XML; </d:multistatus> XML; - $this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString()); + $this->assertXmlStringEqualsXmlString($expected, $bodyAsString); } /** @@ -783,7 +786,7 @@ 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->getBodyAsString()); } /** @@ -812,7 +815,8 @@ XML; $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->body); + $bodyAsString = $this->server->httpResponse->getBodyAsString(); + $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$bodyAsString); $expected = <<<XML <?xml version="1.0"?> @@ -829,7 +833,7 @@ XML; </d:multistatus> XML; - $this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString()); + $this->assertXmlStringEqualsXmlString($expected, $bodyAsString); } /** @@ -852,7 +856,7 @@ 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->getBodyAsString()); } /** @@ -883,7 +887,8 @@ XML; $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->body); + $bodyAsString = $this->server->httpResponse->getBodyAsString(); + $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$bodyAsString); $expectedIcal = TestUtil::getTestCalendarData(); $expectedIcal = \Sabre\VObject\Reader::read($expectedIcal); @@ -909,7 +914,7 @@ XML; </d:multistatus> XML; - $this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString()); + $this->assertXmlStringEqualsXmlString($expected, $bodyAsString); } /** @@ -937,7 +942,8 @@ XML; $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->body); + $bodyAsString = $this->server->httpResponse->getBodyAsString(); + $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$bodyAsString); $expected = <<<XML <?xml version="1.0"?> @@ -954,7 +960,7 @@ XML; </d:multistatus> XML; - $this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString()); + $this->assertXmlStringEqualsXmlString($expected, $bodyAsString); } public function testHTMLActionsPanel() @@ -989,7 +995,7 @@ 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->getBodyAsString()); } /** @@ -1015,7 +1021,7 @@ 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->getBodyAsString()); } /** @@ -1041,7 +1047,7 @@ 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->getBodyAsString()); } /** diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyReadTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyReadTest.php index 8036635b2..95ff86fa1 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyReadTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyReadTest.php @@ -39,20 +39,16 @@ class ProxyReadTest extends \PHPUnit\Framework\TestCase $this->assertNull($i->getLastModified()); } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testDelete() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $i = $this->getInstance(); $i->delete(); } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testSetName() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $i = $this->getInstance(); $i->setName('foo'); } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/UserTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/UserTest.php index 2c690c65d..fd079acb2 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/UserTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/UserTest.php @@ -26,20 +26,16 @@ class UserTest extends \PHPUnit\Framework\TestCase ]); } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testCreateFile() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $u = $this->getInstance(); $u->createFile('test'); } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testCreateDirectory() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $u = $this->getInstance(); $u->createDirectory('test'); } @@ -58,20 +54,16 @@ class UserTest extends \PHPUnit\Framework\TestCase $this->assertInstanceOf('Sabre\\CalDAV\\Principal\\ProxyWrite', $child); } - /** - * @expectedException \Sabre\DAV\Exception\NotFound - */ public function testGetChildNotFound() { + $this->expectException('Sabre\DAV\Exception\NotFound'); $u = $this->getInstance(); $child = $u->getChild('foo'); } - /** - * @expectedException \Sabre\DAV\Exception\NotFound - */ public function testGetChildNotFound2() { + $this->expectException('Sabre\DAV\Exception\NotFound'); $u = $this->getInstance(); $child = $u->getChild('random'); } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/SharingPluginTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/SharingPluginTest.php index 57732cd06..f11af8b95 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/SharingPluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/SharingPluginTest.php @@ -6,16 +6,17 @@ namespace Sabre\CalDAV; use Sabre\DAV; use Sabre\DAV\Xml\Element\Sharee; +use Sabre\DAVServerTest; use Sabre\HTTP; -class SharingPluginTest extends \Sabre\DAVServerTest +class SharingPluginTest extends DAVServerTest { protected $setupCalDAV = true; protected $setupCalDAVSharing = true; protected $setupACL = true; protected $autoLogin = 'user1'; - public function setUp() + public function setup(): void { $this->caldavCalendars = [ [ @@ -51,11 +52,9 @@ class SharingPluginTest extends \Sabre\DAVServerTest ); } - /** - * @expectedException \LogicException - */ public function testSetupWithoutCoreSharingPlugin() { + $this->expectException('LogicException'); $server = new DAV\Server(); $server->addPlugin( new SharingPlugin() @@ -131,7 +130,7 @@ class SharingPluginTest extends \Sabre\DAVServerTest $response = $this->request($request); - $this->assertEquals(501, $response->status, $response->body); + $this->assertEquals(501, $response->status, $response->getBodyAsString()); } public function testUnknownMethodNoXML() @@ -144,7 +143,7 @@ class SharingPluginTest extends \Sabre\DAVServerTest $response = $this->request($request); - $this->assertEquals(501, $response->status, $response->body); + $this->assertEquals(501, $response->status, $response->getBodyAsString()); } public function testUnknownMethodNoNode() @@ -157,7 +156,7 @@ class SharingPluginTest extends \Sabre\DAVServerTest $response = $this->request($request); - $this->assertEquals(501, $response->status, $response->body); + $this->assertEquals(501, $response->status, $response->getBodyAsString()); } public function testShareRequest() @@ -180,7 +179,7 @@ RRR; $request->setBody($xml); - $response = $this->request($request, 200); + $this->request($request, 200); $this->assertEquals( [ @@ -230,7 +229,7 @@ RRR; $request->setBody($xml); - $response = $this->request($request, 403); + $this->request($request, 403); } public function testInviteReply() @@ -250,7 +249,7 @@ RRR; $request->setBody($xml); $response = $this->request($request); - $this->assertEquals(200, $response->status, $response->body); + $this->assertEquals(200, $response->status, $response->getBodyAsString()); } public function testInviteBadXML() @@ -267,7 +266,7 @@ RRR; '; $request->setBody($xml); $response = $this->request($request); - $this->assertEquals(400, $response->status, $response->body); + $this->assertEquals(400, $response->status, $response->getBodyAsString()); } public function testInviteWrongUrl() @@ -285,11 +284,11 @@ RRR; '; $request->setBody($xml); $response = $this->request($request); - $this->assertEquals(501, $response->status, $response->body); + $this->assertEquals(501, $response->status, $response->getBodyAsString()); // 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)); + $this->assertEquals($xml, $request->getBody()); } public function testPostWithoutContentType() @@ -312,7 +311,7 @@ RRR; $request->setBody($xml); $response = $this->request($request); - $this->assertEquals(202, $response->status, $response->body); + $this->assertEquals(202, $response->status, $response->getBodyAsString()); } public function testUnpublish() @@ -330,7 +329,7 @@ RRR; $request->setBody($xml); $response = $this->request($request); - $this->assertEquals(200, $response->status, $response->body); + $this->assertEquals(200, $response->status, $response->getBodyAsString()); } public function testPublishWrongUrl() @@ -379,6 +378,6 @@ RRR; $request->setBody($xml); $response = $this->request($request); - $this->assertEquals(501, $response->status, $response->body); + $this->assertEquals(501, $response->status, $response->getBodyAsString()); } } diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/TestUtil.php b/vendor/sabre/dav/tests/Sabre/CalDAV/TestUtil.php index 72b5080af..5de11a31a 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/TestUtil.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/TestUtil.php @@ -99,87 +99,4 @@ END:VCALENDAR'; return $calendarData; } - - public static function getTestTODO($type = 'due') - { - switch ($type) { - case 'due': - $extra = 'DUE:20100104T000000Z'; - break; - case 'due2': - $extra = 'DUE:20060104T000000Z'; - break; - case 'due_date': - $extra = 'DUE;VALUE=DATE:20060104'; - break; - case 'due_tz': - $extra = 'DUE;TZID=Asia/Seoul:20060104T000000Z'; - break; - case 'due_dtstart': - $extra = "DTSTART:20050223T060000Z\nDUE:20060104T000000Z"; - break; - case 'due_dtstart2': - $extra = "DTSTART:20090223T060000Z\nDUE:20100104T000000Z"; - break; - case 'dtstart': - $extra = 'DTSTART:20100223T060000Z'; - break; - case 'dtstart2': - $extra = 'DTSTART:20060223T060000Z'; - break; - case 'dtstart_date': - $extra = 'DTSTART;VALUE=DATE:20100223'; - break; - case 'dtstart_tz': - $extra = 'DTSTART;TZID=Asia/Seoul:20100223T060000Z'; - break; - case 'dtstart_duration': - $extra = "DTSTART:20061023T060000Z\nDURATION:PT1H"; - break; - case 'dtstart_duration2': - $extra = "DTSTART:20101023T060000Z\nDURATION:PT1H"; - break; - case 'completed': - $extra = 'COMPLETED:20060601T000000Z'; - break; - case 'completed2': - $extra = 'COMPLETED:20090601T000000Z'; - break; - case 'created': - $extra = 'CREATED:20060601T000000Z'; - break; - case 'created2': - $extra = 'CREATED:20090601T000000Z'; - break; - case 'completedcreated': - $extra = "CREATED:20060601T000000Z\nCOMPLETED:20070101T000000Z"; - break; - case 'completedcreated2': - $extra = "CREATED:20090601T000000Z\nCOMPLETED:20100101T000000Z"; - break; - case 'notime': - $extra = 'X-FILLER:oh hello'; - break; - default: - throw new Exception('Unknown type: '.$type); - } - - $todo = 'BEGIN:VCALENDAR -VERSION:2.0 -PRODID:-//Example Corp.//CalDAV Client//EN -BEGIN:VTODO -DTSTAMP:20060205T235335Z -'.$extra.' -STATUS:NEEDS-ACTION -SUMMARY:Task #1 -UID:DDDEEB7915FA61233B861457@example.com -BEGIN:VALARM -ACTION:AUDIO -TRIGGER;RELATED=START:-PT10M -END:VALARM -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 e6d1edace..4e2411391 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/ValidateICalTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/ValidateICalTest.php @@ -8,12 +8,10 @@ use Sabre\DAV; use Sabre\DAVACL; use Sabre\HTTP; -require_once 'Sabre/HTTP/ResponseMock.php'; - class ValidateICalTest extends \PHPUnit\Framework\TestCase { /** - * @var Sabre\DAV\Server + * @var DAV\Server */ protected $server; /** @@ -21,7 +19,7 @@ class ValidateICalTest extends \PHPUnit\Framework\TestCase */ protected $calBackend; - public function setUp() + public function setup(): void { $calendars = [ [ @@ -56,6 +54,9 @@ class ValidateICalTest extends \PHPUnit\Framework\TestCase $this->server->httpResponse = $response; } + /** + * @return Sabre\HTTP\ResponseMock + */ public function request(HTTP\Request $request) { $this->server->httpRequest = $request; @@ -100,7 +101,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->getBodyAsString()); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Length' => ['0'], @@ -140,7 +141,7 @@ 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->getBodyAsString()); } public function testCreateFileNoVersionFixed() @@ -166,7 +167,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->getBodyAsString()); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Length' => ['0'], @@ -213,7 +214,7 @@ 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->getBodyAsString()); } public function testCreateFileNoUID() @@ -226,7 +227,7 @@ 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->getBodyAsString()); } public function testCreateFileVCard() @@ -239,7 +240,7 @@ 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->getBodyAsString()); } public function testCreateFile2Components() @@ -252,7 +253,7 @@ 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->getBodyAsString()); } public function testCreateFile2UIDS() @@ -265,7 +266,7 @@ 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->getBodyAsString()); } public function testCreateFileWrongComponent() @@ -278,7 +279,7 @@ 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->getBodyAsString()); } public function testUpdateFile() @@ -338,7 +339,7 @@ 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->getBodyAsString()); } public function testUpdateFileInvalidComponent() @@ -352,7 +353,7 @@ 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->getBodyAsString()); } /** @@ -385,7 +386,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->getBodyAsString()); $this->assertNull($response->getHeader('ETag')); } } |