diff options
Diffstat (limited to 'apps/dav/tests/unit/DAV')
-rw-r--r-- | apps/dav/tests/unit/DAV/AnonymousOptionsTest.php | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php b/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php index a0abac0712a..a61c8e1e550 100644 --- a/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php +++ b/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php @@ -33,7 +33,7 @@ use Sabre\HTTP\Sapi; use Test\TestCase; class AnonymousOptionsTest extends TestCase { - private function sendRequest($method, $path) { + private function sendRequest($method, $path, $userAgent = '') { $server = new Server(); $server->addPlugin(new AnonymousOptionsPlugin()); $server->addPlugin(new Plugin(new BasicCallBack(function() { @@ -42,6 +42,7 @@ class AnonymousOptionsTest extends TestCase { $server->httpRequest->setMethod($method); $server->httpRequest->setUrl($path); + $server->httpRequest->setHeader('User-Agent', $userAgent); $server->sapi = new SapiMock(); $server->exec(); @@ -63,7 +64,19 @@ class AnonymousOptionsTest extends TestCase { public function testAnonymousOptionsNonRootSubDir() { $response = $this->sendRequest('OPTIONS', 'foo/bar'); - $this->assertEquals(401, $response->getStatus()); + $this->assertEquals(200, $response->getStatus()); + } + + public function testAnonymousHead() { + $response = $this->sendRequest('HEAD', '', 'Microsoft Office does strange things'); + + $this->assertEquals(200, $response->getStatus()); + } + + public function testAnonymousHeadNoOffice() { + $response = $this->sendRequest('HEAD', ''); + + $this->assertEquals(401, $response->getStatus(), 'curl'); } } |