diff options
author | Mario <mario@mariovavti.com> | 2020-01-12 09:18:07 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2020-01-12 09:18:07 +0000 |
commit | 8cb968c4b03e5d5462edec56f31625e9f15a6a15 (patch) | |
tree | ccd1974ee57d17492a25846b2e4fae28b97c1e2f /vendor/sabre/dav | |
parent | f645c6f3a57bf5f53bbb2bde362b2447f725c977 (diff) | |
download | volse-hubzilla-8cb968c4b03e5d5462edec56f31625e9f15a6a15.tar.gz volse-hubzilla-8cb968c4b03e5d5462edec56f31625e9f15a6a15.tar.bz2 volse-hubzilla-8cb968c4b03e5d5462edec56f31625e9f15a6a15.zip |
composer update sabre/dav
Diffstat (limited to 'vendor/sabre/dav')
45 files changed, 354 insertions, 219 deletions
diff --git a/vendor/sabre/dav/.travis.yml b/vendor/sabre/dav/.travis.yml index c98ea59ef..84a04423e 100644 --- a/vendor/sabre/dav/.travis.yml +++ b/vendor/sabre/dav/.travis.yml @@ -21,6 +21,9 @@ matrix: - name: 'PHPStan' php: 7.2 env: RUN_PHPSTAN="TRUE" + - name: 'Test with streaming propfind' + php: 7.2 + env: RUN_TEST_WITH_STREAMING_PROPFIND="TRUE" services: - mysql diff --git a/vendor/sabre/dav/CHANGELOG.md b/vendor/sabre/dav/CHANGELOG.md index 455b3ae5e..5867bd3ce 100644 --- a/vendor/sabre/dav/CHANGELOG.md +++ b/vendor/sabre/dav/CHANGELOG.md @@ -1,6 +1,15 @@ ChangeLog ========= +4.0.3 (2020-01-10) +------------------------- +* DAV: Streaming PROPFIND server implementation +* DAVACL: Fix uppercase of NotAuthenticated class +* CalDAV: Return only calendar objects owned by principal itself +* CalDAV: Convert scheduling object data from resource to string +* Browser Plugin: Fix content type guessing if setBaseUri is set to a folder + + 4.0.2 (2019-10-18) ------------------------- * Fix error with PHP 7.4 diff --git a/vendor/sabre/dav/lib/CalDAV/Backend/PDO.php b/vendor/sabre/dav/lib/CalDAV/Backend/PDO.php index 003dc1392..da601fad8 100644 --- a/vendor/sabre/dav/lib/CalDAV/Backend/PDO.php +++ b/vendor/sabre/dav/lib/CalDAV/Backend/PDO.php @@ -874,6 +874,8 @@ WHERE calendar_instances.principaluri = ? AND calendarobjects.uid = ? + AND + calendar_instances.access = 1 SQL; $stmt = $this->pdo->prepare($query); @@ -1286,13 +1288,18 @@ SQL; /** * Creates a new scheduling object. This should land in a users' inbox. * - * @param string $principalUri - * @param string $objectUri - * @param string $objectData + * @param string $principalUri + * @param string $objectUri + * @param string|resource $objectData */ public function createSchedulingObject($principalUri, $objectUri, $objectData) { $stmt = $this->pdo->prepare('INSERT INTO '.$this->schedulingObjectTableName.' (principaluri, calendardata, uri, lastmodified, etag, size) VALUES (?, ?, ?, ?, ?, ?)'); + + if (is_resource($objectData)) { + $objectData = stream_get_contents($objectData); + } + $stmt->execute([$principalUri, $objectData, $objectUri, time(), md5($objectData), strlen($objectData)]); } diff --git a/vendor/sabre/dav/lib/CalDAV/Backend/SchedulingSupport.php b/vendor/sabre/dav/lib/CalDAV/Backend/SchedulingSupport.php index 7986d8c33..69467e554 100644 --- a/vendor/sabre/dav/lib/CalDAV/Backend/SchedulingSupport.php +++ b/vendor/sabre/dav/lib/CalDAV/Backend/SchedulingSupport.php @@ -58,9 +58,9 @@ interface SchedulingSupport extends BackendInterface /** * Creates a new scheduling object. This should land in a users' inbox. * - * @param string $principalUri - * @param string $objectUri - * @param string $objectData + * @param string $principalUri + * @param string $objectUri + * @param string|resource $objectData */ public function createSchedulingObject($principalUri, $objectUri, $objectData); } diff --git a/vendor/sabre/dav/lib/DAV/Browser/GuessContentType.php b/vendor/sabre/dav/lib/DAV/Browser/GuessContentType.php index 7466babb3..b07103db9 100644 --- a/vendor/sabre/dav/lib/DAV/Browser/GuessContentType.php +++ b/vendor/sabre/dav/lib/DAV/Browser/GuessContentType.php @@ -85,10 +85,12 @@ class GuessContentType extends DAV\ServerPlugin */ protected function getContentType($fileName) { - // Just grabbing the extension - $extension = strtolower(substr($fileName, strrpos($fileName, '.') + 1)); - if (isset($this->extensionMap[$extension])) { - return $this->extensionMap[$extension]; + if (null !== $fileName) { + // Just grabbing the extension + $extension = strtolower(substr($fileName, strrpos($fileName, '.') + 1)); + if (isset($this->extensionMap[$extension])) { + return $this->extensionMap[$extension]; + } } return 'application/octet-stream'; diff --git a/vendor/sabre/dav/lib/DAV/Server.php b/vendor/sabre/dav/lib/DAV/Server.php index 09760e9d1..69b3bb3f2 100644 --- a/vendor/sabre/dav/lib/DAV/Server.php +++ b/vendor/sabre/dav/lib/DAV/Server.php @@ -14,6 +14,7 @@ use Sabre\HTTP; use Sabre\HTTP\RequestInterface; use Sabre\HTTP\ResponseInterface; use Sabre\Uri; +use Sabre\Xml\Writer; /** * Main DAV server class. @@ -185,6 +186,15 @@ class Server implements LoggerAwareInterface, EmitterInterface public static $exposeVersion = true; /** + * If this setting is turned on, any multi status response on any PROPFIND will be streamed to the output buffer. + * This will be beneficial for large result sets which will no longer consume a large amount of memory as well as + * send back data to the client earlier. + * + * @var bool + */ + public static $streamMultiStatus = false; + + /** * Sets up the server. * * If a Sabre\DAV\Tree object is passed as an argument, it will @@ -1628,19 +1638,38 @@ class Server implements LoggerAwareInterface, EmitterInterface // {{{ XML Readers & Writers /** - * Generates a WebDAV propfind response body based on a list of nodes. + * Returns a callback generating a WebDAV propfind response body based on a list of nodes. * * If 'strip404s' is set to true, all 404 responses will be removed. * * @param array|\Traversable $fileProperties The list with nodes * @param bool $strip404s * - * @return string + * @return callable|string */ public function generateMultiStatus($fileProperties, $strip404s = false) { $w = $this->xml->getWriter(); + if (self::$streamMultiStatus) { + return function () use ($fileProperties, $strip404s, $w) { + $w->openUri('php://output'); + $this->writeMultiStatus($w, $fileProperties, $strip404s); + $w->flush(); + }; + } $w->openMemory(); + $this->writeMultiStatus($w, $fileProperties, $strip404s); + + return $w->outputMemory(); + } + + /** + * @param Writer $w + * @param $fileProperties + * @param bool $strip404s + */ + private function writeMultiStatus(Writer $w, $fileProperties, bool $strip404s) + { $w->contextUri = $this->baseUri; $w->startDocument(); @@ -1662,7 +1691,6 @@ class Server implements LoggerAwareInterface, EmitterInterface ]); } $w->endElement(); - - return $w->outputMemory(); + $w->endDocument(); } } diff --git a/vendor/sabre/dav/lib/DAV/Version.php b/vendor/sabre/dav/lib/DAV/Version.php index c00255881..bb48768a9 100644 --- a/vendor/sabre/dav/lib/DAV/Version.php +++ b/vendor/sabre/dav/lib/DAV/Version.php @@ -16,5 +16,5 @@ class Version /** * Full version number. */ - const VERSION = '4.0.2'; + const VERSION = '4.0.3'; } diff --git a/vendor/sabre/dav/lib/DAVACL/Plugin.php b/vendor/sabre/dav/lib/DAVACL/Plugin.php index c1ea6027c..b9407472e 100644 --- a/vendor/sabre/dav/lib/DAVACL/Plugin.php +++ b/vendor/sabre/dav/lib/DAVACL/Plugin.php @@ -214,7 +214,7 @@ class Plugin extends DAV\ServerPlugin $this->server->httpRequest, $this->server->httpResponse ); - throw new notAuthenticated(implode(', ', $reasons).'. Login was needed for privilege: '.implode(', ', $failed).' on '.$uri); + throw new NotAuthenticated(implode(', ', $reasons).'. Login was needed for privilege: '.implode(', ', $failed).' on '.$uri); } if ($throwExceptions) { throw new NeedPrivileges($uri, $failed); diff --git a/vendor/sabre/dav/lib/DAVACL/PrincipalBackend/PDO.php b/vendor/sabre/dav/lib/DAVACL/PrincipalBackend/PDO.php index 350ecb145..160d41447 100644 --- a/vendor/sabre/dav/lib/DAVACL/PrincipalBackend/PDO.php +++ b/vendor/sabre/dav/lib/DAVACL/PrincipalBackend/PDO.php @@ -301,34 +301,46 @@ class PDO extends AbstractBackend implements CreatePrincipalSupport */ public function findByUri($uri, $principalPrefix) { - $value = null; - $scheme = null; - list($scheme, $value) = explode(':', $uri, 2); - if (empty($value)) { + $uriParts = Uri\parse($uri); + + // Only two types of uri are supported : + // - the "mailto:" scheme with some non-empty address + // - a principals uri, in the form "principals/NAME" + // In both cases, `path` must not be empty. + if (empty($uriParts['path'])) { return null; } $uri = null; - switch ($scheme) { - case 'mailto': - $query = 'SELECT uri FROM '.$this->tableName.' WHERE lower(email)=lower(?)'; - $stmt = $this->pdo->prepare($query); - $stmt->execute([$value]); + if ('mailto' === $uriParts['scheme']) { + $query = 'SELECT uri FROM '.$this->tableName.' WHERE lower(email)=lower(?)'; + $stmt = $this->pdo->prepare($query); + $stmt->execute([$uriParts['path']]); - while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { - // Checking if the principal is in the prefix - list($rowPrefix) = Uri\split($row['uri']); - if ($rowPrefix !== $principalPrefix) { - continue; - } + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + // Checking if the principal is in the prefix + list($rowPrefix) = Uri\split($row['uri']); + if ($rowPrefix !== $principalPrefix) { + continue; + } - $uri = $row['uri']; - break; //Stop on first match + $uri = $row['uri']; + break; //Stop on first match + } + } else { + $pathParts = Uri\split($uriParts['path']); // We can do this since $uriParts['path'] is not null + + if (2 === count($pathParts) && $pathParts[0] === $principalPrefix) { + // Checking that this uri exists + $query = 'SELECT * FROM '.$this->tableName.' WHERE uri = ?'; + $stmt = $this->pdo->prepare($query); + $stmt->execute([$uriParts['path']]); + $rows = $stmt->fetchAll(); + + if (count($rows) > 0) { + $uri = $uriParts['path']; } - break; - default: - //unsupported uri scheme - return null; + } } return $uri; diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php index 80de750dc..d2df483cd 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php @@ -1026,6 +1026,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 +1042,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 +1058,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)); diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php index 49252744d..d6e7b491c 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php @@ -82,11 +82,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/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..8c99e6c46 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/ICSExportPluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/ICSExportPluginTest.php @@ -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/PluginTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php index 711cc0ac7..f065e1ac8 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php @@ -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)); @@ -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)); @@ -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/SharingPluginTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/SharingPluginTest.php index 57732cd06..45c389cc2 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/SharingPluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/SharingPluginTest.php @@ -131,7 +131,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 +144,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 +157,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() @@ -250,7 +250,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 +267,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,7 +285,7 @@ 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. @@ -312,7 +312,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 +330,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 +379,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/ValidateICalTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/ValidateICalTest.php index e6d1edace..fc87184d9 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/ValidateICalTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/ValidateICalTest.php @@ -100,7 +100,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 +140,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 +166,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 +213,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 +226,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 +239,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 +252,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 +265,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 +278,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 +338,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 +352,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 +385,7 @@ ICS; $response = $this->request($request); - $this->assertEquals(201, $response->status, 'Incorrect status returned! Full response body: '.$response->body); + $this->assertEquals(201, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); $this->assertNull($response->getHeader('ETag')); } } diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookQueryTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookQueryTest.php index 6e7e13106..fe047fb84 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookQueryTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookQueryTest.php @@ -39,12 +39,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 +88,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 +132,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 +171,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 +213,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 +258,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 +303,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 +334,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/MultiGetTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/MultiGetTest.php index 4e3276ed3..6fdfcd07a 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/MultiGetTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/MultiGetTest.php @@ -36,12 +36,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 +79,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/VCFExportTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/VCFExportTest.php index d8acc3c14..48477d7f2 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/VCFExportTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/VCFExportTest.php @@ -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() diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateVCardTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateVCardTest.php index 2317b86cc..a9be169c0 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateVCardTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateVCardTest.php @@ -240,7 +240,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 +256,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..bf1e22aea 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php @@ -9,7 +9,7 @@ use Sabre\HTTP; abstract class AbstractServer extends \PHPUnit\Framework\TestCase { /** - * @var Sabre\HTTP\ResponseMock + * @var \Sabre\HTTP\ResponseMock */ protected $response; protected $request; diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php index de7b85f32..f51f5546c 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php @@ -29,7 +29,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..f28661ca7 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Browser/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Browser/PluginTest.php @@ -148,7 +148,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 +164,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 +173,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/FSExt/ServerTest.php b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/ServerTest.php index daa04c354..f53807e6c 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/ServerTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/ServerTest.php @@ -34,7 +34,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 +55,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 +73,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 +105,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 +119,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 +135,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 +153,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 +173,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 +185,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 +220,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 +241,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/Locks/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php index b3a0ac9af..a9c6cc1bc 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php @@ -77,9 +77,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 +102,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'); @@ -137,7 +137,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 +267,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 +329,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 +366,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 +629,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 +809,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() diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php index c993e609d..0e3123b35 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php @@ -28,7 +28,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 +46,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/PartialUpdate/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/PluginTest.php index 63d692ec9..0cf6dc4e4 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/PluginTest.php @@ -44,7 +44,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 +56,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 +68,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 +80,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 +92,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 +104,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/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..bbf820eb5 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerPluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerPluginTest.php @@ -60,7 +60,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/ServerPropsTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php index 462fba664..def9a9cfb 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php @@ -58,7 +58,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 +83,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 +105,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 +139,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 +157,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/ServerSimpleTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerSimpleTest.php index 53153151b..563f558eb 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerSimpleTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerSimpleTest.php @@ -42,7 +42,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 +62,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() @@ -371,7 +371,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 +394,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/TemporaryFileFilterTest.php b/vendor/sabre/dav/tests/Sabre/DAV/TemporaryFileFilterTest.php index 352c8a3e7..bae5b58bf 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/TemporaryFileFilterTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/TemporaryFileFilterTest.php @@ -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/DAVACL/ExpandPropertiesTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php index 28e328ea6..d0b67cfae 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php @@ -75,7 +75,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 +93,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 +106,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 +136,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 +156,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 +219,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 +291,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/PrincipalBackend/AbstractPDOTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php index 89f69b10a..95775d8fe 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php @@ -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/PrincipalPropertySearchTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php index 3bdcfbbbd..55c64721e 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php @@ -140,7 +140,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 +159,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 +171,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 +212,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 +231,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 +243,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 +284,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 +303,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 +315,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 +349,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 +362,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 +374,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..b44b46fc5 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php @@ -76,7 +76,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 +102,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 +118,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 +131,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/bootstrap.php b/vendor/sabre/dav/tests/bootstrap.php index 03e6006b9..bc79b86ab 100644 --- a/vendor/sabre/dav/tests/bootstrap.php +++ b/vendor/sabre/dav/tests/bootstrap.php @@ -14,6 +14,11 @@ $autoLoader->addPsr4('Sabre\\Xml\\', __DIR__.'/../vendor/sabre/xml/tests/Sabre/X date_default_timezone_set('UTC'); +if ('TRUE' === getenv('RUN_TEST_WITH_STREAMING_PROPFIND')) { + echo 'Running unit tests with \Sabre\DAV\Server::$streamMultiStatus = true'; + \Sabre\DAV\Server::$streamMultiStatus = true; +} + // List of variables that can be set by the environment $environmentVars = [ 'SABRE_MYSQLUSER', |