diff options
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php')
-rw-r--r-- | vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php deleted file mode 100644 index 048b9f249..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL; - -use Sabre\DAV; -use Sabre\HTTP; - -class PluginAdminTest extends \PHPUnit\Framework\TestCase -{ - public $server; - - public function setup(): void - { - $principalBackend = new PrincipalBackend\Mock(); - - $tree = [ - new MockACLNode('adminonly', []), - new PrincipalCollection($principalBackend), - ]; - - $this->server = new DAV\Server($tree); - $this->server->sapi = new HTTP\SapiMock(); - $plugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock()); - $this->server->addPlugin($plugin); - } - - public function testNoAdminAccess() - { - $plugin = new Plugin(); - $this->server->addPlugin($plugin); - - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'OPTIONS', - 'HTTP_DEPTH' => 1, - 'REQUEST_URI' => '/adminonly', - ]); - - $response = new HTTP\ResponseMock(); - - $this->server->httpRequest = $request; - $this->server->httpResponse = $response; - - $this->server->exec(); - - $this->assertEquals(403, $response->status); - } - - /** - * @depends testNoAdminAccess - */ - public function testAdminAccess() - { - $plugin = new Plugin(); - $plugin->adminPrincipals = [ - 'principals/admin', - ]; - $this->server->addPlugin($plugin); - - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'OPTIONS', - 'HTTP_DEPTH' => 1, - 'REQUEST_URI' => '/adminonly', - ]); - - $response = new HTTP\ResponseMock(); - - $this->server->httpRequest = $request; - $this->server->httpResponse = $response; - - $this->server->exec(); - - $this->assertEquals(200, $response->status); - } -} |