diff options
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre')
81 files changed, 454 insertions, 983 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')); } } diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/AbstractPluginTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/AbstractPluginTest.php index c945e2c58..6565fc459 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/AbstractPluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/AbstractPluginTest.php @@ -23,7 +23,7 @@ abstract class AbstractPluginTest extends \PHPUnit\Framework\TestCase */ protected $backend; - public function setUp() + public function setup(): void { $this->backend = new Backend\Mock(); $principalBackend = new DAVACL\PrincipalBackend\Mock(); diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookQueryTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookQueryTest.php index 6e7e13106..a86d85144 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookQueryTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookQueryTest.php @@ -7,9 +7,6 @@ namespace Sabre\CardDAV; use Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/CardDAV/AbstractPluginTest.php'; -require_once 'Sabre/HTTP/ResponseMock.php'; - class AddressBookQueryTest extends AbstractPluginTest { public function testQuery() @@ -39,12 +36,13 @@ class AddressBookQueryTest extends AbstractPluginTest $this->server->exec(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body); + $bodyAsString = $response->getBodyAsString(); + $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); - $result = $client->parseMultiStatus($response->body); + $result = $client->parseMultiStatus($bodyAsString); $this->assertEquals([ '/addressbooks/user1/book1/card1' => [ @@ -87,12 +85,13 @@ class AddressBookQueryTest extends AbstractPluginTest $this->server->exec(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body); + $bodyAsString = $response->getBodyAsString(); + $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); - $result = $client->parseMultiStatus($response->body); + $result = $client->parseMultiStatus($bodyAsString); $this->assertEquals([ '/addressbooks/user1/book1/card1' => [ @@ -130,12 +129,13 @@ class AddressBookQueryTest extends AbstractPluginTest $this->server->exec(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body); + $bodyAsString = $response->getBodyAsString(); + $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); - $result = $client->parseMultiStatus($response->body); + $result = $client->parseMultiStatus($bodyAsString); $this->assertEquals([], $result); } @@ -168,12 +168,13 @@ class AddressBookQueryTest extends AbstractPluginTest $this->server->exec(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body); + $bodyAsString = $response->getBodyAsString(); + $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); - $result = $client->parseMultiStatus($response->body); + $result = $client->parseMultiStatus($bodyAsString); $this->assertEquals([ '/addressbooks/user1/book1/card1' => [ @@ -209,12 +210,13 @@ class AddressBookQueryTest extends AbstractPluginTest $this->server->exec(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body); + $bodyAsString = $response->getBodyAsString(); + $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); - $result = $client->parseMultiStatus($response->body); + $result = $client->parseMultiStatus($bodyAsString); $vobjVersion = \Sabre\VObject\Version::VERSION; @@ -253,12 +255,13 @@ class AddressBookQueryTest extends AbstractPluginTest $this->server->exec(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body); + $bodyAsString = $response->getBodyAsString(); + $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); - $result = $client->parseMultiStatus($response->body); + $result = $client->parseMultiStatus($bodyAsString); $vobjVersion = \Sabre\VObject\Version::VERSION; @@ -297,7 +300,7 @@ class AddressBookQueryTest extends AbstractPluginTest $this->server->exec(); - $this->assertEquals(415, $response->status, 'Incorrect status code. Full response body:'.$response->body); + $this->assertEquals(415, $response->status, 'Incorrect status code. Full response body:'.$response->getBodyAsString()); } public function testAddressBookProperties() @@ -328,12 +331,13 @@ class AddressBookQueryTest extends AbstractPluginTest $this->server->exec(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body); + $bodyAsString = $response->getBodyAsString(); + $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); - $result = $client->parseMultiStatus($response->body); + $result = $client->parseMultiStatus($bodyAsString); $this->assertEquals([ '/addressbooks/user1/book3/card3' => [ diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookTest.php index 879816803..e985c54ff 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookTest.php @@ -16,7 +16,7 @@ class AddressBookTest extends \PHPUnit\Framework\TestCase protected $ab; protected $backend; - public function setUp() + public function setup(): void { $this->backend = new Backend\Mock(); $this->ab = new AddressBook( @@ -42,11 +42,9 @@ class AddressBookTest extends \PHPUnit\Framework\TestCase $this->assertEquals('card1', $card->getName()); } - /** - * @expectedException \Sabre\DAV\Exception\NotFound - */ public function testGetChildNotFound() { + $this->expectException('Sabre\DAV\Exception\NotFound'); $card = $this->ab->getChild('card3'); } @@ -59,11 +57,9 @@ class AddressBookTest extends \PHPUnit\Framework\TestCase $this->assertEquals('card2', $cards[1]->getName()); } - /** - * @expectedException \Sabre\DAV\Exception\MethodNotAllowed - */ public function testCreateDirectory() { + $this->expectException('Sabre\DAV\Exception\MethodNotAllowed'); $this->ab->createDirectory('name'); } @@ -83,11 +79,9 @@ class AddressBookTest extends \PHPUnit\Framework\TestCase $this->assertEquals(1, count($this->backend->addressBooks)); } - /** - * @expectedException \Sabre\DAV\Exception\MethodNotAllowed - */ public function testSetName() { + $this->expectException('Sabre\DAV\Exception\MethodNotAllowed'); $this->ab->setName('foo'); } @@ -128,11 +122,9 @@ class AddressBookTest extends \PHPUnit\Framework\TestCase ], $this->ab->getACL()); } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testSetACL() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $this->ab->setACL([]); } diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/AbstractPDOTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/AbstractPDOTest.php index e5bd088fc..bac3b2b22 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/AbstractPDOTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/AbstractPDOTest.php @@ -16,7 +16,7 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase */ protected $backend; - public function setUp() + public function setup(): void { $this->dropTables([ 'addressbooks', @@ -142,11 +142,9 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase $this->assertEquals([], $this->backend->getAddressBooksForUser('principals/user1')); } - /** - * @expectedException \Sabre\DAV\Exception\BadRequest - */ public function testCreateAddressBookUnsupportedProp() { + $this->expectException('Sabre\DAV\Exception\BadRequest'); $this->backend->createAddressBook('principals/user1', 'book2', [ '{DAV:}foo' => 'bar', ]); @@ -273,7 +271,7 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase switch ($k) { case 'lastmodified': - $this->assertInternalType('int', $actual); + $this->assertIsInt($actual); break; case 'carddata': if (is_resource($actual)) { diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/Mock.php b/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/Mock.php index f7e20fbfb..630465cc8 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/Mock.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/Mock.php @@ -69,8 +69,7 @@ class Mock extends AbstractBackend * * Read the PropPatch documentation for more info and examples. * - * @param string $addressBookId - * @param \Sabre\DAV\PropPatch $propPatch + * @param string $addressBookId */ public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) { diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/CardTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/CardTest.php index 41853aa63..1de10b719 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/CardTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/CardTest.php @@ -15,7 +15,7 @@ class CardTest extends \PHPUnit\Framework\TestCase */ protected $backend; - public function setUp() + public function setup(): void { $this->backend = new Backend\Mock(); $this->card = new Card( @@ -179,11 +179,9 @@ class CardTest extends \PHPUnit\Framework\TestCase ], $card->getACL()); } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testSetACL() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $this->card->setACL([]); } diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/MultiGetTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/MultiGetTest.php index 4e3276ed3..ac0cd5e91 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/MultiGetTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/MultiGetTest.php @@ -7,8 +7,6 @@ namespace Sabre\CardDAV; use Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/HTTP/ResponseMock.php'; - class MultiGetTest extends AbstractPluginTest { public function testMultiGet() @@ -36,12 +34,13 @@ class MultiGetTest extends AbstractPluginTest $this->server->exec(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body); + $bodyAsString = $response->getBodyAsString(); + $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); - $result = $client->parseMultiStatus($response->body); + $result = $client->parseMultiStatus($bodyAsString); $this->assertEquals([ '/addressbooks/user1/book1/card1' => [ @@ -78,12 +77,13 @@ class MultiGetTest extends AbstractPluginTest $this->server->exec(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body); + $bodyAsString = $response->getBodyAsString(); + $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); - $result = $client->parseMultiStatus($response->body); + $result = $client->parseMultiStatus($bodyAsString); $prodId = 'PRODID:-//Sabre//Sabre VObject '.\Sabre\VObject\Version::VERSION.'//EN'; diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/TestUtil.php b/vendor/sabre/dav/tests/Sabre/CardDAV/TestUtil.php deleted file mode 100644 index 0bdf07df5..000000000 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/TestUtil.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CardDAV; - -class TestUtil -{ - public static function getBackend() - { - $backend = new Backend\PDO(self::getSQLiteDB()); - - return $backend; - } - - public static function getSQLiteDB() - { - $pdo = Backend\PDOSqliteTest::getSQLite(); - - // Inserting events through a backend class. - $backend = new Backend\PDO($pdo); - $addressbookId = $backend->createAddressBook( - 'principals/user1', - 'UUID-123467', - [ - '{DAV:}displayname' => 'user1 addressbook', - '{urn:ietf:params:xml:ns:carddav}addressbook-description' => 'AddressBook description', - ] - ); - $backend->createAddressBook( - 'principals/user1', - 'UUID-123468', - [ - '{DAV:}displayname' => 'user1 addressbook2', - '{urn:ietf:params:xml:ns:carddav}addressbook-description' => 'AddressBook description', - ] - ); - $backend->createCard($addressbookId, 'UUID-2345', self::getTestCardData()); - - return $pdo; - } - - public static function deleteSQLiteDB() - { - $sqliteTest = new Backend\PDOSqliteTest(); - $pdo = $sqliteTest->tearDown(); - } - - public static function getTestCardData() - { - $addressbookData = 'BEGIN:VCARD -VERSION:3.0 -PRODID:-//Acme Inc.//RoadRunner 1.0//EN -FN:Wile E. Coyote -N:Coyote;Wile;Erroll;; -ORG:Acme Inc. -UID:39A6B5ED-DD51-4AFE-A683-C35EE3749627 -REV:2012-06-20T07:00:39+00:00 -END:VCARD'; - - return $addressbookData; - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/VCFExportTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/VCFExportTest.php index d8acc3c14..546a4ccfb 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/VCFExportTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/VCFExportTest.php @@ -28,7 +28,7 @@ class VCFExportTest extends \Sabre\DAVServerTest ], ]; - public function setUp() + public function setup(): void { parent::setUp(); $plugin = new VCFExportPlugin(); @@ -57,7 +57,7 @@ class VCFExportTest extends \Sabre\DAVServerTest ]); $response = $this->request($request); - $this->assertEquals(200, $response->status, $response->body); + $this->assertEquals(200, $response->status, $response->getBodyAsString()); $expected = 'BEGIN:VCARD FN:Person1 @@ -75,7 +75,7 @@ END:VCARD // We actually expected windows line endings $expected = str_replace("\n", "\r\n", $expected); - $this->assertEquals($expected, $response->body); + $this->assertEquals($expected, $response->getBodyAsString()); } public function testBrowserIntegration() @@ -84,7 +84,7 @@ END:VCARD $actions = ''; $addressbook = new AddressBook($this->carddavBackend, []); $this->server->emit('browserButtonActions', ['/foo', $addressbook, &$actions]); - $this->assertContains('/foo?export', $actions); + $this->assertStringContainsString('/foo?export', $actions); } public function testContentDisposition() diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateFilterTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateFilterTest.php index 753efc73d..de7de19cd 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateFilterTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateFilterTest.php @@ -4,8 +4,6 @@ declare(strict_types=1); namespace Sabre\CardDAV; -require_once 'Sabre/CardDAV/AbstractPluginTest.php'; - class ValidateFilterTest extends AbstractPluginTest { /** @@ -16,7 +14,7 @@ class ValidateFilterTest extends AbstractPluginTest * @param string|null $message * @dataProvider data */ - public function testFilter($input, $filters, $test, $result, $message = null) + public function testFilter($input, $filters, $test, $result, $message = '') { if ($result) { $this->assertTrue($this->plugin->validateFilters($input, $filters, $test), $message); diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateVCardTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateVCardTest.php index 2317b86cc..571cce3f0 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateVCardTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateVCardTest.php @@ -8,14 +8,12 @@ use Sabre\DAV; use Sabre\DAVACL; use Sabre\HTTP; -require_once 'Sabre/HTTP/ResponseMock.php'; - class ValidateVCardTest extends \PHPUnit\Framework\TestCase { protected $server; protected $cardBackend; - public function setUp() + public function setup(): void { $addressbooks = [ [ @@ -240,7 +238,7 @@ VCF; $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()); $foo = $this->cardBackend->getCard('addressbook1', 'blabla.vcf'); $this->assertEquals("BEGIN:VCARD\r\nVERSION:4.0\r\nUID:foo\r\nFN:FirstName LastName\r\nEND:VCARD\r\n", $foo['carddata']); @@ -256,7 +254,7 @@ VCF; $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 testUpdateFile() diff --git a/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php b/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php index 5f5d666f9..49fedf062 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php @@ -9,17 +9,17 @@ use Sabre\HTTP; abstract class AbstractServer extends \PHPUnit\Framework\TestCase { /** - * @var Sabre\HTTP\ResponseMock + * @var \Sabre\HTTP\ResponseMock */ protected $response; protected $request; /** - * @var Sabre\DAV\Server + * @var \Sabre\DAV\Server */ protected $server; protected $tempDir = SABRE_TEMPDIR; - public function setUp() + public function setup(): void { $this->response = new HTTP\ResponseMock(); $this->server = new Server($this->getRootNode()); @@ -32,7 +32,7 @@ abstract class AbstractServer extends \PHPUnit\Framework\TestCase file_put_contents(SABRE_TEMPDIR.'/dir/child.txt', 'Child contents'); } - public function tearDown() + public function teardown(): void { $this->deleteTree(SABRE_TEMPDIR, false); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php index d9af326fe..a751efdc2 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php @@ -35,11 +35,9 @@ class AbstractDigestTest extends \PHPUnit\Framework\TestCase ); } - /** - * @expectedException \Sabre\DAV\Exception - */ public function testCheckBadGetUserInfoResponse2() { + $this->expectException('Sabre\DAV\Exception'); $header = 'username=array, realm=myRealm, nonce=12345, uri=/, response=HASH, opaque=1, qop=auth, nc=1, cnonce=1'; $request = HTTP\Sapi::createFromServerArray([ 'REQUEST_METHOD' => 'GET', diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractPDOTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractPDOTest.php index 5e34f9c49..8b874f884 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractPDOTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractPDOTest.php @@ -8,7 +8,7 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase { use \Sabre\DAV\DbTestHelperTrait; - public function setUp() + public function setup(): void { $this->dropTables('users'); $this->createSchema('users'); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php index 0297b17f9..31a86f9ed 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php @@ -6,7 +6,7 @@ namespace Sabre\DAV\Auth\Backend; class FileTest extends \PHPUnit\Framework\TestCase { - public function tearDown() + public function teardown(): void { if (file_exists(SABRE_TEMPDIR.'/filebackend')) { unlink(SABRE_TEMPDIR.'/filebackend'); @@ -19,11 +19,9 @@ class FileTest extends \PHPUnit\Framework\TestCase $this->assertTrue($file instanceof File); } - /** - * @expectedException \Sabre\DAV\Exception - */ public function testLoadFileBroken() { + $this->expectException('Sabre\DAV\Exception'); file_put_contents(SABRE_TEMPDIR.'/backend', 'user:realm:hash'); $file = new File(SABRE_TEMPDIR.'/backend'); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/Mock.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/Mock.php index 730f2a975..fca7f722f 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/Mock.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/Mock.php @@ -44,9 +44,6 @@ class Mock implements BackendInterface * * principals/users/[username] * - * @param RequestInterface $request - * @param ResponseInterface $response - * * @return array */ public function check(RequestInterface $request, ResponseInterface $response) @@ -77,9 +74,6 @@ class Mock implements BackendInterface * WWW-Authenticate headers may already have been set, and you'll want to * append your own WWW-Authenticate header instead of overwriting the * existing one. - * - * @param RequestInterface $request - * @param ResponseInterface $response */ public function challenge(RequestInterface $request, ResponseInterface $response) { diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php index 03c8a4624..f4810d524 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php @@ -16,7 +16,7 @@ class PluginTest extends \PHPUnit\Framework\TestCase $this->assertTrue($plugin instanceof Plugin); $fakeServer->addPlugin($plugin); $this->assertEquals($plugin, $fakeServer->getPlugin('auth')); - $this->assertInternalType('array', $plugin->getPluginInfo()); + $this->assertIsArray($plugin->getPluginInfo()); } /** @@ -34,10 +34,10 @@ class PluginTest extends \PHPUnit\Framework\TestCase /** * @depends testInit - * @expectedException \Sabre\DAV\Exception\NotAuthenticated */ public function testAuthenticateFail() { + $this->expectException('Sabre\DAV\Exception\NotAuthenticated'); $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); $backend = new Backend\Mock(); $backend->fail = true; @@ -87,10 +87,10 @@ class PluginTest extends \PHPUnit\Framework\TestCase /** * @depends testInit - * @expectedException \Sabre\DAV\Exception */ public function testNoAuthBackend() { + $this->expectException('Sabre\DAV\Exception'); $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); $plugin = new Plugin(); @@ -100,10 +100,10 @@ class PluginTest extends \PHPUnit\Framework\TestCase /** * @depends testInit - * @expectedException \Sabre\DAV\Exception */ public function testInvalidCheckResponse() { + $this->expectException('Sabre\DAV\Exception'); $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); $backend = new Backend\Mock(); $backend->invalidCheckResponse = true; diff --git a/vendor/sabre/dav/tests/Sabre/DAV/BasicNodeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/BasicNodeTest.php index 60fcc73fc..e9a8eddad 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/BasicNodeTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/BasicNodeTest.php @@ -6,20 +6,16 @@ namespace Sabre\DAV; class BasicNodeTest extends \PHPUnit\Framework\TestCase { - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testPut() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $file = new FileMock(); $file->put('hi'); } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testGet() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $file = new FileMock(); $file->get(); } @@ -42,20 +38,16 @@ class BasicNodeTest extends \PHPUnit\Framework\TestCase $this->assertNull($file->getContentType()); } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testDelete() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $file = new FileMock(); $file->delete(); } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testSetName() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $file = new FileMock(); $file->setName('hi'); } @@ -88,29 +80,23 @@ class BasicNodeTest extends \PHPUnit\Framework\TestCase $this->assertFalse($dir->childExists('mockfile2')); } - /** - * @expectedException \Sabre\DAV\Exception\NotFound - */ public function testGetChild404() { + $this->expectException('Sabre\DAV\Exception\NotFound'); $dir = new DirectoryMock(); $file = $dir->getChild('blabla'); } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testCreateFile() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $dir = new DirectoryMock(); $dir->createFile('hello', 'data'); } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testCreateDirectory() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $dir = new DirectoryMock(); $dir->createDirectory('hello'); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Browser/GuessContentTypeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Browser/GuessContentTypeTest.php index 1f48256e0..cb4d3ce03 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Browser/GuessContentTypeTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Browser/GuessContentTypeTest.php @@ -6,10 +6,9 @@ namespace Sabre\DAV\Browser; use Sabre\DAV; -require_once 'Sabre/DAV/AbstractServer.php'; class GuessContentTypeTest extends DAV\AbstractServer { - public function setUp() + public function setUp(): void { parent::setUp(); \Sabre\TestUtil::clearTempDir(); @@ -17,7 +16,7 @@ class GuessContentTypeTest extends DAV\AbstractServer file_put_contents(SABRE_TEMPDIR.'/somefile.hoi', 'blabla'); } - public function tearDown() + public function tearDown(): void { \Sabre\TestUtil::clearTempDir(); parent::tearDown(); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php index de7b85f32..00b2661ac 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php @@ -7,11 +7,9 @@ namespace Sabre\DAV\Browser; use Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/DAV/AbstractServer.php'; - class MapGetToPropFindTest extends DAV\AbstractServer { - public function setUp() + public function setUp(): void { parent::setUp(); $this->server->addPlugin(new MapGetToPropFind()); @@ -29,7 +27,7 @@ class MapGetToPropFindTest extends DAV\AbstractServer $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(207, $this->response->status, 'Incorrect status response received. Full response body: '.$this->response->body); + $this->assertEquals(207, $this->response->status, 'Incorrect status response received. Full response body: '.$this->response->getBodyAsString()); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Browser/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Browser/PluginTest.php index fb7c63d46..a987525c0 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Browser/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Browser/PluginTest.php @@ -7,13 +7,11 @@ namespace Sabre\DAV\Browser; use Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/DAV/AbstractServer.php'; - class PluginTest extends DAV\AbstractServer { protected $plugin; - public function setUp() + public function setUp(): void { parent::setUp(); $this->server->addPlugin($this->plugin = new Plugin()); @@ -148,7 +146,7 @@ class PluginTest extends DAV\AbstractServer $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(200, $this->response->getStatus(), 'Error: '.$this->response->body); + $this->assertEquals(200, $this->response->getStatus(), 'Error: '.$this->response->getBodyAsString()); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['image/vnd.microsoft.icon'], @@ -164,7 +162,7 @@ class PluginTest extends DAV\AbstractServer $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(404, $this->response->getStatus(), 'Error: '.$this->response->body); + $this->assertEquals(404, $this->response->getStatus(), 'Error: '.$this->response->getBodyAsString()); } public function testGetAssetEscapeBasePath() @@ -173,6 +171,6 @@ class PluginTest extends DAV\AbstractServer $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(404, $this->response->getStatus(), 'Error: '.$this->response->body); + $this->assertEquals(404, $this->response->getStatus(), 'Error: '.$this->response->getBodyAsString()); } } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ClientTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ClientTest.php index e9362c8e4..85a95c90e 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ClientTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ClientTest.php @@ -6,11 +6,9 @@ namespace Sabre\DAV; use Sabre\HTTP\Response; -require_once 'Sabre/DAV/ClientMock.php'; - class ClientTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setup(): void { if (!function_exists('curl_init')) { $this->markTestSkipped('CURL must be installed to test the client'); @@ -25,11 +23,9 @@ class ClientTest extends \PHPUnit\Framework\TestCase $this->assertInstanceOf('Sabre\DAV\ClientMock', $client); } - /** - * @expectedException \InvalidArgumentException - */ public function testConstructNoBaseUri() { + $this->expectException('InvalidArgumentException'); $client = new ClientMock([]); } @@ -139,11 +135,9 @@ XML; ], $request->getHeaders()); } - /** - * @expectedException \Sabre\HTTP\ClientHttpException - */ public function testPropFindError() { + $this->expectException('Sabre\HTTP\ClientHttpException'); $client = new ClientMock([ 'baseUri' => '/', ]); @@ -225,10 +219,10 @@ XML; /** * @depends testPropPatch - * @expectedException \Sabre\HTTP\ClientHttpException */ public function testPropPatchHTTPError() { + $this->expectException('Sabre\HTTP\ClientHttpException'); $client = new ClientMock([ 'baseUri' => '/', ]); @@ -239,10 +233,10 @@ XML; /** * @depends testPropPatch - * @expectedException \Sabre\HTTP\ClientException */ public function testPropPatchMultiStatusError() { + $this->expectException('Sabre\HTTP\ClientException'); $client = new ClientMock([ 'baseUri' => '/', ]); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php index 4bc79b597..2b759e5d0 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php @@ -4,16 +4,14 @@ declare(strict_types=1); namespace Sabre\DAV\FSExt; -require_once 'Sabre/TestUtil.php'; - class FileTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setup(): void { file_put_contents(SABRE_TEMPDIR.'/file.txt', 'Contents'); } - public function tearDown() + public function teardown(): void { \Sabre\TestUtil::clearTempDir(); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/ServerTest.php b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/ServerTest.php index daa04c354..79ffb0186 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/ServerTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/ServerTest.php @@ -7,8 +7,6 @@ namespace Sabre\DAV\FSExt; use Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/DAV/AbstractServer.php'; - class ServerTest extends DAV\AbstractServer { protected function getRootNode() @@ -34,7 +32,7 @@ class ServerTest extends DAV\AbstractServer $this->response->getHeaders() ); - $this->assertEquals('Test contents', stream_get_contents($this->response->body)); + $this->assertEquals('Test contents', $this->response->getBodyAsString()); } public function testHEAD() @@ -55,7 +53,7 @@ class ServerTest extends DAV\AbstractServer ); $this->assertEquals(200, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); } public function testPut() @@ -73,7 +71,7 @@ class ServerTest extends DAV\AbstractServer ], $this->response->getHeaders()); $this->assertEquals(201, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals('Testing new file', file_get_contents($filename)); } @@ -105,7 +103,7 @@ class ServerTest extends DAV\AbstractServer ], $this->response->getHeaders()); $this->assertEquals(201, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertTrue(is_dir($this->tempDir.'/testcol')); } @@ -119,7 +117,7 @@ class ServerTest extends DAV\AbstractServer $this->assertEquals('0', $this->response->getHeader('Content-Length')); $this->assertEquals(204, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals('Testing updated file', file_get_contents($this->tempDir.'/test.txt')); } @@ -135,7 +133,7 @@ class ServerTest extends DAV\AbstractServer ], $this->response->getHeaders()); $this->assertEquals(204, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertFalse(file_exists($this->tempDir.'/test.txt')); } @@ -153,7 +151,7 @@ class ServerTest extends DAV\AbstractServer 'Content-Length' => ['0'], ], $this->response->getHeaders()); $this->assertEquals(204, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertFalse(file_exists($this->tempDir.'/testcol')); } @@ -173,7 +171,7 @@ class ServerTest extends DAV\AbstractServer ], $this->response->getHeaders()); $this->assertEquals(200, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); } public function testMove() @@ -185,7 +183,7 @@ class ServerTest extends DAV\AbstractServer $this->server->exec(); $this->assertEquals(201, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals([ 'Content-Length' => ['0'], @@ -220,7 +218,7 @@ class ServerTest extends DAV\AbstractServer $this->server->exec(); $this->assertEquals(201, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals([ 'Content-Length' => ['0'], @@ -241,7 +239,7 @@ class ServerTest extends DAV\AbstractServer $this->server->exec(); $this->assertEquals(201, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals([ 'Content-Length' => ['0'], diff --git a/vendor/sabre/dav/tests/Sabre/DAV/HTTPPreferParsingTest.php b/vendor/sabre/dav/tests/Sabre/DAV/HTTPPreferParsingTest.php index d0ff77eb4..7d6825612 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/HTTPPreferParsingTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/HTTPPreferParsingTest.php @@ -145,7 +145,7 @@ BLA $response = $this->request($request); - $this->assertEquals('', $response->getBodyAsString(), 'Expected empty body: '.$response->body); + $this->assertEquals('', $response->getBodyAsString(), 'Expected empty body: '.$response->getBodyAsString()); $this->assertEquals(204, $response->status); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Issue33Test.php b/vendor/sabre/dav/tests/Sabre/DAV/Issue33Test.php index 500ad6147..36b182c44 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Issue33Test.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Issue33Test.php @@ -6,11 +6,9 @@ namespace Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/TestUtil.php'; - class Issue33Test extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setup(): void { \Sabre\TestUtil::clearTempDir(); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/FileTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/FileTest.php index 50f17a7dd..57a3255c7 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/FileTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/FileTest.php @@ -4,8 +4,6 @@ declare(strict_types=1); namespace Sabre\DAV\Locks\Backend; -require_once 'Sabre/TestUtil.php'; - class FileTest extends AbstractTest { public function getBackend() @@ -16,7 +14,7 @@ class FileTest extends AbstractTest return $backend; } - public function tearDown() + public function teardown(): void { \Sabre\TestUtil::clearTempDir(); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Locks/MSWordTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/MSWordTest.php index a2a31e87f..02c3d39ba 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/MSWordTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Locks/MSWordTest.php @@ -7,12 +7,9 @@ namespace Sabre\DAV\Locks; use Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/HTTP/ResponseMock.php'; -require_once 'Sabre/TestUtil.php'; - class MSWordTest extends \PHPUnit\Framework\TestCase { - public function tearDown() + public function teardown(): void { \Sabre\TestUtil::clearTempDir(); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php index b3a0ac9af..9279afb5a 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php @@ -7,8 +7,6 @@ namespace Sabre\DAV\Locks; use Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/DAV/AbstractServer.php'; - class PluginTest extends DAV\AbstractServer { /** @@ -16,7 +14,7 @@ class PluginTest extends DAV\AbstractServer */ protected $locksPlugin; - public function setUp() + public function setup(): void { parent::setUp(); $locksBackend = new Backend\File(SABRE_TEMPDIR.'/locksdb'); @@ -77,9 +75,9 @@ class PluginTest extends DAV\AbstractServer $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); $this->assertTrue(1 === preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - $this->assertEquals(200, $this->response->status, 'Got an incorrect status back. Response body: '.$this->response->body); + $this->assertEquals(200, $this->response->status, 'Got an incorrect status back. Response body: '.$this->response->getBodyAsString()); - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->body); + $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); $xml = simplexml_load_string($body); $xml->registerXPathNamespace('d', 'urn:DAV'); @@ -102,7 +100,7 @@ class PluginTest extends DAV\AbstractServer foreach ($elements as $elem) { $data = $xml->xpath($elem); - $this->assertEquals(1, count($data), 'We expected 1 match for the xpath expression "'.$elem.'". '.count($data).' were found. Full response body: '.$this->response->body); + $this->assertEquals(1, count($data), 'We expected 1 match for the xpath expression "'.$elem.'". '.count($data).' were found. Full response body: '.$this->response->getBodyAsString()); } $depth = $xml->xpath('/d:prop/d:lockdiscovery/d:activelock/d:depth'); @@ -112,6 +110,32 @@ class PluginTest extends DAV\AbstractServer $this->assertEquals($this->response->getHeader('Lock-Token'), '<'.(string) $token[0].'>', 'Token in response body didn\'t match token in response header.'); } + public function testLockWithContext() + { + $request = new HTTP\Request('LOCK', '/baseuri/test.txt'); + $request->setBody('<?xml version="1.0"?> +<D:lockinfo xmlns:D="DAV:"> + <D:lockscope><D:exclusive/></D:lockscope> + <D:locktype><D:write/></D:locktype> + <D:owner> + <D:href>http://example.org/~ejw/contact.html</D:href> + </D:owner> +</D:lockinfo>'); + + $this->server->setBaseUri('baseuri'); + $this->server->httpRequest = $request; + $this->server->exec(); + + $this->assertEquals(200, $this->response->status, 'Got an incorrect status back. Response body: '.$this->response->getBodyAsString()); + + $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); + $xml = simplexml_load_string($body); + $xml->registerXPathNamespace('d', 'urn:DAV'); + + $lockRoot = $xml->xpath('/d:prop/d:lockdiscovery/d:activelock/d:lockroot/d:href'); + $this->assertEquals('baseuri/test.txt', (string) $lockRoot[0]); + } + /** * @depends testLock */ @@ -137,7 +161,7 @@ class PluginTest extends DAV\AbstractServer $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertEquals(423, $this->response->status, 'Full response: '.$this->response->body); + $this->assertEquals(423, $this->response->status, 'Full response: '.$this->response->getBodyAsString()); } /** @@ -267,7 +291,7 @@ class PluginTest extends DAV\AbstractServer $this->response->getHeaders() ); - $this->assertEquals(409, $this->response->status, 'Got an incorrect status code. Full response body: '.$this->response->body); + $this->assertEquals(409, $this->response->status, 'Got an incorrect status code. Full response body: '.$this->response->getBodyAsString()); } /** @@ -329,7 +353,7 @@ class PluginTest extends DAV\AbstractServer $this->server->httpResponse = new HTTP\ResponseMock(); $this->server->invokeMethod($request, $this->server->httpResponse); - $this->assertEquals(204, $this->server->httpResponse->status, 'Got an incorrect status code. Full response body: '.$this->response->body); + $this->assertEquals(204, $this->server->httpResponse->status, 'Got an incorrect status code. Full response body: '.$this->response->getBodyAsString()); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Length' => ['0'], @@ -366,7 +390,7 @@ class PluginTest extends DAV\AbstractServer $this->server->httpResponse = new HTTP\ResponseMock(); $this->server->invokeMethod($request, $this->server->httpResponse); - $this->assertEquals(204, $this->server->httpResponse->status, 'Got an incorrect status code. Full response body: '.$this->response->body); + $this->assertEquals(204, $this->server->httpResponse->status, 'Got an incorrect status code. Full response body: '.$this->response->getBodyAsString()); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Length' => ['0'], @@ -629,7 +653,7 @@ class PluginTest extends DAV\AbstractServer $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(201, $this->response->status, 'A valid lock-token was provided for the source, so this MOVE operation must succeed. Full response body: '.$this->response->body); + $this->assertEquals(201, $this->response->status, 'A valid lock-token was provided for the source, so this MOVE operation must succeed. Full response body: '.$this->response->getBodyAsString()); } /** @@ -809,7 +833,7 @@ class PluginTest extends DAV\AbstractServer $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(204, $this->response->status, 'Incorrect status received. Full response body:'.$this->response->body); + $this->assertEquals(204, $this->response->status, 'Incorrect status received. Full response body:'.$this->response->getBodyAsString()); } public function testDeleteWithETagOnCollection() @@ -851,11 +875,9 @@ class PluginTest extends DAV\AbstractServer $this->assertEquals(LockInfo::TIMEOUT_INFINITE, $this->locksPlugin->getTimeoutHeader()); } - /** - * @expectedException \Sabre\DAV\Exception\BadRequest - */ public function testGetTimeoutHeaderInvalid() { + $this->expectException('Sabre\DAV\Exception\BadRequest'); $request = new HTTP\Request('GET', '/', ['Timeout' => 'yourmom']); $this->server->httpRequest = $request; diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Mock/Collection.php b/vendor/sabre/dav/tests/Sabre/DAV/Mock/Collection.php index e0bdecc09..041274706 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Mock/Collection.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Mock/Collection.php @@ -31,7 +31,6 @@ class Collection extends DAV\Collection * Creates the object. * * @param string $name - * @param array $children * @param Collection $parent */ public function __construct($name, array $children = [], Collection $parent = null) @@ -88,8 +87,11 @@ class Collection extends DAV\Collection * * @return string|null */ - public function createFile($name, $data = '') + public function createFile($name, $data = null) { + if (null === $data) { + $data = ''; + } if (is_resource($data)) { $data = stream_get_contents($data); } @@ -120,8 +122,6 @@ class Collection extends DAV\Collection /** * Adds an already existing node to this collection. - * - * @param \Sabre\DAV\INode $node */ public function addNode(\Sabre\DAV\INode $node) { diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php index c993e609d..54f7e4cb4 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php @@ -7,11 +7,9 @@ namespace Sabre\DAV\Mount; use Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/DAV/AbstractServer.php'; - class PluginTest extends DAV\AbstractServer { - public function setUp() + public function setup(): void { parent::setUp(); $this->server->addPlugin(new Plugin()); @@ -28,7 +26,7 @@ class PluginTest extends DAV\AbstractServer $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(501, $this->response->status, 'We expected GET to not be implemented for Directories. Response body: '.$this->response->body); + $this->assertEquals(501, $this->response->status, 'We expected GET to not be implemented for Directories. Response body: '.$this->response->getBodyAsString()); } public function testMountResponse() @@ -46,8 +44,8 @@ class PluginTest extends DAV\AbstractServer $this->assertEquals(200, $this->response->status); - $xml = simplexml_load_string($this->response->body); - $this->assertInstanceOf('SimpleXMLElement', $xml, 'Response was not a valid xml document. The list of errors:'.print_r(libxml_get_errors(), true).'. xml body: '.$this->response->body.'. What type we got: '.gettype($xml).' class, if object: '.get_class($xml)); + $xml = simplexml_load_string($this->response->getBodyAsString()); + $this->assertInstanceOf('SimpleXMLElement', $xml, 'Response was not a valid xml document. The list of errors:'.print_r(libxml_get_errors(), true).'. xml body: '.$this->response->getBodyAsString().'. What type we got: '.gettype($xml).' class, if object: '.get_class($xml)); $xml->registerXPathNamespace('dm', 'http://purl.org/NET/webdav/mount'); $url = $xml->xpath('//dm:url'); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ObjectTreeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ObjectTreeTest.php index 6b6652967..7066c49fc 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ObjectTreeTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ObjectTreeTest.php @@ -4,13 +4,11 @@ declare(strict_types=1); namespace Sabre\DAV; -require_once 'Sabre/TestUtil.php'; - class ObjectTreeTest extends \PHPUnit\Framework\TestCase { protected $tree; - public function setup() + public function setup(): void { \Sabre\TestUtil::clearTempDir(); mkdir(SABRE_TEMPDIR.'/root'); @@ -21,7 +19,7 @@ class ObjectTreeTest extends \PHPUnit\Framework\TestCase $this->tree = new Tree($rootNode); } - public function teardown() + public function teardown(): void { \Sabre\TestUtil::clearTempDir(); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/PluginTest.php index 63d692ec9..4d99aee7d 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/PluginTest.php @@ -6,14 +6,12 @@ namespace Sabre\DAV\PartialUpdate; use Sabre\HTTP; -require_once 'Sabre/DAV/PartialUpdate/FileMock.php'; - class PluginTest extends \Sabre\DAVServerTest { protected $node; protected $plugin; - public function setUp() + public function setup(): void { $this->node = new FileMock(); $this->tree[] = $this->node; @@ -44,7 +42,7 @@ class PluginTest extends \Sabre\DAVServerTest ]); $response = $this->request($request); - $this->assertEquals(400, $response->status, 'Full response body:'.$response->body); + $this->assertEquals(400, $response->status, 'Full response body:'.$response->getBodyAsString()); } public function testPatchNotSupported() @@ -56,7 +54,7 @@ class PluginTest extends \Sabre\DAVServerTest ); $response = $this->request($request); - $this->assertEquals(405, $response->status, 'Full response body:'.$response->body); + $this->assertEquals(405, $response->status, 'Full response body:'.$response->getBodyAsString()); } public function testPatchNoContentType() @@ -68,7 +66,7 @@ class PluginTest extends \Sabre\DAVServerTest ); $response = $this->request($request); - $this->assertEquals(415, $response->status, 'Full response body:'.$response->body); + $this->assertEquals(415, $response->status, 'Full response body:'.$response->getBodyAsString()); } public function testPatchBadRange() @@ -80,7 +78,7 @@ class PluginTest extends \Sabre\DAVServerTest ); $response = $this->request($request); - $this->assertEquals(416, $response->status, 'Full response body:'.$response->body); + $this->assertEquals(416, $response->status, 'Full response body:'.$response->getBodyAsString()); } public function testPatchNoLength() @@ -92,7 +90,7 @@ class PluginTest extends \Sabre\DAVServerTest ); $response = $this->request($request); - $this->assertEquals(411, $response->status, 'Full response body:'.$response->body); + $this->assertEquals(411, $response->status, 'Full response body:'.$response->getBodyAsString()); } public function testPatchSuccess() @@ -104,7 +102,7 @@ class PluginTest extends \Sabre\DAVServerTest ); $response = $this->request($request); - $this->assertEquals(204, $response->status, 'Full response body:'.$response->body); + $this->assertEquals(204, $response->status, 'Full response body:'.$response->getBodyAsString()); $this->assertEquals('aaabbbaa', $this->node->get()); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php b/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php index 56b2d576f..a727a13e2 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php @@ -18,7 +18,7 @@ class SpecificationTest extends \PHPUnit\Framework\TestCase { protected $server; - public function setUp() + public function setup(): void { $tree = [ new File(SABRE_TEMPDIR.'/foobar.txt'), @@ -32,7 +32,7 @@ class SpecificationTest extends \PHPUnit\Framework\TestCase $this->server = $server; } - public function tearDown() + public function teardown(): void { \Sabre\TestUtil::clearTempDir(); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerEventsTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerEventsTest.php index 7d55ea02e..b1f6754ea 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerEventsTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerEventsTest.php @@ -6,8 +6,6 @@ namespace Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/DAV/AbstractServer.php'; - class ServerEventsTest extends AbstractServer { private $tempPath; diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerMKCOLTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerMKCOLTest.php index 8e5bc6a64..02c6a4633 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerMKCOLTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerMKCOLTest.php @@ -26,7 +26,7 @@ class ServerMKCOLTest extends AbstractServer ], $this->response->getHeaders()); $this->assertEquals(201, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertTrue(is_dir($this->tempDir.'/testcol')); } @@ -129,7 +129,7 @@ class ServerMKCOLTest extends AbstractServer 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders()); - $this->assertEquals(400, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->body); + $this->assertEquals(400, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -160,7 +160,7 @@ class ServerMKCOLTest extends AbstractServer 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders()); - $this->assertEquals(403, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->body); + $this->assertEquals(403, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -191,7 +191,7 @@ class ServerMKCOLTest extends AbstractServer 'Content-Length' => ['0'], ], $this->response->getHeaders()); - $this->assertEquals(201, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->body); + $this->assertEquals(201, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -224,7 +224,7 @@ class ServerMKCOLTest extends AbstractServer 'Content-Length' => ['0'], ], $this->response->getHeaders()); - $this->assertEquals(201, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->body); + $this->assertEquals(201, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -248,7 +248,7 @@ class ServerMKCOLTest extends AbstractServer 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders()); - $this->assertEquals(409, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->body); + $this->assertEquals(409, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -272,7 +272,7 @@ class ServerMKCOLTest extends AbstractServer 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders()); - $this->assertEquals(409, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->body); + $this->assertEquals(409, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -297,7 +297,7 @@ class ServerMKCOLTest extends AbstractServer 'Allow' => ['OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, COPY, MOVE, REPORT'], ], $this->response->getHeaders()); - $this->assertEquals(405, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->body); + $this->assertEquals(405, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -323,15 +323,14 @@ class ServerMKCOLTest extends AbstractServer $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(207, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->body); + $bodyAsString = $this->response->getBodyAsString(); + $this->assertEquals(207, $this->response->status, 'Wrong statuscode received. Full response body: '.$bodyAsString); $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders()); - $responseBody = $this->response->getBodyAsString(); - $expected = <<<XML <?xml version="1.0"?> <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> @@ -349,7 +348,7 @@ XML; $this->assertXmlStringEqualsXmlString( $expected, - $responseBody + $bodyAsString ); } } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerPluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerPluginTest.php index 35de59e37..47e1e6b4c 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerPluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerPluginTest.php @@ -6,9 +6,6 @@ namespace Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/DAV/AbstractServer.php'; -require_once 'Sabre/DAV/TestPlugin.php'; - class ServerPluginTest extends AbstractServer { /** @@ -16,7 +13,7 @@ class ServerPluginTest extends AbstractServer */ protected $testPlugin; - public function setUp() + public function setup(): void { parent::setUp(); @@ -60,7 +57,7 @@ class ServerPluginTest extends AbstractServer ], $this->response->getHeaders()); $this->assertEquals(200, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals('OPTIONS', $this->testPlugin->beforeMethod); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerPreconditionTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerPreconditionTest.php deleted file mode 100644 index fa88e9095..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerPreconditionTest.php +++ /dev/null @@ -1,283 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -use Sabre\HTTP; - -require_once 'Sabre/HTTP/ResponseMock.php'; - -class ServerPreconditionsTest extends \PHPUnit\Framework\TestCase -{ - /** - * @expectedException \Sabre\DAV\Exception\PreconditionFailed - */ - public function testIfMatchNoNode() - { - $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); - $server = new Server($root); - $httpRequest = new HTTP\Request('GET', '/bar', ['If-Match' => '*']); - $httpResponse = new HTTP\Response(); - $server->checkPreconditions($httpRequest, $httpResponse); - } - - public function testIfMatchHasNode() - { - $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); - $server = new Server($root); - $httpRequest = new HTTP\Request('GET', '/foo', ['If-Match' => '*']); - $httpResponse = new HTTP\Response(); - $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); - } - - /** - * @expectedException \Sabre\DAV\Exception\PreconditionFailed - */ - public function testIfMatchWrongEtag() - { - $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); - $server = new Server($root); - $httpRequest = new HTTP\Request('GET', '/foo', ['If-Match' => '1234']); - $httpResponse = new HTTP\Response(); - $server->checkPreconditions($httpRequest, $httpResponse); - } - - public function testIfMatchCorrectEtag() - { - $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); - $server = new Server($root); - $httpRequest = new HTTP\Request('GET', '/foo', ['If-Match' => '"abc123"']); - $httpResponse = new HTTP\Response(); - $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); - } - - /** - * Evolution sometimes uses \" instead of " for If-Match headers. - * - * @depends testIfMatchCorrectEtag - */ - public function testIfMatchEvolutionEtag() - { - $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); - $server = new Server($root); - $httpRequest = new HTTP\Request('GET', '/foo', ['If-Match' => '\\"abc123\\"']); - $httpResponse = new HTTP\Response(); - $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); - } - - public function testIfMatchMultiple() - { - $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); - $server = new Server($root); - $httpRequest = new HTTP\Request('GET', '/foo', ['If-Match' => '"hellothere", "abc123"']); - $httpResponse = new HTTP\Response(); - $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); - } - - public function testIfNoneMatchNoNode() - { - $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); - $server = new Server($root); - $httpRequest = new HTTP\Request('GET', '/bar', ['If-None-Match' => '*']); - $httpResponse = new HTTP\Response(); - $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); - } - - /** - * @expectedException \Sabre\DAV\Exception\PreconditionFailed - */ - public function testIfNoneMatchHasNode() - { - $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); - $server = new Server($root); - $httpRequest = new HTTP\Request('POST', '/foo', ['If-None-Match' => '*']); - $httpResponse = new HTTP\Response(); - $server->checkPreconditions($httpRequest, $httpResponse); - } - - public function testIfNoneMatchWrongEtag() - { - $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); - $server = new Server($root); - $httpRequest = new HTTP\Request('POST', '/foo', ['If-None-Match' => '"1234"']); - $httpResponse = new HTTP\Response(); - $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); - } - - public function testIfNoneMatchWrongEtagMultiple() - { - $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); - $server = new Server($root); - $httpRequest = new HTTP\Request('POST', '/foo', ['If-None-Match' => '"1234", "5678"']); - $httpResponse = new HTTP\Response(); - $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); - } - - /** - * @expectedException \Sabre\DAV\Exception\PreconditionFailed - */ - public function testIfNoneMatchCorrectEtag() - { - $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); - $server = new Server($root); - $httpRequest = new HTTP\Request('POST', '/foo', ['If-None-Match' => '"abc123"']); - $httpResponse = new HTTP\Response(); - $server->checkPreconditions($httpRequest, $httpResponse); - } - - /** - * @expectedException \Sabre\DAV\Exception\PreconditionFailed - */ - public function testIfNoneMatchCorrectEtagMultiple() - { - $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); - $server = new Server($root); - $httpRequest = new HTTP\Request('POST', '/foo', ['If-None-Match' => '"1234, "abc123"']); - $httpResponse = new HTTP\Response(); - $server->checkPreconditions($httpRequest, $httpResponse); - } - - public function testIfNoneMatchCorrectEtagAsGet() - { - $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); - $server = new Server($root); - $httpRequest = new HTTP\Request('GET', '/foo', ['If-None-Match' => '"abc123"']); - $server->httpResponse = new HTTP\ResponseMock(); - - $this->assertFalse($server->checkPreconditions($httpRequest, $server->httpResponse)); - $this->assertEquals(304, $server->httpResponse->getStatus()); - $this->assertEquals(['ETag' => ['"abc123"']], $server->httpResponse->getHeaders()); - } - - /** - * This was a test written for issue #515. - */ - public function testNoneMatchCorrectEtagEnsureSapiSent() - { - $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); - $server = new Server($root); - $server->sapi = new HTTP\SapiMock(); - HTTP\SapiMock::$sent = 0; - $httpRequest = new HTTP\Request('GET', '/foo', ['If-None-Match' => '"abc123"']); - $server->httpRequest = $httpRequest; - $server->httpResponse = new HTTP\ResponseMock(); - - $server->exec(); - - $this->assertFalse($server->checkPreconditions($httpRequest, $server->httpResponse)); - $this->assertEquals(304, $server->httpResponse->getStatus()); - $this->assertEquals([ - 'ETag' => ['"abc123"'], - 'X-Sabre-Version' => [Version::VERSION], - ], $server->httpResponse->getHeaders()); - $this->assertEquals(1, HTTP\SapiMock::$sent); - } - - public function testIfModifiedSinceUnModified() - { - $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); - $server = new Server($root); - $httpRequest = new HTTP\Request('GET', '/foo', [ - 'If-Modified-Since' => 'Sun, 06 Nov 1994 08:49:37 GMT', - ]); - $server->httpResponse = new HTTP\ResponseMock(); - $this->assertFalse($server->checkPreconditions($httpRequest, $server->httpResponse)); - - $this->assertEquals(304, $server->httpResponse->status); - $this->assertEquals([ - 'Last-Modified' => ['Sat, 06 Apr 1985 23:30:00 GMT'], - ], $server->httpResponse->getHeaders()); - } - - public function testIfModifiedSinceModified() - { - $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); - $server = new Server($root); - $httpRequest = new HTTP\Request('GET', '/foo', [ - 'If-Modified-Since' => 'Tue, 06 Nov 1984 08:49:37 GMT', - ]); - - $httpResponse = new HTTP\ResponseMock(); - $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); - } - - public function testIfModifiedSinceInvalidDate() - { - $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); - $server = new Server($root); - $httpRequest = new HTTP\Request('GET', '/foo', [ - 'If-Modified-Since' => 'Your mother', - ]); - $httpResponse = new HTTP\ResponseMock(); - - // Invalid dates must be ignored, so this should return true - $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); - } - - public function testIfModifiedSinceInvalidDate2() - { - $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); - $server = new Server($root); - $httpRequest = new HTTP\Request('GET', '/foo', [ - 'If-Unmodified-Since' => 'Sun, 06 Nov 1994 08:49:37 EST', - ]); - $httpResponse = new HTTP\ResponseMock(); - $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); - } - - public function testIfUnmodifiedSinceUnModified() - { - $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); - $server = new Server($root); - $httpRequest = new HTTP\Request('GET', '/foo', [ - 'If-Unmodified-Since' => 'Sun, 06 Nov 1994 08:49:37 GMT', - ]); - $httpResponse = new HTTP\Response(); - $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); - } - - /** - * @expectedException \Sabre\DAV\Exception\PreconditionFailed - */ - public function testIfUnmodifiedSinceModified() - { - $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); - $server = new Server($root); - $httpRequest = new HTTP\Request('GET', '/foo', [ - 'If-Unmodified-Since' => 'Tue, 06 Nov 1984 08:49:37 GMT', - ]); - $httpResponse = new HTTP\ResponseMock(); - $server->checkPreconditions($httpRequest, $httpResponse); - } - - public function testIfUnmodifiedSinceInvalidDate() - { - $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); - $server = new Server($root); - $httpRequest = new HTTP\Request('GET', '/foo', [ - 'If-Unmodified-Since' => 'Sun, 06 Nov 1984 08:49:37 CET', - ]); - $httpResponse = new HTTP\ResponseMock(); - $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); - } -} - -class ServerPreconditionsNode extends File -{ - public function getETag() - { - return '"abc123"'; - } - - public function getLastModified() - { - /* my birthday & time, I believe */ - return strtotime('1985-04-07 01:30 +02:00'); - } - - public function getName() - { - return 'foo'; - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php index 462fba664..cd1ccfa53 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php @@ -6,9 +6,6 @@ namespace Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/HTTP/ResponseMock.php'; -require_once 'Sabre/DAV/AbstractServer.php'; - class ServerPropsTest extends AbstractServer { protected function getRootNode() @@ -16,7 +13,7 @@ class ServerPropsTest extends AbstractServer return new FSExt\Directory(SABRE_TEMPDIR); } - public function setUp() + public function setup(): void { if (file_exists(SABRE_TEMPDIR.'../.sabredav')) { unlink(SABRE_TEMPDIR.'../.sabredav'); @@ -28,7 +25,7 @@ class ServerPropsTest extends AbstractServer $this->server->addPlugin(new Locks\Plugin(new Locks\Backend\File(SABRE_TEMPDIR.'/.locksdb'))); } - public function tearDown() + public function teardown(): void { parent::tearDown(); if (file_exists(SABRE_TEMPDIR.'../.locksdb')) { @@ -58,7 +55,7 @@ class ServerPropsTest extends AbstractServer $this->response->getHeaders() ); - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->body); + $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); $xml = simplexml_load_string($body); $xml->registerXPathNamespace('d', 'urn:DAV'); @@ -83,7 +80,7 @@ class ServerPropsTest extends AbstractServer $this->response->getHeaders() ); - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->body); + $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); $xml = simplexml_load_string($body); $xml->registerXPathNamespace('d', 'urn:DAV'); @@ -105,7 +102,7 @@ class ServerPropsTest extends AbstractServer $this->sendRequest($xml); - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->body); + $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); $xml = simplexml_load_string($body); $xml->registerXPathNamespace('d', 'urn:DAV'); @@ -139,7 +136,7 @@ class ServerPropsTest extends AbstractServer $this->sendRequest($xml); - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->body); + $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); $xml = simplexml_load_string($body); $xml->registerXPathNamespace('d', 'urn:DAV'); @@ -157,7 +154,7 @@ class ServerPropsTest extends AbstractServer </d:propfind>'; $this->sendRequest($xml); - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->body); + $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); $xml = simplexml_load_string($body); $xml->registerXPathNamespace('d', 'urn:DAV'); $pathTests = [ diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerRangeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerRangeTest.php index 93ea083d8..6d5be4608 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerRangeTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerRangeTest.php @@ -23,7 +23,7 @@ class ServerRangeTest extends \Sabre\DAVServerTest */ protected $lastModified; - public function setUp() + public function setup(): void { parent::setUp(); $this->server->createFile('files/test.txt', 'Test contents'); @@ -133,7 +133,7 @@ class ServerRangeTest extends \Sabre\DAVServerTest $request = new HTTP\Request('GET', '/files/no-seeking.txt', ['Range' => 'bytes=2-5']); $response = $this->request($request); - $this->assertEquals(206, $response->getStatus(), $response); + $this->assertEquals(206, $response->getStatus()); $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], 'Content-Type' => ['application/octet-stream'], diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerSimpleTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerSimpleTest.php index 53153151b..e4dd3cdb6 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerSimpleTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerSimpleTest.php @@ -18,11 +18,9 @@ class ServerSimpleTest extends AbstractServer $this->assertEquals($nodes[0], $server->tree->getNodeForPath('hello')); } - /** - * @expectedException \Sabre\DAV\Exception - */ public function testConstructInvalidArg() { + $this->expectException('Sabre\DAV\Exception'); $server = new Server(1); } @@ -42,7 +40,7 @@ class ServerSimpleTest extends AbstractServer ], $this->response->getHeaders()); $this->assertEquals(200, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); } public function testOptionsUnmapped() @@ -62,7 +60,7 @@ class ServerSimpleTest extends AbstractServer ], $this->response->getHeaders()); $this->assertEquals(200, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); } public function testNonExistantMethod() @@ -189,11 +187,9 @@ class ServerSimpleTest extends AbstractServer } } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testCalculateUriBreakout() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $uri = '/path1/'; $this->server->setBaseUri('/path2/'); @@ -311,10 +307,10 @@ class ServerSimpleTest extends AbstractServer /** * @depends testGuessBaseUri - * @expectedException \Sabre\DAV\Exception */ public function testGuessBaseUriBadConfig() { + $this->expectException('Sabre\DAV\Exception'); $serverVars = [ 'REQUEST_METHOD' => 'GET', 'REQUEST_URI' => '/index.php/root/heyyy', @@ -371,7 +367,7 @@ class ServerSimpleTest extends AbstractServer $this->response->getHeaders() ); - $this->assertEquals(415, $this->response->status, 'We got an incorrect status back. Full response body follows: '.$this->response->body); + $this->assertEquals(415, $this->response->status, 'We got an incorrect status back. Full response body follows: '.$this->response->getBodyAsString()); } public function testReportIntercepted() @@ -394,7 +390,7 @@ class ServerSimpleTest extends AbstractServer $this->response->getHeaders() ); - $this->assertEquals(418, $this->response->status, 'We got an incorrect status back. Full response body follows: '.$this->response->body); + $this->assertEquals(418, $this->response->status, 'We got an incorrect status back. Full response body follows: '.$this->response->getBodyAsString()); } public function reportHandler($reportName, $result, $path) diff --git a/vendor/sabre/dav/tests/Sabre/DAV/StringUtilTest.php b/vendor/sabre/dav/tests/Sabre/DAV/StringUtilTest.php index 1e4b92197..bc36c6b78 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/StringUtilTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/StringUtilTest.php @@ -72,19 +72,15 @@ class StringUtilTest extends \PHPUnit\Framework\TestCase ]; } - /** - * @expectedException \Sabre\DAV\Exception\BadRequest - */ public function testBadCollation() { + $this->expectException('Sabre\DAV\Exception\BadRequest'); StringUtil::textMatch('foobar', 'foo', 'blabla', 'contains'); } - /** - * @expectedException \Sabre\DAV\Exception\BadRequest - */ public function testBadMatchType() { + $this->expectException('Sabre\DAV\Exception\BadRequest'); StringUtil::textMatch('foobar', 'foo', 'i;octet', 'booh'); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/TemporaryFileFilterTest.php b/vendor/sabre/dav/tests/Sabre/DAV/TemporaryFileFilterTest.php index 352c8a3e7..951078bf0 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/TemporaryFileFilterTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/TemporaryFileFilterTest.php @@ -8,7 +8,7 @@ use Sabre\HTTP; class TemporaryFileFilterTest extends AbstractServer { - public function setUp() + public function setup(): void { parent::setUp(); $plugin = new TemporaryFileFilterPlugin(SABRE_TEMPDIR.'/tff'); @@ -22,7 +22,7 @@ class TemporaryFileFilterTest extends AbstractServer $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals(201, $this->response->status); $this->assertEquals('0', $this->response->getHeader('Content-Length')); @@ -37,7 +37,7 @@ class TemporaryFileFilterTest extends AbstractServer $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals(201, $this->response->status); $this->assertEquals([ 'X-Sabre-Temp' => ['true'], @@ -54,7 +54,7 @@ class TemporaryFileFilterTest extends AbstractServer $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals(201, $this->response->status); $this->assertEquals([ 'X-Sabre-Temp' => ['true'], @@ -78,7 +78,7 @@ class TemporaryFileFilterTest extends AbstractServer $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals(201, $this->response->status); $this->assertEquals([ 'X-Sabre-Temp' => ['true'], @@ -147,7 +147,7 @@ class TemporaryFileFilterTest extends AbstractServer $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals(201, $this->response->status); $this->assertEquals([ 'X-Sabre-Temp' => ['true'], @@ -157,12 +157,12 @@ class TemporaryFileFilterTest extends AbstractServer $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(204, $this->response->status, "Incorrect status code received. Full body:\n".$this->response->body); + $this->assertEquals(204, $this->response->status, "Incorrect status code received. Full body:\n".$this->response->getBodyAsString()); $this->assertEquals([ 'X-Sabre-Temp' => ['true'], ], $this->response->getHeaders()); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); } public function testPutPropfind() @@ -172,7 +172,8 @@ class TemporaryFileFilterTest extends AbstractServer $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('', $this->response->body); + $bodyAsString = $this->response->getBodyAsString(); + $this->assertEquals('', $bodyAsString); $this->assertEquals(201, $this->response->status); $this->assertEquals([ 'X-Sabre-Temp' => ['true'], @@ -183,13 +184,14 @@ class TemporaryFileFilterTest extends AbstractServer $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(207, $this->response->status, 'Incorrect status code returned. Body: '.$this->response->body); + $bodyAsString = $this->response->getBodyAsString(); + $this->assertEquals(207, $this->response->status, 'Incorrect status code returned. Body: '.$bodyAsString); $this->assertEquals([ 'X-Sabre-Temp' => ['true'], 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders()); - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->body); + $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $bodyAsString); $xml = simplexml_load_string($body); $xml->registerXPathNamespace('d', 'urn:DAV'); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php index 51ff5ccde..e3f04ea3a 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php @@ -203,8 +203,6 @@ class TreeFileTester extends File implements IProperties * * To update specific properties, call the 'handle' method on this object. * Read the PropPatch documentation for more information. - * - * @param PropPatch $propPatch */ public function propPatch(PropPatch $propPatch) { @@ -221,8 +219,6 @@ class TreeMultiGetTester extends TreeDirectoryTester implements IMultiGet * * If any children are not found, you do not have to return them. * - * @param array $paths - * * @return array */ public function getMultipleChildren(array $paths) diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/ACLMethodTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/ACLMethodTest.php index 3627991bf..715559df3 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/ACLMethodTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/ACLMethodTest.php @@ -9,11 +9,9 @@ use Sabre\HTTP; class ACLMethodTest extends \PHPUnit\Framework\TestCase { - /** - * @expectedException \Sabre\DAV\Exception\BadRequest - */ public function testCallback() { + $this->expectException('Sabre\DAV\Exception\BadRequest'); $acl = new Plugin(); $server = new DAV\Server(); $server->addPlugin(new DAV\Auth\Plugin()); @@ -23,11 +21,11 @@ class ACLMethodTest extends \PHPUnit\Framework\TestCase } /** - /** - * @expectedException \Sabre\DAV\Exception\MethodNotAllowed + /** */ public function testNotSupportedByNode() { + $this->expectException('Sabre\DAV\Exception\MethodNotAllowed'); $tree = [ new DAV\SimpleCollection('test'), ]; @@ -64,11 +62,9 @@ class ACLMethodTest extends \PHPUnit\Framework\TestCase $this->assertFalse($acl->httpACL($server->httpRequest, $server->httpResponse)); } - /** - * @expectedException \Sabre\DAVACL\Exception\NotRecognizedPrincipal - */ public function testUnrecognizedPrincipal() { + $this->expectException('Sabre\DAVACL\Exception\NotRecognizedPrincipal'); $tree = [ new MockACLNode('test', []), ]; @@ -89,11 +85,9 @@ class ACLMethodTest extends \PHPUnit\Framework\TestCase $acl->httpACL($server->httpRequest, $server->httpResponse); } - /** - * @expectedException \Sabre\DAVACL\Exception\NotRecognizedPrincipal - */ public function testUnrecognizedPrincipal2() { + $this->expectException('Sabre\DAVACL\Exception\NotRecognizedPrincipal'); $tree = [ new MockACLNode('test', []), new DAV\SimpleCollection('principals', [ @@ -117,11 +111,9 @@ class ACLMethodTest extends \PHPUnit\Framework\TestCase $acl->httpACL($server->httpRequest, $server->httpResponse); } - /** - * @expectedException \Sabre\DAVACL\Exception\NotSupportedPrivilege - */ public function testUnknownPrivilege() { + $this->expectException('Sabre\DAVACL\Exception\NotSupportedPrivilege'); $tree = [ new MockACLNode('test', []), ]; @@ -142,11 +134,9 @@ class ACLMethodTest extends \PHPUnit\Framework\TestCase $acl->httpACL($server->httpRequest, $server->httpResponse); } - /** - * @expectedException \Sabre\DAVACL\Exception\NoAbstract - */ public function testAbstractPrivilege() { + $this->expectException('Sabre\DAVACL\Exception\NoAbstract'); $tree = [ new MockACLNode('test', []), ]; @@ -170,11 +160,9 @@ class ACLMethodTest extends \PHPUnit\Framework\TestCase $acl->httpACL($server->httpRequest, $server->httpResponse); } - /** - * @expectedException \Sabre\DAVACL\Exception\AceConflict - */ public function testUpdateProtectedPrivilege() { + $this->expectException('Sabre\DAVACL\Exception\AceConflict'); $oldACL = [ [ 'principal' => 'principals/notfound', @@ -203,11 +191,9 @@ class ACLMethodTest extends \PHPUnit\Framework\TestCase $acl->httpACL($server->httpRequest, $server->httpResponse); } - /** - * @expectedException \Sabre\DAVACL\Exception\AceConflict - */ public function testUpdateProtectedPrivilege2() { + $this->expectException('Sabre\DAVACL\Exception\AceConflict'); $oldACL = [ [ 'principal' => 'principals/notfound', @@ -236,11 +222,9 @@ class ACLMethodTest extends \PHPUnit\Framework\TestCase $acl->httpACL($server->httpRequest, $server->httpResponse); } - /** - * @expectedException \Sabre\DAVACL\Exception\AceConflict - */ public function testUpdateProtectedPrivilege3() { + $this->expectException('Sabre\DAVACL\Exception\AceConflict'); $oldACL = [ [ 'principal' => 'principals/notfound', diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/AllowAccessTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/AllowAccessTest.php index 724abc685..04dd29c04 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/AllowAccessTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/AllowAccessTest.php @@ -13,7 +13,7 @@ class AllowAccessTest extends \PHPUnit\Framework\TestCase */ protected $server; - public function setUp() + public function setup(): void { $nodes = [ new DAV\Mock\Collection('testdir', [ diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php index 3c3aaf6c9..566167ef0 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php @@ -14,7 +14,7 @@ class BlockAccessTest extends \PHPUnit\Framework\TestCase protected $server; protected $plugin; - public function setUp() + public function setup(): void { $nodes = [ new DAV\SimpleCollection('testdir'), @@ -36,11 +36,9 @@ class BlockAccessTest extends \PHPUnit\Framework\TestCase $this->server->addPlugin($this->plugin); } - /** - * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges - */ public function testGet() { + $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->httpRequest->setMethod('GET'); $this->server->httpRequest->setUrl('/testdir'); @@ -56,107 +54,87 @@ class BlockAccessTest extends \PHPUnit\Framework\TestCase $this->assertTrue($r); } - /** - * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges - */ public function testHEAD() { + $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->httpRequest->setMethod('HEAD'); $this->server->httpRequest->setUrl('/testdir'); $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } - /** - * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges - */ public function testOPTIONS() { + $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->httpRequest->setMethod('OPTIONS'); $this->server->httpRequest->setUrl('/testdir'); $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } - /** - * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges - */ public function testPUT() { + $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->httpRequest->setMethod('PUT'); $this->server->httpRequest->setUrl('/testdir'); $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } - /** - * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges - */ public function testPROPPATCH() { + $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->httpRequest->setMethod('PROPPATCH'); $this->server->httpRequest->setUrl('/testdir'); $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } - /** - * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges - */ public function testCOPY() { + $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->httpRequest->setMethod('COPY'); $this->server->httpRequest->setUrl('/testdir'); $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } - /** - * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges - */ public function testMOVE() { + $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->httpRequest->setMethod('MOVE'); $this->server->httpRequest->setUrl('/testdir'); $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } - /** - * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges - */ public function testACL() { + $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->httpRequest->setMethod('ACL'); $this->server->httpRequest->setUrl('/testdir'); $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } - /** - * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges - */ public function testLOCK() { + $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->httpRequest->setMethod('LOCK'); $this->server->httpRequest->setUrl('/testdir'); $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } - /** - * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges - */ public function testBeforeBind() { + $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->emit('beforeBind', ['testdir/file']); } - /** - * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges - */ public function testBeforeUnbind() { + $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->emit('beforeUnbind', ['testdir']); } diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php index 28e328ea6..8afe6d30f 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php @@ -7,8 +7,6 @@ namespace Sabre\DAVACL; use Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/HTTP/ResponseMock.php'; - class ExpandPropertiesTest extends \PHPUnit\Framework\TestCase { public function getServer() @@ -75,7 +73,7 @@ class ExpandPropertiesTest extends \PHPUnit\Framework\TestCase $server->exec(); - $this->assertEquals(207, $server->httpResponse->status, 'Incorrect status code received. Full body: '.$server->httpResponse->body); + $this->assertEquals(207, $server->httpResponse->status, 'Incorrect status code received. Full body: '.$server->httpResponse->getBodyAsString()); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], @@ -93,7 +91,7 @@ class ExpandPropertiesTest extends \PHPUnit\Framework\TestCase '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:href' => 1, ]; - $xml = simplexml_load_string($server->httpResponse->body); + $xml = simplexml_load_string($server->httpResponse->getBodyAsString()); $xml->registerXPathNamespace('d', 'DAV:'); $xml->registerXPathNamespace('s', 'http://sabredav.org/ns'); foreach ($check as $v1 => $v2) { @@ -106,7 +104,7 @@ class ExpandPropertiesTest extends \PHPUnit\Framework\TestCase $count = $v2; } - $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response: '.$server->httpResponse->body); + $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response: '.$server->httpResponse->getBodyAsString()); } } @@ -136,7 +134,7 @@ class ExpandPropertiesTest extends \PHPUnit\Framework\TestCase $server->exec(); - $this->assertEquals(207, $server->httpResponse->status, 'Incorrect response status received. Full response body: '.$server->httpResponse->body); + $this->assertEquals(207, $server->httpResponse->status, 'Incorrect response status received. Full response body: '.$server->httpResponse->getBodyAsString()); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], @@ -156,7 +154,7 @@ class ExpandPropertiesTest extends \PHPUnit\Framework\TestCase '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:response/d:propstat/d:prop/d:displayname' => 1, ]; - $xml = simplexml_load_string($server->httpResponse->body); + $xml = simplexml_load_string($server->httpResponse->getBodyAsString()); $xml->registerXPathNamespace('d', 'DAV:'); $xml->registerXPathNamespace('s', 'http://sabredav.org/ns'); foreach ($check as $v1 => $v2) { @@ -219,7 +217,7 @@ class ExpandPropertiesTest extends \PHPUnit\Framework\TestCase '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/d:displayname' => 2, ]; - $xml = simplexml_load_string($server->httpResponse->body); + $xml = simplexml_load_string($server->httpResponse->getBodyAsString()); $xml->registerXPathNamespace('d', 'DAV:'); $xml->registerXPathNamespace('s', 'http://sabredav.org/ns'); foreach ($check as $v1 => $v2) { @@ -291,7 +289,7 @@ class ExpandPropertiesTest extends \PHPUnit\Framework\TestCase '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href/d:response/d:propstat/d:prop/d:displayname' => 1, ]; - $xml = simplexml_load_string($server->httpResponse->body); + $xml = simplexml_load_string($server->httpResponse->getBodyAsString()); $xml->registerXPathNamespace('d', 'DAV:'); $xml->registerXPathNamespace('s', 'http://sabredav.org/ns'); foreach ($check as $v1 => $v2) { diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php index 9ab16df74..048b9f249 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php @@ -7,14 +7,11 @@ namespace Sabre\DAVACL; use Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/DAVACL/MockACLNode.php'; -require_once 'Sabre/HTTP/ResponseMock.php'; - class PluginAdminTest extends \PHPUnit\Framework\TestCase { public $server; - public function setUp() + public function setup(): void { $principalBackend = new PrincipalBackend\Mock(); diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php index 169629a03..e6796e014 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php @@ -72,11 +72,9 @@ class PluginUpdatePropertiesTest extends \PHPUnit\Framework\TestCase $this->assertEquals(['bar', 'baz'], $tree[0]->getGroupMemberSet()); } - /** - * @expectedException \Sabre\DAV\Exception - */ public function testSetBadValue() { + $this->expectException('Sabre\DAV\Exception'); $tree = [ new MockPrincipal('foo', 'foo'), ]; diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php index 89f69b10a..b18ab9488 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php @@ -10,7 +10,7 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase { use DAV\DbTestHelperTrait; - public function setUp() + public function setup(): void { $this->dropTables(['principals', 'groupmembers']); $this->createSchema('principals'); @@ -190,7 +190,7 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase $this->assertNull($backend->findByUri('http://foo', 'principals')); } - public function testFindByUri() + public function testFindByUriWithMailtoAddress() { $pdo = $this->getPDO(); $backend = new PDO($pdo); @@ -199,4 +199,21 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase $backend->findByUri('mailto:user@example.org', 'principals') ); } + + public function testFindByUriWithUri() + { + $pdo = $this->getPDO(); + $backend = new PDO($pdo); + $this->assertEquals( + 'principals/user', + $backend->findByUri('principals/user', 'principals') + ); + } + + public function testFindByUriWithUnknownUri() + { + $pdo = $this->getPDO(); + $backend = new PDO($pdo); + $this->assertNull($backend->findByUri('principals/other', 'principals')); + } } diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/Mock.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/Mock.php index 551a77900..5f0434579 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/Mock.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/Mock.php @@ -126,8 +126,7 @@ class Mock extends AbstractBackend * * Read the PropPatch documentation for more info and examples. * - * @param string $path - * @param \Sabre\DAV\PropPatch $propPatch + * @param string $path */ public function updatePrincipal($path, \Sabre\DAV\PropPatch $propPatch) { diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalCollectionTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalCollectionTest.php index 68aebe2ae..2777281a8 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalCollectionTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalCollectionTest.php @@ -33,10 +33,10 @@ class PrincipalCollectionTest extends \PHPUnit\Framework\TestCase /** * @depends testBasic - * @expectedException \Sabre\DAV\Exception\MethodNotAllowed */ public function testGetChildrenDisable() { + $this->expectException('Sabre\DAV\Exception\MethodNotAllowed'); $backend = new PrincipalBackend\Mock(); $pc = new PrincipalCollection($backend); $pc->disableListing = true; diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php index 3bdcfbbbd..6883f25b4 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php @@ -7,8 +7,6 @@ namespace Sabre\DAVACL; use Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/HTTP/ResponseMock.php'; - class PrincipalPropertySearchTest extends \PHPUnit\Framework\TestCase { public function getServer() @@ -140,7 +138,8 @@ class PrincipalPropertySearchTest extends \PHPUnit\Framework\TestCase $server->exec(); - $this->assertEquals(207, $server->httpResponse->status, $server->httpResponse->body); + $bodyAsString = $server->httpResponse->getBodyAsString(); + $this->assertEquals(207, $server->httpResponse->status, $bodyAsString); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], @@ -158,7 +157,7 @@ class PrincipalPropertySearchTest extends \PHPUnit\Framework\TestCase '/d:multistatus/d:response/d:propstat/d:status' => 4, ]; - $xml = simplexml_load_string($server->httpResponse->body); + $xml = simplexml_load_string($bodyAsString); $xml->registerXPathNamespace('d', 'DAV:'); foreach ($check as $v1 => $v2) { $xpath = is_int($v1) ? $v2 : $v1; @@ -170,7 +169,7 @@ class PrincipalPropertySearchTest extends \PHPUnit\Framework\TestCase $count = $v2; } - $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response body: '.$server->httpResponse->body); + $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response body: '.$server->httpResponse->getBodyAsString()); } } @@ -211,7 +210,8 @@ class PrincipalPropertySearchTest extends \PHPUnit\Framework\TestCase $server->exec(); - $this->assertEquals(207, $server->httpResponse->status, $server->httpResponse->body); + $bodyAsString = $server->httpResponse->getBodyAsString(); + $this->assertEquals(207, $server->httpResponse->status, $bodyAsString); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], @@ -229,7 +229,7 @@ class PrincipalPropertySearchTest extends \PHPUnit\Framework\TestCase '/d:multistatus/d:response/d:propstat/d:status' => 0, ]; - $xml = simplexml_load_string($server->httpResponse->body); + $xml = simplexml_load_string($bodyAsString); $xml->registerXPathNamespace('d', 'DAV:'); foreach ($check as $v1 => $v2) { $xpath = is_int($v1) ? $v2 : $v1; @@ -241,7 +241,7 @@ class PrincipalPropertySearchTest extends \PHPUnit\Framework\TestCase $count = $v2; } - $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response body: '.$server->httpResponse->body); + $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response body: '.$server->httpResponse->getBodyAsString()); } } @@ -282,7 +282,8 @@ class PrincipalPropertySearchTest extends \PHPUnit\Framework\TestCase $server->exec(); - $this->assertEquals(207, $server->httpResponse->status, $server->httpResponse->body); + $bodyAsString = $server->httpResponse->getBodyAsString(); + $this->assertEquals(207, $server->httpResponse->status, $bodyAsString); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], @@ -300,7 +301,7 @@ class PrincipalPropertySearchTest extends \PHPUnit\Framework\TestCase '/d:multistatus/d:response/d:propstat/d:status' => 4, ]; - $xml = simplexml_load_string($server->httpResponse->body); + $xml = simplexml_load_string($bodyAsString); $xml->registerXPathNamespace('d', 'DAV:'); foreach ($check as $v1 => $v2) { $xpath = is_int($v1) ? $v2 : $v1; @@ -312,7 +313,7 @@ class PrincipalPropertySearchTest extends \PHPUnit\Framework\TestCase $count = $v2; } - $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response body: '.$server->httpResponse->body); + $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response body: '.$server->httpResponse->getBodyAsString()); } } @@ -346,7 +347,8 @@ class PrincipalPropertySearchTest extends \PHPUnit\Framework\TestCase $server->exec(); - $this->assertEquals(207, $server->httpResponse->status, $server->httpResponse->body); + $bodyAsString = $server->httpResponse->getBodyAsString(); + $this->assertEquals(207, $server->httpResponse->status, $bodyAsString); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], @@ -358,7 +360,7 @@ class PrincipalPropertySearchTest extends \PHPUnit\Framework\TestCase '/d:multistatus/d:response' => 0, ]; - $xml = simplexml_load_string($server->httpResponse->body); + $xml = simplexml_load_string($bodyAsString); $xml->registerXPathNamespace('d', 'DAV:'); foreach ($check as $v1 => $v2) { $xpath = is_int($v1) ? $v2 : $v1; @@ -370,7 +372,7 @@ class PrincipalPropertySearchTest extends \PHPUnit\Framework\TestCase $count = $v2; } - $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response body: '.$server->httpResponse->body); + $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response body: '.$server->httpResponse->getBodyAsString()); } } } diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php index 04f168f92..ec834fe1a 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php @@ -7,8 +7,6 @@ namespace Sabre\DAVACL; use Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/HTTP/ResponseMock.php'; - class PrincipalSearchPropertySetTest extends \PHPUnit\Framework\TestCase { public function getServer() @@ -76,7 +74,7 @@ class PrincipalSearchPropertySetTest extends \PHPUnit\Framework\TestCase $server->exec(); - $this->assertEquals(400, $server->httpResponse->status, $server->httpResponse->body); + $this->assertEquals(400, $server->httpResponse->status, $server->httpResponse->getBodyAsString()); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], @@ -102,7 +100,8 @@ class PrincipalSearchPropertySetTest extends \PHPUnit\Framework\TestCase $server->exec(); - $this->assertEquals(200, $server->httpResponse->status, $server->httpResponse->body); + $bodyAsString = $server->httpResponse->getBodyAsString(); + $this->assertEquals(200, $server->httpResponse->status, $bodyAsString); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], @@ -117,7 +116,7 @@ class PrincipalSearchPropertySetTest extends \PHPUnit\Framework\TestCase '/d:principal-search-property-set/d:principal-search-property/d:description' => 2, ]; - $xml = simplexml_load_string($server->httpResponse->body); + $xml = simplexml_load_string($bodyAsString); $xml->registerXPathNamespace('d', 'DAV:'); $xml->registerXPathNamespace('s', 'http://sabredav.org/ns'); foreach ($check as $v1 => $v2) { @@ -130,7 +129,7 @@ class PrincipalSearchPropertySetTest extends \PHPUnit\Framework\TestCase $count = $v2; } - $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response body: '.$server->httpResponse->body); + $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response body: '.$bodyAsString); } } } diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalTest.php index a4821da5a..7e1656a15 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalTest.php @@ -15,11 +15,9 @@ class PrincipalTest extends \PHPUnit\Framework\TestCase $this->assertTrue($principal instanceof Principal); } - /** - * @expectedException \Sabre\DAV\Exception - */ public function testConstructNoUri() { + $this->expectException('Sabre\DAV\Exception'); $principalBackend = new PrincipalBackend\Mock(); $principal = new Principal($principalBackend, []); } @@ -177,11 +175,9 @@ class PrincipalTest extends \PHPUnit\Framework\TestCase ], $principal->getACL()); } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testSetACl() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $principalBackend = new PrincipalBackend\Mock(); $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); $principal->setACL([]); diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php index a1e9ee36c..effa15838 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php @@ -7,9 +7,6 @@ namespace Sabre\DAVACL; use Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/DAVACL/MockPrincipal.php'; -require_once 'Sabre/DAVACL/MockACLNode.php'; - class SimplePluginTest extends \PHPUnit\Framework\TestCase { public function testValues() diff --git a/vendor/sabre/dav/tests/Sabre/DAVServerTest.php b/vendor/sabre/dav/tests/Sabre/DAVServerTest.php index 982090d23..2f64df08c 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVServerTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVServerTest.php @@ -43,7 +43,7 @@ abstract class DAVServerTest extends \PHPUnit\Framework\TestCase protected $carddavCards = []; /** - * @var Sabre\DAV\Server + * @var \Sabre\DAV\Server */ protected $server; protected $tree = []; @@ -82,12 +82,17 @@ abstract class DAVServerTest extends \PHPUnit\Framework\TestCase protected $caldavSchedulePlugin; /** - * @var Sabre\DAV\Auth\Plugin + * @var CalDAV\ICSExportPlugin + */ + protected $caldavICSExportPlugin; + + /** + * @var \Sabre\DAV\Auth\Plugin */ protected $authPlugin; /** - * @var Sabre\DAV\Locks\Plugin + * @var \Sabre\DAV\Locks\Plugin */ protected $locksPlugin; @@ -109,7 +114,7 @@ abstract class DAVServerTest extends \PHPUnit\Framework\TestCase */ protected $autoLogin = null; - public function setUp() + public function setup(): void { $this->initializeEverything(); } @@ -193,7 +198,7 @@ abstract class DAVServerTest extends \PHPUnit\Framework\TestCase public function request($request, $expectedStatus = null) { if (is_array($request)) { - $request = HTTP\Request::createFromServerArray($request); + $request = HTTP\Sapi::createFromServerArray($request); } $response = new HTTP\ResponseMock(); @@ -295,6 +300,6 @@ abstract class DAVServerTest extends \PHPUnit\Framework\TestCase public function assertHttpStatus($expectedStatus, HTTP\Request $req) { $resp = $this->request($req); - $this->assertEquals((int) $expectedStatus, (int) $resp->status, 'Incorrect HTTP status received: '.$resp->body); + $this->assertEquals((int) $expectedStatus, (int) $resp->getStatus(), 'Incorrect HTTP status received: '.$resp->getStatus()); } } |