diff options
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAVACL')
13 files changed, 87 insertions, 30 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/ACLMethodTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/ACLMethodTest.php index 715559df3..3627991bf 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/ACLMethodTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/ACLMethodTest.php @@ -9,9 +9,11 @@ use Sabre\HTTP; class ACLMethodTest extends \PHPUnit\Framework\TestCase { + /** + * @expectedException \Sabre\DAV\Exception\BadRequest + */ public function testCallback() { - $this->expectException('Sabre\DAV\Exception\BadRequest'); $acl = new Plugin(); $server = new DAV\Server(); $server->addPlugin(new DAV\Auth\Plugin()); @@ -21,11 +23,11 @@ class ACLMethodTest extends \PHPUnit\Framework\TestCase } /** - /** + /** + * @expectedException \Sabre\DAV\Exception\MethodNotAllowed */ public function testNotSupportedByNode() { - $this->expectException('Sabre\DAV\Exception\MethodNotAllowed'); $tree = [ new DAV\SimpleCollection('test'), ]; @@ -62,9 +64,11 @@ class ACLMethodTest extends \PHPUnit\Framework\TestCase $this->assertFalse($acl->httpACL($server->httpRequest, $server->httpResponse)); } + /** + * @expectedException \Sabre\DAVACL\Exception\NotRecognizedPrincipal + */ public function testUnrecognizedPrincipal() { - $this->expectException('Sabre\DAVACL\Exception\NotRecognizedPrincipal'); $tree = [ new MockACLNode('test', []), ]; @@ -85,9 +89,11 @@ class ACLMethodTest extends \PHPUnit\Framework\TestCase $acl->httpACL($server->httpRequest, $server->httpResponse); } + /** + * @expectedException \Sabre\DAVACL\Exception\NotRecognizedPrincipal + */ public function testUnrecognizedPrincipal2() { - $this->expectException('Sabre\DAVACL\Exception\NotRecognizedPrincipal'); $tree = [ new MockACLNode('test', []), new DAV\SimpleCollection('principals', [ @@ -111,9 +117,11 @@ class ACLMethodTest extends \PHPUnit\Framework\TestCase $acl->httpACL($server->httpRequest, $server->httpResponse); } + /** + * @expectedException \Sabre\DAVACL\Exception\NotSupportedPrivilege + */ public function testUnknownPrivilege() { - $this->expectException('Sabre\DAVACL\Exception\NotSupportedPrivilege'); $tree = [ new MockACLNode('test', []), ]; @@ -134,9 +142,11 @@ class ACLMethodTest extends \PHPUnit\Framework\TestCase $acl->httpACL($server->httpRequest, $server->httpResponse); } + /** + * @expectedException \Sabre\DAVACL\Exception\NoAbstract + */ public function testAbstractPrivilege() { - $this->expectException('Sabre\DAVACL\Exception\NoAbstract'); $tree = [ new MockACLNode('test', []), ]; @@ -160,9 +170,11 @@ class ACLMethodTest extends \PHPUnit\Framework\TestCase $acl->httpACL($server->httpRequest, $server->httpResponse); } + /** + * @expectedException \Sabre\DAVACL\Exception\AceConflict + */ public function testUpdateProtectedPrivilege() { - $this->expectException('Sabre\DAVACL\Exception\AceConflict'); $oldACL = [ [ 'principal' => 'principals/notfound', @@ -191,9 +203,11 @@ class ACLMethodTest extends \PHPUnit\Framework\TestCase $acl->httpACL($server->httpRequest, $server->httpResponse); } + /** + * @expectedException \Sabre\DAVACL\Exception\AceConflict + */ public function testUpdateProtectedPrivilege2() { - $this->expectException('Sabre\DAVACL\Exception\AceConflict'); $oldACL = [ [ 'principal' => 'principals/notfound', @@ -222,9 +236,11 @@ class ACLMethodTest extends \PHPUnit\Framework\TestCase $acl->httpACL($server->httpRequest, $server->httpResponse); } + /** + * @expectedException \Sabre\DAVACL\Exception\AceConflict + */ public function testUpdateProtectedPrivilege3() { - $this->expectException('Sabre\DAVACL\Exception\AceConflict'); $oldACL = [ [ 'principal' => 'principals/notfound', diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/AllowAccessTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/AllowAccessTest.php index 04dd29c04..724abc685 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/AllowAccessTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/AllowAccessTest.php @@ -13,7 +13,7 @@ class AllowAccessTest extends \PHPUnit\Framework\TestCase */ protected $server; - public function setup(): void + public function setUp() { $nodes = [ new DAV\Mock\Collection('testdir', [ diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php index 566167ef0..3c3aaf6c9 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php @@ -14,7 +14,7 @@ class BlockAccessTest extends \PHPUnit\Framework\TestCase protected $server; protected $plugin; - public function setup(): void + public function setUp() { $nodes = [ new DAV\SimpleCollection('testdir'), @@ -36,9 +36,11 @@ class BlockAccessTest extends \PHPUnit\Framework\TestCase $this->server->addPlugin($this->plugin); } + /** + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges + */ public function testGet() { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->httpRequest->setMethod('GET'); $this->server->httpRequest->setUrl('/testdir'); @@ -54,87 +56,107 @@ class BlockAccessTest extends \PHPUnit\Framework\TestCase $this->assertTrue($r); } + /** + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges + */ public function testHEAD() { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->httpRequest->setMethod('HEAD'); $this->server->httpRequest->setUrl('/testdir'); $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } + /** + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges + */ public function testOPTIONS() { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->httpRequest->setMethod('OPTIONS'); $this->server->httpRequest->setUrl('/testdir'); $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } + /** + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges + */ public function testPUT() { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->httpRequest->setMethod('PUT'); $this->server->httpRequest->setUrl('/testdir'); $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } + /** + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges + */ public function testPROPPATCH() { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->httpRequest->setMethod('PROPPATCH'); $this->server->httpRequest->setUrl('/testdir'); $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } + /** + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges + */ public function testCOPY() { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->httpRequest->setMethod('COPY'); $this->server->httpRequest->setUrl('/testdir'); $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } + /** + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges + */ public function testMOVE() { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->httpRequest->setMethod('MOVE'); $this->server->httpRequest->setUrl('/testdir'); $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } + /** + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges + */ public function testACL() { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->httpRequest->setMethod('ACL'); $this->server->httpRequest->setUrl('/testdir'); $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } + /** + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges + */ public function testLOCK() { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->httpRequest->setMethod('LOCK'); $this->server->httpRequest->setUrl('/testdir'); $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } + /** + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges + */ public function testBeforeBind() { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->emit('beforeBind', ['testdir/file']); } + /** + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges + */ public function testBeforeUnbind() { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); $this->server->emit('beforeUnbind', ['testdir']); } diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php index 8afe6d30f..d0b67cfae 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php @@ -7,6 +7,8 @@ namespace Sabre\DAVACL; use Sabre\DAV; use Sabre\HTTP; +require_once 'Sabre/HTTP/ResponseMock.php'; + class ExpandPropertiesTest extends \PHPUnit\Framework\TestCase { public function getServer() diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php index 048b9f249..9ab16df74 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php @@ -7,11 +7,14 @@ namespace Sabre\DAVACL; use Sabre\DAV; use Sabre\HTTP; +require_once 'Sabre/DAVACL/MockACLNode.php'; +require_once 'Sabre/HTTP/ResponseMock.php'; + class PluginAdminTest extends \PHPUnit\Framework\TestCase { public $server; - public function setup(): void + public function setUp() { $principalBackend = new PrincipalBackend\Mock(); diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php index e6796e014..169629a03 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php @@ -72,9 +72,11 @@ class PluginUpdatePropertiesTest extends \PHPUnit\Framework\TestCase $this->assertEquals(['bar', 'baz'], $tree[0]->getGroupMemberSet()); } + /** + * @expectedException \Sabre\DAV\Exception + */ public function testSetBadValue() { - $this->expectException('Sabre\DAV\Exception'); $tree = [ new MockPrincipal('foo', 'foo'), ]; diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php index b18ab9488..95775d8fe 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php @@ -10,7 +10,7 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase { use DAV\DbTestHelperTrait; - public function setup(): void + public function setUp() { $this->dropTables(['principals', 'groupmembers']); $this->createSchema('principals'); diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/Mock.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/Mock.php index 5f0434579..551a77900 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/Mock.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/Mock.php @@ -126,7 +126,8 @@ class Mock extends AbstractBackend * * Read the PropPatch documentation for more info and examples. * - * @param string $path + * @param string $path + * @param \Sabre\DAV\PropPatch $propPatch */ public function updatePrincipal($path, \Sabre\DAV\PropPatch $propPatch) { diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalCollectionTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalCollectionTest.php index 2777281a8..68aebe2ae 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalCollectionTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalCollectionTest.php @@ -33,10 +33,10 @@ class PrincipalCollectionTest extends \PHPUnit\Framework\TestCase /** * @depends testBasic + * @expectedException \Sabre\DAV\Exception\MethodNotAllowed */ public function testGetChildrenDisable() { - $this->expectException('Sabre\DAV\Exception\MethodNotAllowed'); $backend = new PrincipalBackend\Mock(); $pc = new PrincipalCollection($backend); $pc->disableListing = true; diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php index 6883f25b4..55c64721e 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php @@ -7,6 +7,8 @@ namespace Sabre\DAVACL; use Sabre\DAV; use Sabre\HTTP; +require_once 'Sabre/HTTP/ResponseMock.php'; + class PrincipalPropertySearchTest extends \PHPUnit\Framework\TestCase { public function getServer() diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php index ec834fe1a..b44b46fc5 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php @@ -7,6 +7,8 @@ namespace Sabre\DAVACL; use Sabre\DAV; use Sabre\HTTP; +require_once 'Sabre/HTTP/ResponseMock.php'; + class PrincipalSearchPropertySetTest extends \PHPUnit\Framework\TestCase { public function getServer() diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalTest.php index 7e1656a15..a4821da5a 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalTest.php @@ -15,9 +15,11 @@ class PrincipalTest extends \PHPUnit\Framework\TestCase $this->assertTrue($principal instanceof Principal); } + /** + * @expectedException \Sabre\DAV\Exception + */ public function testConstructNoUri() { - $this->expectException('Sabre\DAV\Exception'); $principalBackend = new PrincipalBackend\Mock(); $principal = new Principal($principalBackend, []); } @@ -175,9 +177,11 @@ class PrincipalTest extends \PHPUnit\Framework\TestCase ], $principal->getACL()); } + /** + * @expectedException \Sabre\DAV\Exception\Forbidden + */ public function testSetACl() { - $this->expectException('Sabre\DAV\Exception\Forbidden'); $principalBackend = new PrincipalBackend\Mock(); $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); $principal->setACL([]); diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php index effa15838..a1e9ee36c 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php @@ -7,6 +7,9 @@ namespace Sabre\DAVACL; use Sabre\DAV; use Sabre\HTTP; +require_once 'Sabre/DAVACL/MockPrincipal.php'; +require_once 'Sabre/DAVACL/MockACLNode.php'; + class SimplePluginTest extends \PHPUnit\Framework\TestCase { public function testValues() |