diff --git a/lib/CardDAV/Backend/PDO.php b/lib/CardDAV/Backend/PDO.php index e47545b7a5..dbb476b3cf 100644 --- a/lib/CardDAV/Backend/PDO.php +++ b/lib/CardDAV/Backend/PDO.php @@ -22,7 +22,7 @@ class PDO extends AbstractBackend implements SyncSupport /** * PDO connection. * - * @var PDO + * @var \PDO */ protected $pdo; diff --git a/lib/DAV/Auth/Backend/AbstractBearer.php b/lib/DAV/Auth/Backend/AbstractBearer.php index b6817479fd..865e1286fa 100644 --- a/lib/DAV/Auth/Backend/AbstractBearer.php +++ b/lib/DAV/Auth/Backend/AbstractBearer.php @@ -89,7 +89,7 @@ public function check(RequestInterface $request, ResponseInterface $response) $response ); - $bearerToken = $auth->getToken($request); + $bearerToken = $auth->getToken(); if (!$bearerToken) { return [false, "No 'Authorization: Bearer' header found. Either the client didn't send one, or the server is mis-configured"]; } diff --git a/lib/DAV/Auth/Backend/PDO.php b/lib/DAV/Auth/Backend/PDO.php index 9a06912d10..8edb11b926 100644 --- a/lib/DAV/Auth/Backend/PDO.php +++ b/lib/DAV/Auth/Backend/PDO.php @@ -16,7 +16,7 @@ class PDO extends AbstractDigest /** * Reference to PDO connection. * - * @var PDO + * @var \PDO */ protected $pdo; diff --git a/lib/DAV/Auth/Backend/PDOBasicAuth.php b/lib/DAV/Auth/Backend/PDOBasicAuth.php index d142cbfbfd..dc0c6fb735 100644 --- a/lib/DAV/Auth/Backend/PDOBasicAuth.php +++ b/lib/DAV/Auth/Backend/PDOBasicAuth.php @@ -13,7 +13,7 @@ class PDOBasicAuth extends AbstractBasic /** * Reference to PDO connection. * - * @var PDO + * @var \PDO */ protected $pdo; diff --git a/lib/DAV/Auth/Plugin.php b/lib/DAV/Auth/Plugin.php index 47fbe205ac..706d1755b5 100644 --- a/lib/DAV/Auth/Plugin.php +++ b/lib/DAV/Auth/Plugin.php @@ -36,7 +36,7 @@ class Plugin extends ServerPlugin * This is useful if you want to allow both authenticated and * unauthenticated access to your server. * - * @param bool + * @var bool */ public $autoRequireLogin = true; diff --git a/lib/DAV/Client.php b/lib/DAV/Client.php index 187b29ba37..c7202f2b90 100644 --- a/lib/DAV/Client.php +++ b/lib/DAV/Client.php @@ -412,7 +412,7 @@ public function options() * @param string $url * @param string|resource|null $body * - * @throws clientException, in case a curl error occurred + * @throws HTTP\ClientException, in case a curl error occurred * * @return array */ diff --git a/lib/DAV/Locks/Backend/PDO.php b/lib/DAV/Locks/Backend/PDO.php index 3f425f98db..227fa27d8e 100644 --- a/lib/DAV/Locks/Backend/PDO.php +++ b/lib/DAV/Locks/Backend/PDO.php @@ -28,7 +28,7 @@ class PDO extends AbstractBackend /** * The PDO connection object. * - * @var pdo + * @var \PDO */ protected $pdo; diff --git a/lib/DAVACL/Plugin.php b/lib/DAVACL/Plugin.php index 03068451ec..9256ace0bb 100644 --- a/lib/DAVACL/Plugin.php +++ b/lib/DAVACL/Plugin.php @@ -236,7 +236,7 @@ public function checkPrivileges($uri, $privileges, $recursion = self::R_PARENT, */ public function getCurrentUserPrincipal() { - /** @var $authPlugin \Sabre\DAV\Auth\Plugin */ + /** @var DAV\Auth\Plugin $authPlugin */ $authPlugin = $this->server->getPlugin('auth'); if (!$authPlugin) { return null; diff --git a/lib/DAVACL/PrincipalBackend/PDO.php b/lib/DAVACL/PrincipalBackend/PDO.php index 178bd7276f..e316ff318c 100644 --- a/lib/DAVACL/PrincipalBackend/PDO.php +++ b/lib/DAVACL/PrincipalBackend/PDO.php @@ -37,7 +37,7 @@ class PDO extends AbstractBackend implements CreatePrincipalSupport /** * pdo. * - * @var PDO + * @var \PDO */ protected $pdo; diff --git a/tests/Sabre/AbstractDAVServerTestCase.php b/tests/Sabre/AbstractDAVServerTestCase.php index 40dcb41dfa..f419edbc6c 100644 --- a/tests/Sabre/AbstractDAVServerTestCase.php +++ b/tests/Sabre/AbstractDAVServerTestCase.php @@ -204,7 +204,7 @@ public function request($request, $expectedStatus = null) if (is_array($request)) { $request = HTTP\Sapi::createFromServerArray($request); } - $response = new HTTP\ResponseMock(); + $response = new HTTP\Response(); $this->server->httpRequest = $request; $this->server->httpResponse = $response; diff --git a/tests/Sabre/CalDAV/Backend/MockSharing.php b/tests/Sabre/CalDAV/Backend/MockSharing.php index 32d8f10a83..6d9ba43912 100644 --- a/tests/Sabre/CalDAV/Backend/MockSharing.php +++ b/tests/Sabre/CalDAV/Backend/MockSharing.php @@ -156,8 +156,8 @@ public function getInvites($calendarId) /** * This method is called when a user replied to a request to share. * - * @param string href The sharee who is replying (often a mailto: address) - * @param int status One of the \Sabre\DAV\Sharing\Plugin::INVITE_* constants + * @param string $href The sharee who is replying (often a mailto: address) + * @param int $status One of the \Sabre\DAV\Sharing\Plugin::INVITE_* constants * @param string $calendarUri The url to the calendar thats being shared * @param string $inReplyTo The unique id this message is a response to * @param string $summary A description of the reply diff --git a/tests/Sabre/CalDAV/CalendarHomeTest.php b/tests/Sabre/CalDAV/CalendarHomeTest.php index 96b10c21cf..7d00aed215 100644 --- a/tests/Sabre/CalDAV/CalendarHomeTest.php +++ b/tests/Sabre/CalDAV/CalendarHomeTest.php @@ -10,7 +10,7 @@ class CalendarHomeTest extends \PHPUnit\Framework\TestCase { /** - * @var Sabre\CalDAV\CalendarHome + * @var CalendarHome */ protected $usercalendars; diff --git a/tests/Sabre/CalDAV/CalendarObjectTest.php b/tests/Sabre/CalDAV/CalendarObjectTest.php index 3ac118ce19..79e8f02da3 100644 --- a/tests/Sabre/CalDAV/CalendarObjectTest.php +++ b/tests/Sabre/CalDAV/CalendarObjectTest.php @@ -4,14 +4,16 @@ namespace Sabre\CalDAV; +use Sabre\CalDAV; + class CalendarObjectTest extends \PHPUnit\Framework\TestCase { /** - * @var Sabre\CalDAV\Backend_PDO + * @var CalDAV\Backend\PDO */ protected $backend; /** - * @var Sabre\CalDAV\Calendar + * @var CalDAV\Calendar */ protected $calendar; protected $principalBackend; diff --git a/tests/Sabre/CalDAV/CalendarTest.php b/tests/Sabre/CalDAV/CalendarTest.php index c1bdd23b93..c867836fb3 100644 --- a/tests/Sabre/CalDAV/CalendarTest.php +++ b/tests/Sabre/CalDAV/CalendarTest.php @@ -4,17 +4,18 @@ namespace Sabre\CalDAV; +use Sabre\CalDAV; use Sabre\DAV\PropPatch; class CalendarTest extends \PHPUnit\Framework\TestCase { /** - * @var Sabre\CalDAV\Backend\PDO + * @var CalDAV\Backend\PDO */ protected $backend; protected $principalBackend; /** - * @var Sabre\CalDAV\Calendar + * @var CalDAV\Calendar */ protected $calendar; /** diff --git a/tests/Sabre/CalDAV/FreeBusyReportTest.php b/tests/Sabre/CalDAV/FreeBusyReportTest.php index ddf74b01a4..a773da525f 100644 --- a/tests/Sabre/CalDAV/FreeBusyReportTest.php +++ b/tests/Sabre/CalDAV/FreeBusyReportTest.php @@ -83,7 +83,7 @@ public function setup(): void $request = new HTTP\Request('GET', '/calendar'); $this->server->httpRequest = $request; - $this->server->httpResponse = new HTTP\ResponseMock(); + $this->server->httpResponse = new HTTP\Response(); $this->plugin = new Plugin(); $this->server->addPlugin($this->plugin); @@ -101,11 +101,11 @@ public function testFreeBusyReport() $report = $this->server->xml->parse($reportXML, null, $rootElem); $this->plugin->report($rootElem, $report, null); - self::assertEquals(200, $this->server->httpResponse->status); + self::assertEquals(200, $this->server->httpResponse->getStatus()); self::assertEquals('text/calendar', $this->server->httpResponse->getHeader('Content-Type')); - self::assertTrue(false !== strpos($this->server->httpResponse->body, 'BEGIN:VFREEBUSY')); - self::assertTrue(false !== strpos($this->server->httpResponse->body, '20111005T120000Z/20111005T130000Z')); - self::assertTrue(false !== strpos($this->server->httpResponse->body, '20111006T100000Z/20111006T110000Z')); + self::assertTrue(false !== strpos($this->server->httpResponse->getBody(), 'BEGIN:VFREEBUSY')); + self::assertTrue(false !== strpos($this->server->httpResponse->getBody(), '20111005T120000Z/20111005T130000Z')); + self::assertTrue(false !== strpos($this->server->httpResponse->getBody(), '20111006T100000Z/20111006T110000Z')); } public function testFreeBusyReportNoTimeRange() diff --git a/tests/Sabre/CalDAV/Issue220Test.php b/tests/Sabre/CalDAV/Issue220Test.php index a4c62fac8d..72ad955cfe 100644 --- a/tests/Sabre/CalDAV/Issue220Test.php +++ b/tests/Sabre/CalDAV/Issue220Test.php @@ -96,6 +96,6 @@ public function testIssue220() self::assertFalse(strpos($response->getBodyAsString(), 'PHPUnit_Framework_Error_Warning'), 'Error Warning occurred: '.$response->getBodyAsString()); self::assertFalse(strpos($response->getBodyAsString(), 'Invalid argument supplied for foreach()'), 'Invalid argument supplied for foreach(): '.$response->getBodyAsString()); - self::assertEquals(207, $response->status); + self::assertEquals(207, $response->getStatus()); } } diff --git a/tests/Sabre/CalDAV/Notifications/PluginTest.php b/tests/Sabre/CalDAV/Notifications/PluginTest.php index 6bafe5fbc6..8c468ba96a 100644 --- a/tests/Sabre/CalDAV/Notifications/PluginTest.php +++ b/tests/Sabre/CalDAV/Notifications/PluginTest.php @@ -14,16 +14,16 @@ class PluginTest extends \PHPUnit\Framework\TestCase { /** - * @var Sabre\DAV\Server + * @var DAV\Server */ protected $server; /** - * @var Sabre\CalDAV\Plugin + * @var CalDAV\Plugin */ protected $plugin; protected $response; /** - * @var Sabre\CalDAV\Backend\PDO + * @var CalDAV\Backend\PDO */ protected $caldavBackend; @@ -60,7 +60,7 @@ public function setup(): void // This forces a login $authPlugin->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response()); - $this->response = new HTTP\ResponseMock(); + $this->response = new HTTP\Response(); $this->server->httpResponse = $this->response; } @@ -123,14 +123,14 @@ public function testNotificationGet() $caldav = new Plugin(); $server->httpRequest = new Request('GET', '/foo.xml'); - $httpResponse = new HTTP\ResponseMock(); + $httpResponse = new HTTP\Response(); $server->httpResponse = $httpResponse; $server->addPlugin($caldav); $caldav->httpGet($server->httpRequest, $server->httpResponse); - self::assertEquals(200, $httpResponse->status); + self::assertEquals(200, $httpResponse->getStatus()); self::assertEquals([ 'Content-Type' => ['application/xml'], 'ETag' => ['"1"'], @@ -151,7 +151,7 @@ public function testGETPassthrough() $server = new DAV\Server(); $caldav = new Plugin(); - $httpResponse = new HTTP\ResponseMock(); + $httpResponse = new HTTP\Response(); $server->httpResponse = $httpResponse; $server->addPlugin($caldav); diff --git a/tests/Sabre/CalDAV/PluginTest.php b/tests/Sabre/CalDAV/PluginTest.php index 695a07e851..90bfb0a0ca 100644 --- a/tests/Sabre/CalDAV/PluginTest.php +++ b/tests/Sabre/CalDAV/PluginTest.php @@ -97,7 +97,7 @@ public function setup(): void // This forces a login $authPlugin->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response()); - $this->response = new HTTP\ResponseMock(); + $this->response = new HTTP\Response(); $this->server->httpResponse = $this->response; } @@ -118,7 +118,7 @@ public function testUnknownMethodPassThrough() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(501, $this->response->status, 'Incorrect status returned. Full response body:'.$this->response->getBodyAsString()); + self::assertEquals(501, $this->response->getStatus(), 'Incorrect status returned. Full response body:'.$this->response->getBodyAsString()); } public function testGetWithoutContentType() @@ -136,7 +136,7 @@ public function testReportPassThrough() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(415, $this->response->status); + self::assertEquals(415, $this->response->getStatus()); } public function testMkCalendarBadLocation() @@ -185,7 +185,7 @@ public function testMkCalendarBadLocation() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(403, $this->response->status); + self::assertEquals(403, $this->response->getStatus()); } public function testMkCalendarNoParentNode() @@ -234,7 +234,7 @@ public function testMkCalendarNoParentNode() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(409, $this->response->status); + self::assertEquals(409, $this->response->getStatus()); } public function testMkCalendarExistingCalendar() @@ -286,7 +286,7 @@ public function testMkCalendarExistingCalendar() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(405, $this->response->status); + self::assertEquals(405, $this->response->getStatus()); } public function testMkCalendarSucceed() @@ -336,7 +336,7 @@ public function testMkCalendarSucceed() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(201, $this->response->status, 'Invalid response code received. Full response body: '.$this->response->getBodyAsString()); + self::assertEquals(201, $this->response->getStatus(), 'Invalid response code received. Full response body: '.$this->response->getBodyAsString()); $calendars = $this->caldavBackend->getCalendarsForUser('principals/user1'); self::assertEquals(3, count($calendars)); @@ -381,7 +381,7 @@ public function testMkCalendarEmptyBodySucceed() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(201, $this->response->status, 'Invalid response code received. Full response body: '.$this->response->getBodyAsString()); + self::assertEquals(201, $this->response->getStatus(), 'Invalid response code received. Full response body: '.$this->response->getBodyAsString()); $calendars = $this->caldavBackend->getCalendarsForUser('principals/user1'); self::assertEquals(3, count($calendars)); @@ -424,7 +424,7 @@ public function testMkCalendarBadXml() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(400, $this->response->status); + self::assertEquals(400, $this->response->getStatus()); } public function testPrincipalProperties() @@ -560,7 +560,7 @@ public function testCalendarMultiGetReport() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(207, $this->response->status, 'Invalid HTTP status received. Full response body'); + self::assertEquals(207, $this->response->getStatus(), 'Invalid HTTP status received. Full response body'); $expectedIcal = TestUtil::getTestCalendarData(); @@ -607,7 +607,7 @@ public function testCalendarMultiGetReportExpand() $this->server->exec(); $bodyAsString = $this->response->getBodyAsString(); - self::assertEquals(207, $this->response->status, 'Invalid HTTP status received. Full response body: '.$bodyAsString); + self::assertEquals(207, $this->response->getStatus(), 'Invalid HTTP status received. Full response body: '.$bodyAsString); $expectedIcal = TestUtil::getTestCalendarData(); $expectedIcal = \Sabre\VObject\Reader::read($expectedIcal); @@ -665,7 +665,7 @@ public function testCalendarQueryReport() $this->server->exec(); $bodyAsString = $this->response->getBodyAsString(); - self::assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$bodyAsString); + self::assertEquals(207, $this->response->getStatus(), 'Received an unexpected status. Full response body: '.$bodyAsString); $expectedIcal = TestUtil::getTestCalendarData(); $expectedIcal = \Sabre\VObject\Reader::read($expectedIcal); @@ -727,7 +727,7 @@ public function testCalendarQueryReportWindowsPhone() $this->server->exec(); $bodyAsString = $this->response->getBodyAsString(); - self::assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$bodyAsString); + self::assertEquals(207, $this->response->getStatus(), 'Received an unexpected status. Full response body: '.$bodyAsString); $expectedIcal = TestUtil::getTestCalendarData(); $expectedIcal = \Sabre\VObject\Reader::read($expectedIcal); @@ -786,7 +786,7 @@ public function testCalendarQueryReportBadDepth() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(400, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->getBodyAsString()); + self::assertEquals(400, $this->response->getStatus(), 'Received an unexpected status. Full response body: '.$this->response->getBodyAsString()); } /** @@ -816,7 +816,7 @@ public function testCalendarQueryReportNoCalData() $this->server->exec(); $bodyAsString = $this->server->httpResponse->getBodyAsString(); - self::assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$bodyAsString); + self::assertEquals(207, $this->response->getStatus(), 'Received an unexpected status. Full response body: '.$bodyAsString); $expected = << @@ -856,7 +856,7 @@ public function testCalendarQueryReportNoFilters() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(400, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->getBodyAsString()); + self::assertEquals(400, $this->response->getStatus(), 'Received an unexpected status. Full response body: '.$this->response->getBodyAsString()); } /** @@ -888,7 +888,7 @@ public function testCalendarQueryReport1Object() $this->server->exec(); $bodyAsString = $this->server->httpResponse->getBodyAsString(); - self::assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$bodyAsString); + self::assertEquals(207, $this->response->getStatus(), 'Received an unexpected status. Full response body: '.$bodyAsString); $expectedIcal = TestUtil::getTestCalendarData(); $expectedIcal = \Sabre\VObject\Reader::read($expectedIcal); @@ -943,7 +943,7 @@ public function testCalendarQueryReport1ObjectNoCalData() $this->server->exec(); $bodyAsString = $this->server->httpResponse->getBodyAsString(); - self::assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$bodyAsString); + self::assertEquals(207, $this->response->getStatus(), 'Received an unexpected status. Full response body: '.$bodyAsString); $expected = << @@ -995,7 +995,7 @@ public function testCalendarMultiGetReportNoEnd() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(400, $this->response->status, 'Invalid HTTP status received. Full response body: '.$this->response->getBodyAsString()); + self::assertEquals(400, $this->response->getStatus(), 'Invalid HTTP status received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -1021,7 +1021,7 @@ public function testCalendarMultiGetReportNoStart() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(400, $this->response->status, 'Invalid HTTP status received. Full response body: '.$this->response->getBodyAsString()); + self::assertEquals(400, $this->response->getStatus(), 'Invalid HTTP status received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -1047,7 +1047,7 @@ public function testCalendarMultiGetReportEndBeforeStart() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(400, $this->response->status, 'Invalid HTTP status received. Full response body: '.$this->response->getBodyAsString()); + self::assertEquals(400, $this->response->getStatus(), 'Invalid HTTP status received. Full response body: '.$this->response->getBodyAsString()); } /** diff --git a/tests/Sabre/CalDAV/Schedule/FreeBusyRequestTest.php b/tests/Sabre/CalDAV/Schedule/FreeBusyRequestTest.php index 6bc861fbe6..570ab9edfc 100644 --- a/tests/Sabre/CalDAV/Schedule/FreeBusyRequestTest.php +++ b/tests/Sabre/CalDAV/Schedule/FreeBusyRequestTest.php @@ -19,7 +19,7 @@ class FreeBusyRequestTest extends \PHPUnit\Framework\TestCase protected $authPlugin; protected $caldavBackend; /** - * @var HTTP\ResponseMock + * @var HTTP\Response */ private $response; @@ -74,7 +74,7 @@ public function setup(): void $this->request = new HTTP\Request('GET', '/', [ 'Content-Type' => 'text/calendar', ]); - $this->response = new HTTP\ResponseMock(); + $this->response = new HTTP\Response(); $this->server = new DAV\Server($tree); $this->server->httpRequest = $this->request; @@ -277,7 +277,7 @@ public function testSucceed() $this->plugin->httpPost($this->server->httpRequest, $this->response) ); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); self::assertEquals([ 'Content-Type' => ['application/xml'], ], $this->response->getHeaders()); @@ -340,7 +340,7 @@ public function testSucceedNoCalendars() $this->plugin->httpPost($this->server->httpRequest, $this->response) ); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); self::assertEquals([ 'Content-Type' => ['application/xml'], ], $this->response->getHeaders()); @@ -392,7 +392,7 @@ public function testNoCalendarHomeFound() $this->plugin->httpPost($this->server->httpRequest, $this->response) ); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); self::assertEquals([ 'Content-Type' => ['application/xml'], ], $this->response->getHeaders()); @@ -444,7 +444,7 @@ public function testNoInboxFound() $this->plugin->httpPost($this->server->httpRequest, $this->response) ); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); self::assertEquals([ 'Content-Type' => ['application/xml'], ], $this->response->getHeaders()); @@ -511,7 +511,7 @@ public function testSucceedUseVAVAILABILITY() $this->plugin->httpPost($this->server->httpRequest, $this->response) ); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); self::assertEquals([ 'Content-Type' => ['application/xml'], ], $this->response->getHeaders()); diff --git a/tests/Sabre/CalDAV/Schedule/SchedulingObjectTest.php b/tests/Sabre/CalDAV/Schedule/SchedulingObjectTest.php index 732e6d1703..94650332fc 100644 --- a/tests/Sabre/CalDAV/Schedule/SchedulingObjectTest.php +++ b/tests/Sabre/CalDAV/Schedule/SchedulingObjectTest.php @@ -4,16 +4,17 @@ namespace Sabre\CalDAV\Schedule; +use Sabre\CalDAV; use Sabre\CalDAV\Backend; class SchedulingObjectTest extends \PHPUnit\Framework\TestCase { /** - * @var Sabre\CalDAV\Backend_PDO + * @var CalDAV\Backend\PDO */ protected $backend; /** - * @var Sabre\CalDAV\Calendar + * @var CalDAV\Calendar */ protected $calendar; /** diff --git a/tests/Sabre/CalDAV/SharingPluginTest.php b/tests/Sabre/CalDAV/SharingPluginTest.php index 1d35790df9..0d56ca3521 100644 --- a/tests/Sabre/CalDAV/SharingPluginTest.php +++ b/tests/Sabre/CalDAV/SharingPluginTest.php @@ -130,7 +130,7 @@ public function testUnknownMethodNoPOST() $response = $this->request($request); - self::assertEquals(501, $response->status, $response->getBodyAsString()); + self::assertEquals(501, $response->getStatus(), $response->getBodyAsString()); } public function testUnknownMethodNoXML() @@ -143,7 +143,7 @@ public function testUnknownMethodNoXML() $response = $this->request($request); - self::assertEquals(501, $response->status, $response->getBodyAsString()); + self::assertEquals(501, $response->getStatus(), $response->getBodyAsString()); } public function testUnknownMethodNoNode() @@ -156,7 +156,7 @@ public function testUnknownMethodNoNode() $response = $this->request($request); - self::assertEquals(501, $response->status, $response->getBodyAsString()); + self::assertEquals(501, $response->getStatus(), $response->getBodyAsString()); } public function testShareRequest() @@ -249,7 +249,7 @@ public function testInviteReply() $request->setBody($xml); $response = $this->request($request); - self::assertEquals(200, $response->status, $response->getBodyAsString()); + self::assertEquals(200, $response->getStatus(), $response->getBodyAsString()); } public function testInviteBadXML() @@ -266,7 +266,7 @@ public function testInviteBadXML() '; $request->setBody($xml); $response = $this->request($request); - self::assertEquals(400, $response->status, $response->getBodyAsString()); + self::assertEquals(400, $response->getStatus(), $response->getBodyAsString()); } public function testInviteWrongUrl() @@ -284,7 +284,7 @@ public function testInviteWrongUrl() '; $request->setBody($xml); $response = $this->request($request); - self::assertEquals(501, $response->status, $response->getBodyAsString()); + self::assertEquals(501, $response->getStatus(), $response->getBodyAsString()); // If the plugin did not handle this request, it must ensure that the // body is still accessible by other plugins. @@ -294,7 +294,7 @@ public function testInviteWrongUrl() public function testPostWithoutContentType() { $request = new HTTP\Request('POST', '/'); - $response = new HTTP\ResponseMock(); + $response = new HTTP\Response(); $this->caldavSharingPlugin->httpPost($request, $response); self::assertTrue(true); @@ -311,7 +311,7 @@ public function testPublish() $request->setBody($xml); $response = $this->request($request); - self::assertEquals(202, $response->status, $response->getBodyAsString()); + self::assertEquals(202, $response->getStatus(), $response->getBodyAsString()); } public function testUnpublish() @@ -329,7 +329,7 @@ public function testUnpublish() $request->setBody($xml); $response = $this->request($request); - self::assertEquals(200, $response->status, $response->getBodyAsString()); + self::assertEquals(200, $response->getStatus(), $response->getBodyAsString()); } public function testPublishWrongUrl() @@ -378,6 +378,6 @@ public function testUnknownXmlDoc() $request->setBody($xml); $response = $this->request($request); - self::assertEquals(501, $response->status, $response->getBodyAsString()); + self::assertEquals(501, $response->getStatus(), $response->getBodyAsString()); } } diff --git a/tests/Sabre/CalDAV/ValidateICalTest.php b/tests/Sabre/CalDAV/ValidateICalTest.php index 2d7b6f6684..e0786f08e6 100644 --- a/tests/Sabre/CalDAV/ValidateICalTest.php +++ b/tests/Sabre/CalDAV/ValidateICalTest.php @@ -15,7 +15,7 @@ class ValidateICalTest extends \PHPUnit\Framework\TestCase */ protected $server; /** - * @var Sabre\CalDAV\Backend\Mock + * @var Backend\Mock */ protected $calBackend; @@ -50,12 +50,12 @@ public function setup(): void $plugin = new Plugin(); $this->server->addPlugin($plugin); - $response = new HTTP\ResponseMock(); + $response = new HTTP\Response(); $this->server->httpResponse = $response; } /** - * @return Sabre\HTTP\ResponseMock + * @return HTTP\Response */ public function request(HTTP\Request $request) { @@ -74,7 +74,7 @@ public function testCreateFile() $response = $this->request($request); - self::assertEquals(415, $response->status); + self::assertEquals(415, $response->getStatus()); } public function testCreateFileValid() @@ -101,7 +101,7 @@ public function testCreateFileValid() $response = $this->request($request); - self::assertEquals(201, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); + self::assertEquals(201, $response->getStatus(), 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Length' => ['0'], @@ -141,7 +141,7 @@ public function testCreateFileNoVersion() $response = $this->request($request); - self::assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); + self::assertEquals(415, $response->getStatus(), 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); } public function testCreateFileNoVersionFixed() @@ -167,7 +167,7 @@ public function testCreateFileNoVersionFixed() $response = $this->request($request); - self::assertEquals(201, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); + self::assertEquals(201, $response->getStatus(), 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Length' => ['0'], @@ -214,7 +214,7 @@ public function testCreateFileNoComponents() $request->setBody($ics); $response = $this->request($request); - self::assertEquals(403, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); + self::assertEquals(403, $response->getStatus(), 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); } public function testCreateFileNoUID() @@ -227,7 +227,7 @@ public function testCreateFileNoUID() $response = $this->request($request); - self::assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); + self::assertEquals(415, $response->getStatus(), 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); } public function testCreateFileVCard() @@ -240,7 +240,7 @@ public function testCreateFileVCard() $response = $this->request($request); - self::assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); + self::assertEquals(415, $response->getStatus(), 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); } public function testCreateFile2Components() @@ -253,7 +253,7 @@ public function testCreateFile2Components() $response = $this->request($request); - self::assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); + self::assertEquals(415, $response->getStatus(), 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); } public function testCreateFile2UIDS() @@ -266,7 +266,7 @@ public function testCreateFile2UIDS() $response = $this->request($request); - self::assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); + self::assertEquals(415, $response->getStatus(), 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); } public function testCreateFileWrongComponent() @@ -279,7 +279,7 @@ public function testCreateFileWrongComponent() $response = $this->request($request); - self::assertEquals(403, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); + self::assertEquals(403, $response->getStatus(), 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); } public function testUpdateFile() @@ -292,7 +292,7 @@ public function testUpdateFile() $response = $this->request($request); - self::assertEquals(415, $response->status); + self::assertEquals(415, $response->getStatus()); } public function testUpdateFileParsableBody() @@ -317,7 +317,7 @@ public function testUpdateFileParsableBody() $request->setBody($ics); $response = $this->request($request); - self::assertEquals(204, $response->status); + self::assertEquals(204, $response->getStatus()); $expected = [ 'uri' => 'blabla.ics', @@ -339,7 +339,7 @@ public function testCreateFileInvalidComponent() $response = $this->request($request); - self::assertEquals(403, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); + self::assertEquals(403, $response->getStatus(), 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); } public function testUpdateFileInvalidComponent() @@ -353,7 +353,7 @@ public function testUpdateFileInvalidComponent() $response = $this->request($request); - self::assertEquals(403, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); + self::assertEquals(403, $response->getStatus(), 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); } /** @@ -386,7 +386,7 @@ public function testCreateFileModified() $response = $this->request($request); - self::assertEquals(201, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); + self::assertEquals(201, $response->getStatus(), 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); self::assertNull($response->getHeader('ETag')); } } diff --git a/tests/Sabre/CardDAV/AddressBookHomeTest.php b/tests/Sabre/CardDAV/AddressBookHomeTest.php index 5f54a2f980..bb3807b083 100644 --- a/tests/Sabre/CardDAV/AddressBookHomeTest.php +++ b/tests/Sabre/CardDAV/AddressBookHomeTest.php @@ -9,7 +9,7 @@ class AddressBookHomeTest extends \PHPUnit\Framework\TestCase { /** - * @var Sabre\CardDAV\AddressBookHome + * @var AddressBookHome */ protected $s; protected $backend; diff --git a/tests/Sabre/CardDAV/AddressBookQueryTest.php b/tests/Sabre/CardDAV/AddressBookQueryTest.php index 3e048ba46a..f04881cc85 100644 --- a/tests/Sabre/CardDAV/AddressBookQueryTest.php +++ b/tests/Sabre/CardDAV/AddressBookQueryTest.php @@ -29,7 +29,7 @@ public function testQuery() ' ); - $response = new HTTP\ResponseMock(); + $response = new HTTP\Response(); $this->server->httpRequest = $request; $this->server->httpResponse = $response; @@ -37,7 +37,7 @@ public function testQuery() $this->server->exec(); $bodyAsString = $response->getBodyAsString(); - self::assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); + self::assertEquals(207, $response->getStatus(), 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); @@ -78,7 +78,7 @@ public function testQueryDepth0() ' ); - $response = new HTTP\ResponseMock(); + $response = new HTTP\Response(); $this->server->httpRequest = $request; $this->server->httpResponse = $response; @@ -86,7 +86,7 @@ public function testQueryDepth0() $this->server->exec(); $bodyAsString = $response->getBodyAsString(); - self::assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); + self::assertEquals(207, $response->getStatus(), 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); @@ -122,7 +122,7 @@ public function testQueryNoMatch() ' ); - $response = new HTTP\ResponseMock(); + $response = new HTTP\Response(); $this->server->httpRequest = $request; $this->server->httpResponse = $response; @@ -130,7 +130,7 @@ public function testQueryNoMatch() $this->server->exec(); $bodyAsString = $response->getBodyAsString(); - self::assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); + self::assertEquals(207, $response->getStatus(), 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); @@ -161,7 +161,7 @@ public function testQueryLimit() ' ); - $response = new HTTP\ResponseMock(); + $response = new HTTP\Response(); $this->server->httpRequest = $request; $this->server->httpResponse = $response; @@ -169,7 +169,7 @@ public function testQueryLimit() $this->server->exec(); $bodyAsString = $response->getBodyAsString(); - self::assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); + self::assertEquals(207, $response->getStatus(), 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); @@ -203,7 +203,7 @@ public function testJson() ' ); - $response = new HTTP\ResponseMock(); + $response = new HTTP\Response(); $this->server->httpRequest = $request; $this->server->httpResponse = $response; @@ -211,7 +211,7 @@ public function testJson() $this->server->exec(); $bodyAsString = $response->getBodyAsString(); - self::assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); + self::assertEquals(207, $response->getStatus(), 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); @@ -248,7 +248,7 @@ public function testVCard4() ' ); - $response = new HTTP\ResponseMock(); + $response = new HTTP\Response(); $this->server->httpRequest = $request; $this->server->httpResponse = $response; @@ -256,7 +256,7 @@ public function testVCard4() $this->server->exec(); $bodyAsString = $response->getBodyAsString(); - self::assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); + self::assertEquals(207, $response->getStatus(), 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); @@ -293,14 +293,14 @@ public function testAddressBookDepth0() ' ); - $response = new HTTP\ResponseMock(); + $response = new HTTP\Response(); $this->server->httpRequest = $request; $this->server->httpResponse = $response; $this->server->exec(); - self::assertEquals(415, $response->status, 'Incorrect status code. Full response body:'.$response->getBodyAsString()); + self::assertEquals(415, $response->getStatus(), 'Incorrect status code. Full response body:'.$response->getBodyAsString()); } public function testAddressBookProperties() @@ -324,7 +324,7 @@ public function testAddressBookProperties() ' ); - $response = new HTTP\ResponseMock(); + $response = new HTTP\Response(); $this->server->httpRequest = $request; $this->server->httpResponse = $response; @@ -332,7 +332,7 @@ public function testAddressBookProperties() $this->server->exec(); $bodyAsString = $response->getBodyAsString(); - self::assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); + self::assertEquals(207, $response->getStatus(), 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); diff --git a/tests/Sabre/CardDAV/AddressBookTest.php b/tests/Sabre/CardDAV/AddressBookTest.php index 1df0f0fdcd..e90034febc 100644 --- a/tests/Sabre/CardDAV/AddressBookTest.php +++ b/tests/Sabre/CardDAV/AddressBookTest.php @@ -11,7 +11,7 @@ class AddressBookTest extends \PHPUnit\Framework\TestCase use \Sabre\DAV\DbTestHelperTrait; /** - * @var Sabre\CardDAV\AddressBook + * @var AddressBook */ protected $ab; protected $backend; diff --git a/tests/Sabre/CardDAV/CardTest.php b/tests/Sabre/CardDAV/CardTest.php index acd0eb949b..9620bf3b24 100644 --- a/tests/Sabre/CardDAV/CardTest.php +++ b/tests/Sabre/CardDAV/CardTest.php @@ -7,11 +7,11 @@ class CardTest extends \PHPUnit\Framework\TestCase { /** - * @var Sabre\CardDAV\Card + * @var Card */ protected $card; /** - * @var Sabre\CardDAV\MockBackend + * @var Backend\Mock */ protected $backend; diff --git a/tests/Sabre/CardDAV/MultiGetTest.php b/tests/Sabre/CardDAV/MultiGetTest.php index 3557ddaeaa..895c2ab12b 100644 --- a/tests/Sabre/CardDAV/MultiGetTest.php +++ b/tests/Sabre/CardDAV/MultiGetTest.php @@ -27,7 +27,7 @@ public function testMultiGet() ' ); - $response = new HTTP\ResponseMock(); + $response = new HTTP\Response(); $this->server->httpRequest = $request; $this->server->httpResponse = $response; @@ -35,7 +35,7 @@ public function testMultiGet() $this->server->exec(); $bodyAsString = $response->getBodyAsString(); - self::assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); + self::assertEquals(207, $response->getStatus(), 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); @@ -70,7 +70,7 @@ public function testMultiGetVCard4() ' ); - $response = new HTTP\ResponseMock(); + $response = new HTTP\Response(); $this->server->httpRequest = $request; $this->server->httpResponse = $response; @@ -78,7 +78,7 @@ public function testMultiGetVCard4() $this->server->exec(); $bodyAsString = $response->getBodyAsString(); - self::assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); + self::assertEquals(207, $response->getStatus(), 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); diff --git a/tests/Sabre/CardDAV/PluginTest.php b/tests/Sabre/CardDAV/PluginTest.php index 9d17227c5f..f893344dbb 100644 --- a/tests/Sabre/CardDAV/PluginTest.php +++ b/tests/Sabre/CardDAV/PluginTest.php @@ -85,7 +85,7 @@ public function testAddressbookPluginProperties() public function testGetTransform() { $request = new \Sabre\HTTP\Request('GET', '/addressbooks/user1/book1/card1', ['Accept' => 'application/vcard+json']); - $response = new \Sabre\HTTP\ResponseMock(); + $response = new \Sabre\HTTP\Response(); $this->server->invokeMethod($request, $response); self::assertEquals(200, $response->getStatus()); @@ -94,7 +94,7 @@ public function testGetTransform() public function testGetWithoutContentType() { $request = new \Sabre\HTTP\Request('GET', '/'); - $response = new \Sabre\HTTP\ResponseMock(); + $response = new \Sabre\HTTP\Response(); $this->plugin->httpAfterGet($request, $response); self::assertTrue(true); } diff --git a/tests/Sabre/CardDAV/VCFExportTest.php b/tests/Sabre/CardDAV/VCFExportTest.php index e38fee6e3d..927e6163e6 100644 --- a/tests/Sabre/CardDAV/VCFExportTest.php +++ b/tests/Sabre/CardDAV/VCFExportTest.php @@ -57,7 +57,7 @@ public function testExport() ]); $response = $this->request($request); - self::assertEquals(200, $response->status, $response->getBodyAsString()); + self::assertEquals(200, $response->getStatus(), $response->getBodyAsString()); $expected = 'BEGIN:VCARD FN:Person1 diff --git a/tests/Sabre/CardDAV/ValidateVCardTest.php b/tests/Sabre/CardDAV/ValidateVCardTest.php index 46ff5f7006..c037b68eae 100644 --- a/tests/Sabre/CardDAV/ValidateVCardTest.php +++ b/tests/Sabre/CardDAV/ValidateVCardTest.php @@ -37,7 +37,7 @@ public function setup(): void $plugin = new Plugin(); $this->server->addPlugin($plugin); - $response = new HTTP\ResponseMock(); + $response = new HTTP\Response(); $this->server->httpResponse = $response; } @@ -72,7 +72,7 @@ public function testCreateFile() $response = $this->request($request); - self::assertEquals(415, $response->status); + self::assertEquals(415, $response->getStatus()); } public function testCreateFileValid() @@ -238,7 +238,7 @@ public function testCreateFileJson() $response = $this->request($request); - self::assertEquals(201, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); + self::assertEquals(201, $response->getStatus(), 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); $foo = $this->cardBackend->getCard('addressbook1', 'blabla.vcf'); self::assertEquals("BEGIN:VCARD\r\nVERSION:4.0\r\nUID:foo\r\nFN:FirstName LastName\r\nEND:VCARD\r\n", $foo['carddata']); @@ -254,7 +254,7 @@ public function testCreateFileVCalendar() $response = $this->request($request); - self::assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); + self::assertEquals(415, $response->getStatus(), 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); } public function testUpdateFile() diff --git a/tests/Sabre/DAV/AbstractServerTestCase.php b/tests/Sabre/DAV/AbstractServerTestCase.php index 053a229dbc..b42e274634 100644 --- a/tests/Sabre/DAV/AbstractServerTestCase.php +++ b/tests/Sabre/DAV/AbstractServerTestCase.php @@ -6,13 +6,13 @@ use PHPUnit\Framework\TestCase; use Sabre\HTTP; -use Sabre\HTTP\ResponseMock; +use Sabre\HTTP\Response; use Sabre\TestUtil; abstract class AbstractServerTestCase extends TestCase { /** - * @var ResponseMock + * @var Response */ protected $response; protected $request; @@ -24,7 +24,7 @@ abstract class AbstractServerTestCase extends TestCase public function setup(): void { - $this->response = new ResponseMock(); + $this->response = new Response(); $this->server = new Server($this->getRootNode()); $this->server->sapi = new HTTP\SapiMock(); $this->server->httpResponse = $this->response; diff --git a/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php b/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php index b029884b39..9fa5740e1d 100644 --- a/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php +++ b/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php @@ -130,5 +130,7 @@ public function getDigestHash($realm, $userName) case 'array': return []; case 'user': return 'HELLO'; } + + return null; } } diff --git a/tests/Sabre/DAV/Auth/Backend/AbstractPDOTestCaseCase.php b/tests/Sabre/DAV/Auth/Backend/AbstractPDOTestCaseCase.php index 65deddcc38..841a6610ba 100644 --- a/tests/Sabre/DAV/Auth/Backend/AbstractPDOTestCaseCase.php +++ b/tests/Sabre/DAV/Auth/Backend/AbstractPDOTestCaseCase.php @@ -25,6 +25,7 @@ public function testConstruct() { $pdo = $this->getPDO(); $backend = new PDO($pdo); + self::assertTrue($backend instanceof PDO); } @@ -37,9 +38,6 @@ public function testUserInfo() $backend = new PDO($pdo); self::assertNull($backend->getDigestHash('realm', 'blabla')); - - $expected = 'hash'; - - self::assertEquals($expected, $backend->getDigestHash('realm', 'user')); + self::assertEquals('hash', $backend->getDigestHash('realm', 'user')); } } diff --git a/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php b/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php index 68193ce6d0..3fe924a116 100644 --- a/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php +++ b/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php @@ -27,7 +27,7 @@ public function testCollectionGet() $this->server->httpRequest = ($request); $this->server->exec(); - self::assertEquals(207, $this->response->status, 'Incorrect status response received. Full response body: '.$this->response->getBodyAsString()); + self::assertEquals(207, $this->response->getStatus(), 'Incorrect status response received. Full response body: '.$this->response->getBodyAsString()); self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], diff --git a/tests/Sabre/DAV/Browser/PluginTest.php b/tests/Sabre/DAV/Browser/PluginTest.php index 6efb00b081..2515e24899 100644 --- a/tests/Sabre/DAV/Browser/PluginTest.php +++ b/tests/Sabre/DAV/Browser/PluginTest.php @@ -70,7 +70,7 @@ public function testCollectionGetRoot() $this->server->httpRequest = ($request); $this->server->exec(); - self::assertEquals(200, $this->response->status, 'Incorrect status received. Full response body: '.$this->response->getBodyAsString()); + self::assertEquals(200, $this->response->getStatus(), 'Incorrect status received. Full response body: '.$this->response->getBodyAsString()); self::assertEquals( [ 'X-Sabre-Version' => [DAV\Version::VERSION], @@ -101,7 +101,7 @@ public function testPostOtherContentType() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(501, $this->response->status); + self::assertEquals(501, $this->response->getStatus()); } public function testPostNoContentType() @@ -110,7 +110,7 @@ public function testPostNoContentType() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(501, $this->response->status); + self::assertEquals(501, $this->response->getStatus()); } public function testPostNoSabreAction() @@ -120,7 +120,7 @@ public function testPostNoSabreAction() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(501, $this->response->status); + self::assertEquals(501, $this->response->getStatus()); } public function testPostMkCol() @@ -140,7 +140,7 @@ public function testPostMkCol() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(302, $this->response->status); + self::assertEquals(302, $this->response->getStatus()); self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Location' => ['/'], diff --git a/tests/Sabre/DAV/FSExt/ServerTest.php b/tests/Sabre/DAV/FSExt/ServerTest.php index c884ae6bd0..498975ae76 100644 --- a/tests/Sabre/DAV/FSExt/ServerTest.php +++ b/tests/Sabre/DAV/FSExt/ServerTest.php @@ -52,7 +52,7 @@ public function testHEAD() $this->response->getHeaders() ); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); self::assertEquals('', $this->response->getBodyAsString()); } @@ -70,7 +70,7 @@ public function testPut() 'ETag' => ['"'.sha1(fileinode($filename).filesize($filename).filemtime($filename)).'"'], ], $this->response->getHeaders()); - self::assertEquals(201, $this->response->status); + self::assertEquals(201, $this->response->getStatus()); self::assertEquals('', $this->response->getBodyAsString()); self::assertEquals('Testing new file', file_get_contents($filename)); } @@ -87,7 +87,7 @@ public function testPutAlreadyExists() 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders()); - self::assertEquals(412, $this->response->status); + self::assertEquals(412, $this->response->getStatus()); self::assertNotEquals('Testing new file', file_get_contents($this->tempDir.'/test.txt')); } @@ -102,7 +102,7 @@ public function testMkcol() 'Content-Length' => ['0'], ], $this->response->getHeaders()); - self::assertEquals(201, $this->response->status); + self::assertEquals(201, $this->response->getStatus()); self::assertEquals('', $this->response->getBodyAsString()); self::assertTrue(is_dir($this->tempDir.'/testcol')); } @@ -116,7 +116,7 @@ public function testPutUpdate() self::assertEquals('0', $this->response->getHeader('Content-Length')); - self::assertEquals(204, $this->response->status); + self::assertEquals(204, $this->response->getStatus()); self::assertEquals('', $this->response->getBodyAsString()); self::assertEquals('Testing updated file', file_get_contents($this->tempDir.'/test.txt')); } @@ -132,7 +132,7 @@ public function testDelete() 'Content-Length' => ['0'], ], $this->response->getHeaders()); - self::assertEquals(204, $this->response->status); + self::assertEquals(204, $this->response->getStatus()); self::assertEquals('', $this->response->getBodyAsString()); self::assertFalse(file_exists($this->tempDir.'/test.txt')); } @@ -150,7 +150,7 @@ public function testDeleteDirectory() 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Length' => ['0'], ], $this->response->getHeaders()); - self::assertEquals(204, $this->response->status); + self::assertEquals(204, $this->response->getStatus()); self::assertEquals('', $this->response->getBodyAsString()); self::assertFalse(file_exists($this->tempDir.'/testcol')); } @@ -170,7 +170,7 @@ public function testOptions() 'X-Sabre-Version' => [DAV\Version::VERSION], ], $this->response->getHeaders()); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); self::assertEquals('', $this->response->getBodyAsString()); } @@ -182,7 +182,7 @@ public function testMove() $this->server->httpRequest = ($request); $this->server->exec(); - self::assertEquals(201, $this->response->status); + self::assertEquals(201, $this->response->getStatus()); self::assertEquals('', $this->response->getBodyAsString()); self::assertEquals([ @@ -217,7 +217,7 @@ public function testMoveOtherObject() $this->server->httpRequest = ($request); $this->server->exec(); - self::assertEquals(201, $this->response->status); + self::assertEquals(201, $this->response->getStatus()); self::assertEquals('', $this->response->getBodyAsString()); self::assertEquals([ @@ -241,7 +241,7 @@ public function testCopy() $this->server->httpRequest = ($request); $this->server->exec(); - self::assertEquals(201, $this->response->status); + self::assertEquals(201, $this->response->getStatus()); self::assertEquals('', $this->response->getBodyAsString()); self::assertEquals([ diff --git a/tests/Sabre/DAV/HTTPPreferParsingTest.php b/tests/Sabre/DAV/HTTPPreferParsingTest.php index 5ab171b6ba..d37116962a 100644 --- a/tests/Sabre/DAV/HTTPPreferParsingTest.php +++ b/tests/Sabre/DAV/HTTPPreferParsingTest.php @@ -147,7 +147,7 @@ public function testproppatchMinimal() $response = $this->request($request); self::assertEquals('', $response->getBodyAsString(), 'Expected empty body: '.$response->getBodyAsString()); - self::assertEquals(204, $response->status); + self::assertEquals(204, $response->getStatus()); } public function testproppatchMinimalError() @@ -169,7 +169,7 @@ public function testproppatchMinimalError() $body = $response->getBodyAsString(); - self::assertEquals(207, $response->status); + self::assertEquals(207, $response->getStatus()); self::assertTrue(false !== strpos($body, 'something')); self::assertTrue(false !== strpos($body, '403 Forbidden'), $body); } diff --git a/tests/Sabre/DAV/HttpPutTest.php b/tests/Sabre/DAV/HttpPutTest.php index 36c55a6b46..91325131ba 100644 --- a/tests/Sabre/DAV/HttpPutTest.php +++ b/tests/Sabre/DAV/HttpPutTest.php @@ -129,7 +129,7 @@ public function testPutExistingIfMatchCorrect() $response = $this->request($request); - self::assertEquals(204, $response->status); + self::assertEquals(204, $response->getStatus()); self::assertEquals( 'hello', diff --git a/tests/Sabre/DAV/Issue33Test.php b/tests/Sabre/DAV/Issue33Test.php index f9598f1529..84950b4d02 100644 --- a/tests/Sabre/DAV/Issue33Test.php +++ b/tests/Sabre/DAV/Issue33Test.php @@ -70,7 +70,7 @@ public function testEverything() $request->setBody(''); - $response = new HTTP\ResponseMock(); + $response = new HTTP\Response(); // Server setup mkdir(\Sabre\TestUtil::SABRE_TEMPDIR.'/issue33'); diff --git a/tests/Sabre/DAV/Locks/MSWordTest.php b/tests/Sabre/DAV/Locks/MSWordTest.php index 2fb9aeb2e7..c70dfd3f12 100644 --- a/tests/Sabre/DAV/Locks/MSWordTest.php +++ b/tests/Sabre/DAV/Locks/MSWordTest.php @@ -25,7 +25,7 @@ public function testLockEtc() $locksPlugin = new Plugin($locksBackend); $server->addPlugin($locksPlugin); - $response1 = new HTTP\ResponseMock(); + $response1 = new HTTP\Response(); $server->httpRequest = $this->getLockRequest(); $server->httpResponse = $response1; @@ -33,28 +33,28 @@ public function testLockEtc() $server->exec(); self::assertEquals(201, $server->httpResponse->getStatus(), 'Full response body:'.$response1->getBodyAsString()); - self::assertTrue((bool) $server->httpResponse->getHeaders('Lock-Token')); + self::assertTrue((bool) $server->httpResponse->getHeader('Lock-Token')); $lockToken = $server->httpResponse->getHeader('Lock-Token'); //sleep(10); - $response2 = new HTTP\ResponseMock(); + $response2 = new HTTP\Response(); $server->httpRequest = $this->getLockRequest2(); $server->httpResponse = $response2; $server->exec(); - self::assertEquals(201, $server->httpResponse->status); - self::assertTrue((bool) $server->httpResponse->getHeaders('Lock-Token')); + self::assertEquals(201, $server->httpResponse->getStatus()); + self::assertTrue((bool) $server->httpResponse->getHeader('Lock-Token')); //sleep(10); - $response3 = new HTTP\ResponseMock(); + $response3 = new HTTP\Response(); $server->httpRequest = $this->getPutRequest($lockToken); $server->httpResponse = $response3; $server->exec(); - self::assertEquals(204, $server->httpResponse->status); + self::assertEquals(204, $server->httpResponse->getStatus()); } public function getLockRequest() diff --git a/tests/Sabre/DAV/Locks/PluginTest.php b/tests/Sabre/DAV/Locks/PluginTest.php index c82033c063..235c4d9a72 100644 --- a/tests/Sabre/DAV/Locks/PluginTest.php +++ b/tests/Sabre/DAV/Locks/PluginTest.php @@ -54,7 +54,7 @@ public function testLockNoBody() $this->response->getHeaders() ); - self::assertEquals(400, $this->response->status); + self::assertEquals(400, $this->response->getStatus()); } public function testLock() @@ -75,7 +75,7 @@ public function testLock() self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); self::assertTrue(1 === preg_match('/^$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - self::assertEquals(200, $this->response->status, 'Got an incorrect status back. Response body: '.$this->response->getBodyAsString()); + self::assertEquals(200, $this->response->getStatus(), 'Got an incorrect status back. Response body: '.$this->response->getBodyAsString()); $xml = $this->getSanitizedBodyAsXml(); $xml->registerXPathNamespace('d', 'urn:DAV'); @@ -125,7 +125,7 @@ public function testLockWithContext() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(200, $this->response->status, 'Got an incorrect status back. Response body: '.$this->response->getBodyAsString()); + self::assertEquals(200, $this->response->getStatus(), 'Got an incorrect status back. Response body: '.$this->response->getBodyAsString()); $xml = $this->getSanitizedBodyAsXml(); $xml->registerXPathNamespace('d', 'urn:DAV'); @@ -152,14 +152,14 @@ public function testDoubleLock() $this->server->httpRequest = $request; $this->server->exec(); - $this->response = new HTTP\ResponseMock(); + $this->response = new HTTP\Response(); $this->server->httpResponse = $this->response; $this->server->exec(); self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - self::assertEquals(423, $this->response->status, 'Full response: '.$this->response->getBodyAsString()); + self::assertEquals(423, $this->response->getStatus(), 'Full response: '.$this->response->getBodyAsString()); } /** @@ -182,7 +182,7 @@ public function testLockRefresh() $lockToken = $this->response->getHeader('Lock-Token'); - $this->response = new HTTP\ResponseMock(); + $this->response = new HTTP\Response(); $this->server->httpResponse = $this->response; $request = new HTTP\Request('LOCK', '/test.txt', ['If' => '('.$lockToken.')']); @@ -193,7 +193,7 @@ public function testLockRefresh() self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - self::assertEquals(200, $this->response->status, 'We received an incorrect status code. Full response body: '.$this->response->getBody()); + self::assertEquals(200, $this->response->getStatus(), 'We received an incorrect status code. Full response body: '.$this->response->getBody()); } /** @@ -216,7 +216,7 @@ public function testLockRefreshBadToken() $lockToken = $this->response->getHeader('Lock-Token'); - $this->response = new HTTP\ResponseMock(); + $this->response = new HTTP\Response(); $this->server->httpResponse = $this->response; $request = new HTTP\Request('LOCK', '/test.txt', ['If' => '('.$lockToken.'foobar) ()']); @@ -251,7 +251,7 @@ public function testLockNoFile() self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); self::assertTrue(1 === preg_match('/^$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - self::assertEquals(201, $this->response->status); + self::assertEquals(201, $this->response->getStatus()); } /** @@ -270,7 +270,7 @@ public function testUnlockNoToken() $this->response->getHeaders() ); - self::assertEquals(400, $this->response->status); + self::assertEquals(400, $this->response->getStatus()); } /** @@ -289,7 +289,7 @@ public function testUnlockBadToken() $this->response->getHeaders() ); - self::assertEquals(409, $this->response->status, 'Got an incorrect status code. Full response body: '.$this->response->getBodyAsString()); + self::assertEquals(409, $this->response->getStatus(), 'Got an incorrect status code. Full response body: '.$this->response->getBodyAsString()); } /** @@ -313,7 +313,7 @@ public function testLockPutNoToken() self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); self::assertTrue(1 === preg_match('/^$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); $request = new HTTP\Request('PUT', '/test.txt'); $request->setBody('newbody'); @@ -323,7 +323,7 @@ public function testLockPutNoToken() self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); self::assertTrue(1 === preg_match('/^$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - self::assertEquals(423, $this->response->status); + self::assertEquals(423, $this->response->getStatus()); } /** @@ -348,10 +348,10 @@ public function testUnlock() $request = new HTTP\Request('UNLOCK', '/test.txt', ['Lock-Token' => $lockToken]); $this->server->httpRequest = $request; - $this->server->httpResponse = new HTTP\ResponseMock(); + $this->server->httpResponse = new HTTP\Response(); $this->server->invokeMethod($request, $this->server->httpResponse); - self::assertEquals(204, $this->server->httpResponse->status, 'Got an incorrect status code. Full response body: '.$this->response->getBodyAsString()); + self::assertEquals(204, $this->server->httpResponse->getStatus(), 'Got an incorrect status code. Full response body: '.$this->response->getBodyAsString()); self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Length' => ['0'], @@ -385,10 +385,10 @@ public function testUnlockWindowsBug() $request = new HTTP\Request('UNLOCK', '/test.txt', ['Lock-Token' => $lockToken]); $this->server->httpRequest = $request; - $this->server->httpResponse = new HTTP\ResponseMock(); + $this->server->httpResponse = new HTTP\Response(); $this->server->invokeMethod($request, $this->server->httpResponse); - self::assertEquals(204, $this->server->httpResponse->status, 'Got an incorrect status code. Full response body: '.$this->response->getBodyAsString()); + self::assertEquals(204, $this->server->httpResponse->getStatus(), 'Got an incorrect status code. Full response body: '.$this->response->getBodyAsString()); self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Length' => ['0'], @@ -441,7 +441,7 @@ public function testLockPutBadToken() self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); self::assertTrue(1 === preg_match('/^$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); $request = new HTTP\Request('PUT', '/test.txt', [ 'If' => '()', @@ -453,8 +453,8 @@ public function testLockPutBadToken() self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); self::assertTrue(1 === preg_match('/^$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - // self::assertEquals('412 Precondition failed',$this->response->status); - self::assertEquals(423, $this->response->status); + // self::assertEquals('412 Precondition failed',$this->response->getStatus()); + self::assertEquals(423, $this->response->getStatus()); } /** @@ -478,13 +478,13 @@ public function testLockDeleteParent() self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); self::assertTrue(1 === preg_match('/^$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); $request = new HTTP\Request('DELETE', '/dir'); $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(423, $this->response->status); + self::assertEquals(423, $this->response->getStatus()); self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); } @@ -509,7 +509,7 @@ public function testLockDeleteSucceed() self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); self::assertTrue(1 === preg_match('/^$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); $request = new HTTP\Request('DELETE', '/dir/child.txt', [ 'If' => '('.$this->response->getHeader('Lock-Token').')', @@ -517,7 +517,7 @@ public function testLockDeleteSucceed() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(204, $this->response->status); + self::assertEquals(204, $this->response->getStatus()); self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); } @@ -540,7 +540,7 @@ public function testParentLockDelete() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); $lockToken = $this->response->getHeader('Lock-Token'); $request = new HTTP\Request('DELETE', '/dir/child.txt', [ @@ -549,15 +549,15 @@ public function testParentLockDelete() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(204, $this->response->status); + self::assertEquals(204, $this->response->getStatus()); // verify that the LOCK on /dir/ itself continues to exist by unlocking: $request = new HTTP\Request('UNLOCK', '/dir/', ['Lock-Token' => $lockToken]); $this->server->httpRequest = $request; - $this->server->httpResponse = new HTTP\ResponseMock(); + $this->server->httpResponse = new HTTP\Response(); $this->server->invokeMethod($request, $this->server->httpResponse); - self::assertEquals(204, $this->server->httpResponse->status, 'Got an incorrect status code. Full response body: '.$this->response->getBodyAsString()); + self::assertEquals(204, $this->server->httpResponse->getStatus(), 'Got an incorrect status code. Full response body: '.$this->response->getBodyAsString()); } /** @@ -581,7 +581,7 @@ public function testLockCopyLockSource() self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); self::assertTrue(1 === preg_match('/^$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); $request = new HTTP\Request('COPY', '/dir/child.txt', [ 'Destination' => '/dir/child2.txt', @@ -591,7 +591,7 @@ public function testLockCopyLockSource() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(201, $this->response->status, 'Copy must succeed if only the source is locked, but not the destination'); + self::assertEquals(201, $this->response->getStatus(), 'Copy must succeed if only the source is locked, but not the destination'); self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); } @@ -616,7 +616,7 @@ public function testLockCopyLockDestination() self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); self::assertTrue(1 === preg_match('/^$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - self::assertEquals(201, $this->response->status); + self::assertEquals(201, $this->response->getStatus()); $request = new HTTP\Request('COPY', '/dir/child.txt', [ 'Destination' => '/dir/child2.txt', @@ -625,7 +625,7 @@ public function testLockCopyLockDestination() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(423, $this->response->status, 'Copy must succeed if only the source is locked, but not the destination'); + self::assertEquals(423, $this->response->getStatus(), 'Copy must succeed if only the source is locked, but not the destination'); self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); } @@ -650,7 +650,7 @@ public function testLockMoveLockSourceLocked() self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); self::assertTrue(1 === preg_match('/^$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); $request = new HTTP\Request('MOVE', '/dir/child.txt', [ 'Destination' => '/dir/child2.txt', @@ -658,7 +658,7 @@ public function testLockMoveLockSourceLocked() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(423, $this->response->status, 'Copy must succeed if only the source is locked, but not the destination'); + self::assertEquals(423, $this->response->getStatus(), 'Copy must succeed if only the source is locked, but not the destination'); self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); } @@ -683,7 +683,7 @@ public function testLockMoveLockSourceSucceed() self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); self::assertTrue(1 === preg_match('/^$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); $request = new HTTP\Request('MOVE', '/dir/child.txt', [ 'Destination' => '/dir/child2.txt', @@ -692,7 +692,7 @@ public function testLockMoveLockSourceSucceed() $this->server->httpRequest = $request; $this->server->exec(); - self::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()); + self::assertEquals(201, $this->response->getStatus(), 'A valid lock-token was provided for the source, so this MOVE operation must succeed. Full response body: '.$this->response->getBodyAsString()); } /** @@ -716,7 +716,7 @@ public function testLockMoveLockDestination() self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); self::assertTrue(1 === preg_match('/^$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - self::assertEquals(201, $this->response->status); + self::assertEquals(201, $this->response->getStatus()); $request = new HTTP\Request('MOVE', '/dir/child.txt', [ 'Destination' => '/dir/child2.txt', @@ -724,7 +724,7 @@ public function testLockMoveLockDestination() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(423, $this->response->status, 'Copy must succeed if only the source is locked, but not the destination'); + self::assertEquals(423, $this->response->getStatus(), 'Copy must succeed if only the source is locked, but not the destination'); self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); } @@ -751,7 +751,7 @@ public function testLockMoveLockParent() self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); self::assertTrue(1 === preg_match('/^$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); $request = new HTTP\Request('MOVE', '/dir/child.txt', [ 'Destination' => '/dir/child2.txt', @@ -760,7 +760,7 @@ public function testLockMoveLockParent() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(201, $this->response->status, 'We locked the parent of both the source and destination, but the move didn\'t succeed.'); + self::assertEquals(201, $this->response->getStatus(), 'We locked the parent of both the source and destination, but the move didn\'t succeed.'); self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); } @@ -785,7 +785,7 @@ public function testLockPutGoodToken() self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); self::assertTrue(1 === preg_match('/^$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); $request = new HTTP\Request('PUT', '/test.txt', [ 'If' => '('.$this->response->getHeader('Lock-Token').')', @@ -797,7 +797,7 @@ public function testLockPutGoodToken() self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); self::assertTrue(1 === preg_match('/^$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - self::assertEquals(204, $this->response->status); + self::assertEquals(204, $this->response->getStatus()); } /** @@ -835,7 +835,7 @@ public function testLockPutUnrelatedToken() self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); self::assertTrue(1 === preg_match('/^$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - self::assertEquals(204, $this->response->status); + self::assertEquals(204, $this->response->getStatus()); } public function testPutWithIncorrectETag() @@ -846,7 +846,7 @@ public function testPutWithIncorrectETag() $request->setBody('newbody'); $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(412, $this->response->status); + self::assertEquals(412, $this->response->getStatus()); } /** @@ -872,7 +872,7 @@ public function testPutWithCorrectETag() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(204, $this->response->status, 'Incorrect status received. Full response body:'.$this->response->getBodyAsString()); + self::assertEquals(204, $this->response->getStatus(), 'Incorrect status received. Full response body:'.$this->response->getBodyAsString()); } public function testDeleteWithETagOnCollection() @@ -883,7 +883,7 @@ public function testDeleteWithETagOnCollection() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(412, $this->response->status); + self::assertEquals(412, $this->response->getStatus()); } public function testGetTimeoutHeader() diff --git a/tests/Sabre/DAV/Mock/SharedNode.php b/tests/Sabre/DAV/Mock/SharedNode.php index da1e0efa5a..13c1b348e1 100644 --- a/tests/Sabre/DAV/Mock/SharedNode.php +++ b/tests/Sabre/DAV/Mock/SharedNode.php @@ -5,7 +5,7 @@ namespace Sabre\DAV\Mock; use Sabre\DAV\Sharing\ISharedNode; -use Sabre\DAV\Sharing\Sharee; +use Sabre\DAV\Xml\Element\Sharee; class SharedNode extends \Sabre\DAV\Node implements ISharedNode { diff --git a/tests/Sabre/DAV/Mount/PluginTest.php b/tests/Sabre/DAV/Mount/PluginTest.php index e630d561f8..4c81f936f0 100644 --- a/tests/Sabre/DAV/Mount/PluginTest.php +++ b/tests/Sabre/DAV/Mount/PluginTest.php @@ -26,7 +26,7 @@ public function testPassThrough() $this->server->httpRequest = ($request); $this->server->exec(); - self::assertEquals(501, $this->response->status, 'We expected GET to not be implemented for Directories. Response body: '.$this->response->getBodyAsString()); + self::assertEquals(501, $this->response->getStatus(), 'We expected GET to not be implemented for Directories. Response body: '.$this->response->getBodyAsString()); } public function testMountResponse() @@ -42,7 +42,7 @@ public function testMountResponse() $this->server->httpRequest = ($request); $this->server->exec(); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); $xml = simplexml_load_string($this->response->getBodyAsString()); self::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)); diff --git a/tests/Sabre/DAV/PartialUpdate/FileMock.php b/tests/Sabre/DAV/PartialUpdate/FileMock.php index 72fdb5ec84..000b539ba0 100644 --- a/tests/Sabre/DAV/PartialUpdate/FileMock.php +++ b/tests/Sabre/DAV/PartialUpdate/FileMock.php @@ -6,7 +6,7 @@ use Sabre\DAV; -class FileMock implements IPatchSupport +class FileMock implements DAV\IFile, IPatchSupport { protected $data = ''; diff --git a/tests/Sabre/DAV/PartialUpdate/PluginTest.php b/tests/Sabre/DAV/PartialUpdate/PluginTest.php index 035813578b..2c014dbd4b 100644 --- a/tests/Sabre/DAV/PartialUpdate/PluginTest.php +++ b/tests/Sabre/DAV/PartialUpdate/PluginTest.php @@ -42,7 +42,7 @@ public function testPatchNoRange() ]); $response = $this->request($request); - self::assertEquals(400, $response->status, 'Full response body:'.$response->getBodyAsString()); + self::assertEquals(400, $response->getStatus(), 'Full response body:'.$response->getBodyAsString()); } public function testPatchNotSupported() @@ -54,7 +54,7 @@ public function testPatchNotSupported() ); $response = $this->request($request); - self::assertEquals(405, $response->status, 'Full response body:'.$response->getBodyAsString()); + self::assertEquals(405, $response->getStatus(), 'Full response body:'.$response->getBodyAsString()); } public function testPatchNoContentType() @@ -66,7 +66,7 @@ public function testPatchNoContentType() ); $response = $this->request($request); - self::assertEquals(415, $response->status, 'Full response body:'.$response->getBodyAsString()); + self::assertEquals(415, $response->getStatus(), 'Full response body:'.$response->getBodyAsString()); } public function testPatchBadRange() @@ -78,7 +78,7 @@ public function testPatchBadRange() ); $response = $this->request($request); - self::assertEquals(416, $response->status, 'Full response body:'.$response->getBodyAsString()); + self::assertEquals(416, $response->getStatus(), 'Full response body:'.$response->getBodyAsString()); } public function testPatchNoLength() @@ -90,7 +90,7 @@ public function testPatchNoLength() ); $response = $this->request($request); - self::assertEquals(411, $response->status, 'Full response body:'.$response->getBodyAsString()); + self::assertEquals(411, $response->getStatus(), 'Full response body:'.$response->getBodyAsString()); } public function testPatchSuccess() @@ -102,7 +102,7 @@ public function testPatchSuccess() ); $response = $this->request($request); - self::assertEquals(204, $response->status, 'Full response body:'.$response->getBodyAsString()); + self::assertEquals(204, $response->getStatus(), 'Full response body:'.$response->getBodyAsString()); self::assertEquals('aaabbbaa', $this->node->get()); } diff --git a/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php b/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php index f92c475071..d4c253357e 100644 --- a/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php +++ b/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php @@ -60,11 +60,11 @@ public function testUpdateRange($headerValue, $httpStatus, $endResult, $contentL $request->setBody('----'); $this->server->httpRequest = $request; - $this->server->httpResponse = new HTTP\ResponseMock(); + $this->server->httpResponse = new HTTP\Response(); $this->server->sapi = new HTTP\SapiMock(); $this->server->exec(); - self::assertEquals($httpStatus, $this->server->httpResponse->status, 'Incorrect http status received: '.$this->server->httpResponse->body); + self::assertEquals($httpStatus, $this->server->httpResponse->getStatus(), 'Incorrect http status received: '.$this->server->httpResponse->getBody()); if (!is_null($endResult)) { self::assertEquals($endResult, file_get_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/foobar.txt')); } diff --git a/tests/Sabre/DAV/ServerMKCOLTest.php b/tests/Sabre/DAV/ServerMKCOLTest.php index 9e9dfb88bc..7fe4ed163b 100644 --- a/tests/Sabre/DAV/ServerMKCOLTest.php +++ b/tests/Sabre/DAV/ServerMKCOLTest.php @@ -25,7 +25,7 @@ public function testMkcol() 'Content-Length' => ['0'], ], $this->response->getHeaders()); - self::assertEquals(201, $this->response->status); + self::assertEquals(201, $this->response->getStatus()); self::assertEquals('', $this->response->getBodyAsString()); self::assertTrue(is_dir($this->tempDir.'/testcol')); } @@ -50,7 +50,7 @@ public function testMKCOLUnknownBody() 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders()); - self::assertEquals(415, $this->response->status); + self::assertEquals(415, $this->response->getStatus()); } /** @@ -129,7 +129,7 @@ public function testMKCOLNoResourceType() 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders()); - self::assertEquals(400, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); + self::assertEquals(400, $this->response->getStatus(), 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -160,7 +160,7 @@ public function testMKCOLIncorrectResourceType() 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders()); - self::assertEquals(403, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); + self::assertEquals(403, $this->response->getStatus(), 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -191,7 +191,7 @@ public function testMKCOLSuccess() 'Content-Length' => ['0'], ], $this->response->getHeaders()); - self::assertEquals(201, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); + self::assertEquals(201, $this->response->getStatus(), 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -224,7 +224,7 @@ public function testMKCOLWhiteSpaceResourceType() 'Content-Length' => ['0'], ], $this->response->getHeaders()); - self::assertEquals(201, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); + self::assertEquals(201, $this->response->getStatus(), 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -248,7 +248,7 @@ public function testMKCOLNoParent() 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders()); - self::assertEquals(409, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); + self::assertEquals(409, $this->response->getStatus(), 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -272,7 +272,7 @@ public function testMKCOLParentIsNoCollection() 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders()); - self::assertEquals(409, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); + self::assertEquals(409, $this->response->getStatus(), 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -297,7 +297,7 @@ public function testMKCOLAlreadyExists() 'Allow' => ['OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, COPY, MOVE, REPORT'], ], $this->response->getHeaders()); - self::assertEquals(405, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); + self::assertEquals(405, $this->response->getStatus(), 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -324,7 +324,7 @@ public function testMKCOLAndProps() $this->server->exec(); $bodyAsString = $this->response->getBodyAsString(); - self::assertEquals(207, $this->response->status, 'Wrong statuscode received. Full response body: '.$bodyAsString); + self::assertEquals(207, $this->response->getStatus(), 'Wrong statuscode received. Full response body: '.$bodyAsString); self::assertEquals([ 'X-Sabre-Version' => [Version::VERSION], diff --git a/tests/Sabre/DAV/ServerPluginTest.php b/tests/Sabre/DAV/ServerPluginTest.php index d33c411587..6e7714e05b 100644 --- a/tests/Sabre/DAV/ServerPluginTest.php +++ b/tests/Sabre/DAV/ServerPluginTest.php @@ -56,7 +56,7 @@ public function testOptions() 'X-Sabre-Version' => [Version::VERSION], ], $this->response->getHeaders()); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); self::assertEquals('', $this->response->getBodyAsString()); self::assertEquals('OPTIONS', $this->testPlugin->beforeMethod); } diff --git a/tests/Sabre/DAV/ServerPreconditionsTest.php b/tests/Sabre/DAV/ServerPreconditionsTest.php index 1ae9d5c182..6cf1ac1608 100644 --- a/tests/Sabre/DAV/ServerPreconditionsTest.php +++ b/tests/Sabre/DAV/ServerPreconditionsTest.php @@ -131,7 +131,7 @@ 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(); + $server->httpResponse = new HTTP\Response(); self::assertFalse($server->checkPreconditions($httpRequest, $server->httpResponse)); self::assertEquals(304, $server->httpResponse->getStatus()); @@ -149,7 +149,7 @@ public function testNoneMatchCorrectEtagEnsureSapiSent() HTTP\SapiMock::$sent = 0; $httpRequest = new HTTP\Request('GET', '/foo', ['If-None-Match' => '"abc123"']); $server->httpRequest = $httpRequest; - $server->httpResponse = new HTTP\ResponseMock(); + $server->httpResponse = new HTTP\Response(); $server->exec(); @@ -169,10 +169,10 @@ public function testIfModifiedSinceUnModified() $httpRequest = new HTTP\Request('GET', '/foo', [ 'If-Modified-Since' => 'Sun, 06 Nov 1994 08:49:37 GMT', ]); - $server->httpResponse = new HTTP\ResponseMock(); + $server->httpResponse = new HTTP\Response(); self::assertFalse($server->checkPreconditions($httpRequest, $server->httpResponse)); - self::assertEquals(304, $server->httpResponse->status); + self::assertEquals(304, $server->httpResponse->getStatus()); self::assertEquals([ 'Last-Modified' => ['Sat, 06 Apr 1985 23:30:00 GMT'], ], $server->httpResponse->getHeaders()); @@ -186,7 +186,7 @@ public function testIfModifiedSinceModified() 'If-Modified-Since' => 'Tue, 06 Nov 1984 08:49:37 GMT', ]); - $httpResponse = new HTTP\ResponseMock(); + $httpResponse = new HTTP\Response(); self::assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); } @@ -197,7 +197,7 @@ public function testIfModifiedSinceInvalidDate() $httpRequest = new HTTP\Request('GET', '/foo', [ 'If-Modified-Since' => 'Your mother', ]); - $httpResponse = new HTTP\ResponseMock(); + $httpResponse = new HTTP\Response(); // Invalid dates must be ignored, so this should return true self::assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); @@ -210,7 +210,7 @@ public function testIfModifiedSinceInvalidDate2() $httpRequest = new HTTP\Request('GET', '/foo', [ 'If-Unmodified-Since' => 'Sun, 06 Nov 1994 08:49:37 EST', ]); - $httpResponse = new HTTP\ResponseMock(); + $httpResponse = new HTTP\Response(); self::assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); } @@ -233,7 +233,7 @@ public function testIfUnmodifiedSinceModified() $httpRequest = new HTTP\Request('GET', '/foo', [ 'If-Unmodified-Since' => 'Tue, 06 Nov 1984 08:49:37 GMT', ]); - $httpResponse = new HTTP\ResponseMock(); + $httpResponse = new HTTP\Response(); $server->checkPreconditions($httpRequest, $httpResponse); } @@ -244,7 +244,7 @@ public function testIfUnmodifiedSinceInvalidDate() $httpRequest = new HTTP\Request('GET', '/foo', [ 'If-Unmodified-Since' => 'Sun, 06 Nov 1984 08:49:37 CET', ]); - $httpResponse = new HTTP\ResponseMock(); + $httpResponse = new HTTP\Response(); self::assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); } } diff --git a/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php b/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php index c60e3899ba..123d6a0529 100644 --- a/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php +++ b/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php @@ -49,7 +49,7 @@ public function testPropFindEmptyBody() $this->sendRequest(''); $bodyAsString = $this->response->getBodyAsString(); - self::assertEquals(207, $this->response->status, 'Incorrect status received. Full response body: '.$bodyAsString); + self::assertEquals(207, $this->response->getStatus(), 'Incorrect status received. Full response body: '.$bodyAsString); self::assertEquals([ 'X-Sabre-Version' => [Version::VERSION], diff --git a/tests/Sabre/DAV/ServerPropsTest.php b/tests/Sabre/DAV/ServerPropsTest.php index 398f04f53c..90b70fe20e 100644 --- a/tests/Sabre/DAV/ServerPropsTest.php +++ b/tests/Sabre/DAV/ServerPropsTest.php @@ -44,7 +44,7 @@ private function sendRequest($body, $path = '/', $headers = ['Depth' => '0']) public function testPropFindEmptyBody() { $this->sendRequest(''); - self::assertEquals(207, $this->response->status); + self::assertEquals(207, $this->response->getStatus()); self::assertEquals([ 'X-Sabre-Version' => [Version::VERSION], @@ -73,7 +73,7 @@ public function testPropFindEmptyBodyDepth1Custom() }); $this->sendRequest('', '/', ['Depth' => 1]); - self::assertEquals(207, $this->response->status); + self::assertEquals(207, $this->response->getStatus()); self::assertEquals([ 'X-Sabre-Version' => [Version::VERSION], @@ -98,7 +98,7 @@ public function testPropFindEmptyBodyDepth1Custom() public function testPropFindEmptyBodyFile() { $this->sendRequest('', '/test2.txt', []); - self::assertEquals(207, $this->response->status); + self::assertEquals(207, $this->response->getStatus()); self::assertEquals([ 'X-Sabre-Version' => [Version::VERSION], diff --git a/tests/Sabre/DAV/ServerSimpleTest.php b/tests/Sabre/DAV/ServerSimpleTest.php index 8683e5c129..8b5da4d8fb 100644 --- a/tests/Sabre/DAV/ServerSimpleTest.php +++ b/tests/Sabre/DAV/ServerSimpleTest.php @@ -39,7 +39,7 @@ public function testOptions() 'X-Sabre-Version' => [Version::VERSION], ], $this->response->getHeaders()); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); self::assertEquals('', $this->response->getBodyAsString()); } @@ -59,7 +59,7 @@ public function testOptionsUnmapped() 'X-Sabre-Version' => [Version::VERSION], ], $this->response->getHeaders()); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); self::assertEquals('', $this->response->getBodyAsString()); } @@ -79,7 +79,7 @@ public function testNonExistantMethod() 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders()); - self::assertEquals(501, $this->response->status); + self::assertEquals(501, $this->response->getStatus()); } public function testBaseUri() @@ -106,8 +106,8 @@ public function testBaseUri() $this->response->getHeaders() ); - self::assertEquals(200, $this->response->status); - self::assertEquals('Test contents', stream_get_contents($this->response->body)); + self::assertEquals(200, $this->response->getStatus()); + self::assertEquals('Test contents', stream_get_contents($this->response->getBody())); } public function testBaseUriAddSlash() @@ -340,7 +340,7 @@ public function testTriggerException() 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders()); - self::assertEquals(500, $this->response->status); + self::assertEquals(500, $this->response->getStatus()); } public function exceptionTrigger($request, $response) @@ -367,7 +367,7 @@ public function testReportNotFound() $this->response->getHeaders() ); - self::assertEquals(415, $this->response->status, 'We got an incorrect status back. Full response body follows: '.$this->response->getBodyAsString()); + self::assertEquals(415, $this->response->getStatus(), 'We got an incorrect status back. Full response body follows: '.$this->response->getBodyAsString()); } public function testReportIntercepted() @@ -390,7 +390,7 @@ public function testReportIntercepted() $this->response->getHeaders() ); - self::assertEquals(418, $this->response->status, 'We got an incorrect status back. Full response body follows: '.$this->response->getBodyAsString()); + self::assertEquals(418, $this->response->getStatus(), 'We got an incorrect status back. Full response body follows: '.$this->response->getBodyAsString()); } public function reportHandler($reportName, $result, $path) diff --git a/tests/Sabre/DAV/Sharing/PluginTest.php b/tests/Sabre/DAV/Sharing/PluginTest.php index 9496943937..ee413a1cd3 100644 --- a/tests/Sabre/DAV/Sharing/PluginTest.php +++ b/tests/Sabre/DAV/Sharing/PluginTest.php @@ -24,7 +24,7 @@ public function setUpTree() public function testPostWithoutContentType() { $request = new \Sabre\HTTP\Request('POST', '/'); - $response = new \Sabre\HTTP\ResponseMock(); + $response = new \Sabre\HTTP\Response(); $this->sharingPlugin->httpPost($request, $response); self::assertTrue(true); diff --git a/tests/Sabre/DAV/Sync/PluginTest.php b/tests/Sabre/DAV/Sync/PluginTest.php index bfe0d157a6..10446ee120 100644 --- a/tests/Sabre/DAV/Sync/PluginTest.php +++ b/tests/Sabre/DAV/Sync/PluginTest.php @@ -90,7 +90,7 @@ public function testSyncInitialSyncCollection() $response = $this->request($request); - self::assertEquals(207, $response->status, 'Full response body:'.$response->getBodyAsString()); + self::assertEquals(207, $response->getStatus(), 'Full response body:'.$response->getBodyAsString()); $multiStatus = $this->server->xml->parse($response->getBodyAsString()); @@ -152,7 +152,7 @@ public function testSubsequentSyncSyncCollection() $response = $this->request($request); - self::assertEquals(207, $response->status, 'Full response body:'.$response->getBodyAsString()); + self::assertEquals(207, $response->getStatus(), 'Full response body:'.$response->getBodyAsString()); $multiStatus = $this->server->xml->parse($response->getBodyAsString()); @@ -211,7 +211,7 @@ public function testSubsequentSyncSyncCollectionLimit() $response = $this->request($request); - self::assertEquals(207, $response->status, 'Full response body:'.$response->getBodyAsString()); + self::assertEquals(207, $response->getStatus(), 'Full response body:'.$response->getBodyAsString()); $multiStatus = $this->server->xml->parse( $response->getBodyAsString() @@ -266,7 +266,7 @@ public function testSubsequentSyncSyncCollectionDepthFallBack() $response = $this->request($request); - self::assertEquals(207, $response->status, 'Full response body:'.$response->getBodyAsString()); + self::assertEquals(207, $response->getStatus(), 'Full response body:'.$response->getBodyAsString()); $multiStatus = $this->server->xml->parse( $response->getBodyAsString() @@ -323,7 +323,7 @@ public function testSyncNoSyncInfo() // The default state has no sync-token, so this report should not yet // be supported. - self::assertEquals(415, $response->status, 'Full response body:'.$response->getBodyAsString()); + self::assertEquals(415, $response->getStatus(), 'Full response body:'.$response->getBodyAsString()); } public function testSyncNoSyncCollection() @@ -351,7 +351,7 @@ public function testSyncNoSyncCollection() // The default state has no sync-token, so this report should not yet // be supported. - self::assertEquals(415, $response->status, 'Full response body:'.$response->getBodyAsString()); + self::assertEquals(415, $response->getStatus(), 'Full response body:'.$response->getBodyAsString()); } public function testSyncInvalidToken() @@ -380,7 +380,7 @@ public function testSyncInvalidToken() // The default state has no sync-token, so this report should not yet // be supported. - self::assertEquals(403, $response->status, 'Full response body:'.$response->getBodyAsString()); + self::assertEquals(403, $response->getStatus(), 'Full response body:'.$response->getBodyAsString()); } public function testSyncInvalidTokenNoPrefix() @@ -409,7 +409,7 @@ public function testSyncInvalidTokenNoPrefix() // The default state has no sync-token, so this report should not yet // be supported. - self::assertEquals(403, $response->status, 'Full response body:'.$response->getBodyAsString()); + self::assertEquals(403, $response->getStatus(), 'Full response body:'.$response->getBodyAsString()); } public function testSyncNoSyncToken() @@ -436,7 +436,7 @@ public function testSyncNoSyncToken() // The default state has no sync-token, so this report should not yet // be supported. - self::assertEquals(400, $response->status, 'Full response body:'.$response->getBodyAsString()); + self::assertEquals(400, $response->getStatus(), 'Full response body:'.$response->getBodyAsString()); } public function testSyncNoProp() @@ -462,7 +462,7 @@ public function testSyncNoProp() // The default state has no sync-token, so this report should not yet // be supported. - self::assertEquals(400, $response->status, 'Full response body:'.$response->getBodyAsString()); + self::assertEquals(400, $response->getStatus(), 'Full response body:'.$response->getBodyAsString()); } public function testIfConditions() @@ -478,7 +478,7 @@ public function testIfConditions() // If a 403 is thrown this works correctly. The file in questions // doesn't allow itself to be deleted. // If the If conditions failed, it would have been a 412 instead. - self::assertEquals(403, $response->status); + self::assertEquals(403, $response->getStatus()); } public function testIfConditionsNot() @@ -494,7 +494,7 @@ public function testIfConditionsNot() // If a 403 is thrown this works correctly. The file in questions // doesn't allow itself to be deleted. // If the If conditions failed, it would have been a 412 instead. - self::assertEquals(403, $response->status); + self::assertEquals(403, $response->getStatus()); } public function testIfConditionsNoSyncToken() @@ -507,6 +507,6 @@ public function testIfConditionsNoSyncToken() ]); $response = $this->request($request); - self::assertEquals(412, $response->status); + self::assertEquals(412, $response->getStatus()); } } diff --git a/tests/Sabre/DAV/TemporaryFileFilterTest.php b/tests/Sabre/DAV/TemporaryFileFilterTest.php index 5082a0f73f..efac22fba8 100644 --- a/tests/Sabre/DAV/TemporaryFileFilterTest.php +++ b/tests/Sabre/DAV/TemporaryFileFilterTest.php @@ -23,7 +23,7 @@ public function testPutNormal() $this->server->exec(); self::assertEquals('', $this->response->getBodyAsString()); - self::assertEquals(201, $this->response->status); + self::assertEquals(201, $this->response->getStatus()); self::assertEquals('0', $this->response->getHeader('Content-Length')); self::assertEquals('Testing new file', file_get_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/testput.txt')); @@ -38,7 +38,7 @@ public function testPutTemp() $this->server->exec(); self::assertEquals('', $this->response->getBodyAsString()); - self::assertEquals(201, $this->response->status); + self::assertEquals(201, $this->response->getStatus()); self::assertEquals([ 'X-Sabre-Temp' => ['true'], ], $this->response->getHeaders()); @@ -55,7 +55,7 @@ public function testPutTempIfNoneMatch() $this->server->exec(); self::assertEquals('', $this->response->getBodyAsString()); - self::assertEquals(201, $this->response->status); + self::assertEquals(201, $this->response->getStatus()); self::assertEquals([ 'X-Sabre-Temp' => ['true'], ], $this->response->getHeaders()); @@ -64,7 +64,7 @@ public function testPutTempIfNoneMatch() $this->server->exec(); - self::assertEquals(412, $this->response->status); + self::assertEquals(412, $this->response->getStatus()); self::assertEquals([ 'X-Sabre-Temp' => ['true'], 'Content-Type' => ['application/xml; charset=utf-8'], @@ -79,7 +79,7 @@ public function testPutGet() $this->server->exec(); self::assertEquals('', $this->response->getBodyAsString()); - self::assertEquals(201, $this->response->status); + self::assertEquals(201, $this->response->getStatus()); self::assertEquals([ 'X-Sabre-Temp' => ['true'], ], $this->response->getHeaders()); @@ -89,14 +89,14 @@ public function testPutGet() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); self::assertEquals([ 'X-Sabre-Temp' => ['true'], 'Content-Length' => [16], 'Content-Type' => ['application/octet-stream'], ], $this->response->getHeaders()); - self::assertEquals('Testing new file', stream_get_contents($this->response->body)); + self::assertEquals('Testing new file', stream_get_contents($this->response->getBody())); } public function testGetWithBrowserPlugin() @@ -107,7 +107,7 @@ public function testGetWithBrowserPlugin() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(200, $this->response->status); + self::assertEquals(200, $this->response->getStatus()); } public function testLockNonExistant() @@ -131,7 +131,7 @@ public function testLockNonExistant() $this->server->httpRequest = ($request); $this->server->exec(); - self::assertEquals(201, $this->response->status); + self::assertEquals(201, $this->response->getStatus()); self::assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); self::assertTrue(1 === preg_match('/^$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); self::assertEquals('true', $this->response->getHeader('X-Sabre-Temp')); @@ -148,7 +148,7 @@ public function testPutDelete() $this->server->exec(); self::assertEquals('', $this->response->getBodyAsString()); - self::assertEquals(201, $this->response->status); + self::assertEquals(201, $this->response->getStatus()); self::assertEquals([ 'X-Sabre-Temp' => ['true'], ], $this->response->getHeaders()); @@ -157,7 +157,7 @@ public function testPutDelete() $this->server->httpRequest = $request; $this->server->exec(); - self::assertEquals(204, $this->response->status, "Incorrect status code received. Full body:\n".$this->response->getBodyAsString()); + self::assertEquals(204, $this->response->getStatus(), "Incorrect status code received. Full body:\n".$this->response->getBodyAsString()); self::assertEquals([ 'X-Sabre-Temp' => ['true'], ], $this->response->getHeaders()); @@ -174,7 +174,7 @@ public function testPutPropfind() $bodyAsString = $this->response->getBodyAsString(); self::assertEquals('', $bodyAsString); - self::assertEquals(201, $this->response->status); + self::assertEquals(201, $this->response->getStatus()); self::assertEquals([ 'X-Sabre-Temp' => ['true'], ], $this->response->getHeaders()); @@ -185,7 +185,7 @@ public function testPutPropfind() $this->server->exec(); $bodyAsString = $this->response->getBodyAsString(); - self::assertEquals(207, $this->response->status, 'Incorrect status code returned. Body: '.$bodyAsString); + self::assertEquals(207, $this->response->getStatus(), 'Incorrect status code returned. Body: '.$bodyAsString); self::assertEquals([ 'X-Sabre-Temp' => ['true'], 'Content-Type' => ['application/xml; charset=utf-8'], diff --git a/tests/Sabre/DAV/Xml/Property/SupportedReportSetTest.php b/tests/Sabre/DAV/Xml/Property/SupportedReportSetTest.php index 113ab4e7d8..3d7f223e22 100644 --- a/tests/Sabre/DAV/Xml/Property/SupportedReportSetTest.php +++ b/tests/Sabre/DAV/Xml/Property/SupportedReportSetTest.php @@ -36,7 +36,7 @@ public function testNoReports() $this->sendPROPFIND($xml); $bodyAsString = $this->response->getBodyAsString(); - self::assertEquals(207, $this->response->status, 'We expected a multi-status response. Full response body: '.$bodyAsString); + self::assertEquals(207, $this->response->getStatus(), 'We expected a multi-status response. Full response body: '.$bodyAsString); $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $bodyAsString); $xml = simplexml_load_string($body); @@ -77,7 +77,7 @@ public function testCustomReport() $this->sendPROPFIND($xml); $bodyAsString = $this->response->getBodyAsString(); - self::assertEquals(207, $this->response->status, 'We expected a multi-status response. Full response body: '.$bodyAsString); + self::assertEquals(207, $this->response->getStatus(), 'We expected a multi-status response. Full response body: '.$bodyAsString); $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $bodyAsString); $xml = simplexml_load_string($body); diff --git a/tests/Sabre/DAVACL/ExpandPropertiesTest.php b/tests/Sabre/DAVACL/ExpandPropertiesTest.php index 7eb9b3c721..1d67b1f0ce 100644 --- a/tests/Sabre/DAVACL/ExpandPropertiesTest.php +++ b/tests/Sabre/DAVACL/ExpandPropertiesTest.php @@ -31,7 +31,7 @@ public function getServer() $fakeServer = new DAV\Server($tree); $fakeServer->sapi = new HTTP\SapiMock(); $fakeServer->debugExceptions = true; - $fakeServer->httpResponse = new HTTP\ResponseMock(); + $fakeServer->httpResponse = new HTTP\Response(); $plugin = new Plugin(); $plugin->allowUnauthenticatedAccess = false; // Anyone can do anything @@ -73,7 +73,7 @@ public function testSimple() $server->exec(); - self::assertEquals(207, $server->httpResponse->status, 'Incorrect status code received. Full body: '.$server->httpResponse->getBodyAsString()); + self::assertEquals(207, $server->httpResponse->getStatus(), 'Incorrect status code received. Full body: '.$server->httpResponse->getBodyAsString()); self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], @@ -134,7 +134,7 @@ public function testExpand() $server->exec(); - self::assertEquals(207, $server->httpResponse->status, 'Incorrect response status received. Full response body: '.$server->httpResponse->getBodyAsString()); + self::assertEquals(207, $server->httpResponse->getStatus(), 'Incorrect response status received. Full response body: '.$server->httpResponse->getBodyAsString()); self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], @@ -197,7 +197,7 @@ public function testExpandHrefList() $server->exec(); - self::assertEquals(207, $server->httpResponse->status); + self::assertEquals(207, $server->httpResponse->getStatus()); self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], @@ -263,7 +263,7 @@ public function testExpandDeep() $server->exec(); - self::assertEquals(207, $server->httpResponse->status); + self::assertEquals(207, $server->httpResponse->getStatus()); self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], diff --git a/tests/Sabre/DAVACL/PluginAdminTest.php b/tests/Sabre/DAVACL/PluginAdminTest.php index 41b2502d09..4be1a4200a 100644 --- a/tests/Sabre/DAVACL/PluginAdminTest.php +++ b/tests/Sabre/DAVACL/PluginAdminTest.php @@ -37,14 +37,14 @@ public function testNoAdminAccess() 'REQUEST_URI' => '/adminonly', ]); - $response = new HTTP\ResponseMock(); + $response = new HTTP\Response(); $this->server->httpRequest = $request; $this->server->httpResponse = $response; $this->server->exec(); - self::assertEquals(403, $response->status); + self::assertEquals(403, $response->getStatus()); } /** @@ -64,13 +64,13 @@ public function testAdminAccess() 'REQUEST_URI' => '/adminonly', ]); - $response = new HTTP\ResponseMock(); + $response = new HTTP\Response(); $this->server->httpRequest = $request; $this->server->httpResponse = $response; $this->server->exec(); - self::assertEquals(200, $response->status); + self::assertEquals(200, $response->getStatus()); } } diff --git a/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php b/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php index ead33fd637..5875eb38ee 100644 --- a/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php +++ b/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php @@ -19,10 +19,9 @@ public function getServer() $fakeServer = new DAV\Server($dir); $fakeServer->sapi = new HTTP\SapiMock(); - $fakeServer->httpResponse = new HTTP\ResponseMock(); + $fakeServer->httpResponse = new HTTP\Response(); $fakeServer->debugExceptions = true; $plugin = new MockPlugin(); - $plugin->allowAccessToNodesWithoutACL = true; $plugin->allowUnauthenticatedAccess = false; self::assertTrue($plugin instanceof Plugin); @@ -139,7 +138,7 @@ public function testCorrect() $server->exec(); $bodyAsString = $server->httpResponse->getBodyAsString(); - self::assertEquals(207, $server->httpResponse->status, $bodyAsString); + self::assertEquals(207, $server->httpResponse->getStatus(), $bodyAsString); self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], @@ -211,7 +210,7 @@ public function testAND() $server->exec(); $bodyAsString = $server->httpResponse->getBodyAsString(); - self::assertEquals(207, $server->httpResponse->status, $bodyAsString); + self::assertEquals(207, $server->httpResponse->getStatus(), $bodyAsString); self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], @@ -283,7 +282,7 @@ public function testOR() $server->exec(); $bodyAsString = $server->httpResponse->getBodyAsString(); - self::assertEquals(207, $server->httpResponse->status, $bodyAsString); + self::assertEquals(207, $server->httpResponse->getStatus(), $bodyAsString); self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], @@ -348,7 +347,7 @@ public function testWrongUri() $server->exec(); $bodyAsString = $server->httpResponse->getBodyAsString(); - self::assertEquals(207, $server->httpResponse->status, $bodyAsString); + self::assertEquals(207, $server->httpResponse->getStatus(), $bodyAsString); self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], diff --git a/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php b/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php index 78308bb9da..4a37f4a137 100644 --- a/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php +++ b/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php @@ -19,7 +19,7 @@ public function getServer() $fakeServer = new DAV\Server($dir); $fakeServer->sapi = new HTTP\SapiMock(); - $fakeServer->httpResponse = new HTTP\ResponseMock(); + $fakeServer->httpResponse = new HTTP\Response(); $plugin = new Plugin(); $plugin->allowUnauthenticatedAccess = false; self::assertTrue($plugin instanceof Plugin); @@ -48,7 +48,7 @@ public function testDepth1() $server->exec(); - self::assertEquals(400, $server->httpResponse->status); + self::assertEquals(400, $server->httpResponse->getStatus()); self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], @@ -74,7 +74,7 @@ public function testDepthIncorrectXML() $server->exec(); - self::assertEquals(400, $server->httpResponse->status, $server->httpResponse->getBodyAsString()); + self::assertEquals(400, $server->httpResponse->getStatus(), $server->httpResponse->getBodyAsString()); self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], @@ -101,7 +101,7 @@ public function testCorrect() $server->exec(); $bodyAsString = $server->httpResponse->getBodyAsString(); - self::assertEquals(200, $server->httpResponse->status, $bodyAsString); + self::assertEquals(200, $server->httpResponse->getStatus(), $bodyAsString); self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], diff --git a/tests/Sabre/HTTP/ResponseMock.php b/tests/Sabre/HTTP/ResponseMock.php deleted file mode 100644 index 0d968e178f..0000000000 --- a/tests/Sabre/HTTP/ResponseMock.php +++ /dev/null @@ -1,23 +0,0 @@ -