diff options
author | Mario <mario@mariovavti.com> | 2021-03-08 09:31:23 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-03-08 09:31:23 +0000 |
commit | 951e9c8c4f39dd8577834d5bc501c05d80722de9 (patch) | |
tree | 6a42c6a229c7b2b3e13bc5af77a733d054242695 /vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php | |
parent | f94b046333c57acde493ee5dc2511acc6baca701 (diff) | |
parent | 89415e17313578eb115c441480b6e0ddfa90afef (diff) | |
download | volse-hubzilla-5.4.tar.gz volse-hubzilla-5.4.tar.bz2 volse-hubzilla-5.4.zip |
Merge branch '5.4RC'5.4
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php')
-rw-r--r-- | vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php | 127 |
1 files changed, 0 insertions, 127 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php deleted file mode 100644 index f4810d524..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php +++ /dev/null @@ -1,127 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Auth; - -use Sabre\DAV; -use Sabre\HTTP; - -class PluginTest extends \PHPUnit\Framework\TestCase -{ - public function testInit() - { - $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); - $plugin = new Plugin(new Backend\Mock()); - $this->assertTrue($plugin instanceof Plugin); - $fakeServer->addPlugin($plugin); - $this->assertEquals($plugin, $fakeServer->getPlugin('auth')); - $this->assertIsArray($plugin->getPluginInfo()); - } - - /** - * @depends testInit - */ - public function testAuthenticate() - { - $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); - $plugin = new Plugin(new Backend\Mock()); - $fakeServer->addPlugin($plugin); - $this->assertTrue( - $fakeServer->emit('beforeMethod:GET', [new HTTP\Request('GET', '/'), new HTTP\Response()]) - ); - } - - /** - * @depends testInit - */ - public function testAuthenticateFail() - { - $this->expectException('Sabre\DAV\Exception\NotAuthenticated'); - $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); - $backend = new Backend\Mock(); - $backend->fail = true; - - $plugin = new Plugin($backend); - $fakeServer->addPlugin($plugin); - $fakeServer->emit('beforeMethod:GET', [new HTTP\Request('GET', '/'), new HTTP\Response()]); - } - - /** - * @depends testAuthenticateFail - */ - public function testAuthenticateFailDontAutoRequire() - { - $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); - $backend = new Backend\Mock(); - $backend->fail = true; - - $plugin = new Plugin($backend); - $plugin->autoRequireLogin = false; - $fakeServer->addPlugin($plugin); - $this->assertTrue( - $fakeServer->emit('beforeMethod:GET', [new HTTP\Request('GET', '/'), new HTTP\Response()]) - ); - $this->assertEquals(1, count($plugin->getLoginFailedReasons())); - } - - /** - * @depends testAuthenticate - */ - public function testMultipleBackend() - { - $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); - $backend1 = new Backend\Mock(); - $backend2 = new Backend\Mock(); - $backend2->fail = true; - - $plugin = new Plugin(); - $plugin->addBackend($backend1); - $plugin->addBackend($backend2); - - $fakeServer->addPlugin($plugin); - $fakeServer->emit('beforeMethod:GET', [new HTTP\Request('GET', '/'), new HTTP\Response()]); - - $this->assertEquals('principals/admin', $plugin->getCurrentPrincipal()); - } - - /** - * @depends testInit - */ - public function testNoAuthBackend() - { - $this->expectException('Sabre\DAV\Exception'); - $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); - - $plugin = new Plugin(); - $fakeServer->addPlugin($plugin); - $fakeServer->emit('beforeMethod:GET', [new HTTP\Request('GET', '/'), new HTTP\Response()]); - } - - /** - * @depends testInit - */ - public function testInvalidCheckResponse() - { - $this->expectException('Sabre\DAV\Exception'); - $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); - $backend = new Backend\Mock(); - $backend->invalidCheckResponse = true; - - $plugin = new Plugin($backend); - $fakeServer->addPlugin($plugin); - $fakeServer->emit('beforeMethod:GET', [new HTTP\Request('GET', '/'), new HTTP\Response()]); - } - - /** - * @depends testAuthenticate - */ - public function testGetCurrentPrincipal() - { - $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); - $plugin = new Plugin(new Backend\Mock()); - $fakeServer->addPlugin($plugin); - $fakeServer->emit('beforeMethod:GET', [new HTTP\Request('GET', '/'), new HTTP\Response()]); - $this->assertEquals('principals/admin', $plugin->getCurrentPrincipal()); - } -} |