aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php')
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php131
1 files changed, 59 insertions, 72 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php
index ceae9aed0..3c3aaf6c9 100644
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php
@@ -1,19 +1,21 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\DAVACL;
use Sabre\DAV;
-class BlockAccessTest extends \PHPUnit_Framework_TestCase {
-
+class BlockAccessTest extends \PHPUnit\Framework\TestCase
+{
/**
* @var DAV\Server
*/
protected $server;
protected $plugin;
- function setUp() {
-
+ public function setUp()
+ {
$nodes = [
new DAV\SimpleCollection('testdir'),
];
@@ -28,151 +30,138 @@ class BlockAccessTest extends \PHPUnit_Framework_TestCase {
);
// Login
$this->server->getPlugin('auth')->beforeMethod(
- new \Sabre\HTTP\Request(),
+ new \Sabre\HTTP\Request('GET', '/'),
new \Sabre\HTTP\Response()
);
$this->server->addPlugin($this->plugin);
-
}
/**
- * @expectedException Sabre\DAVACL\Exception\NeedPrivileges
+ * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges
*/
- function testGet() {
-
+ public function testGet()
+ {
$this->server->httpRequest->setMethod('GET');
$this->server->httpRequest->setUrl('/testdir');
- $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]);
-
+ $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]);
}
- function testGetDoesntExist() {
-
+ public function testGetDoesntExist()
+ {
$this->server->httpRequest->setMethod('GET');
$this->server->httpRequest->setUrl('/foo');
- $r = $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]);
+ $r = $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]);
$this->assertTrue($r);
-
}
/**
- * @expectedException Sabre\DAVACL\Exception\NeedPrivileges
+ * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges
*/
- function testHEAD() {
-
+ public function testHEAD()
+ {
$this->server->httpRequest->setMethod('HEAD');
$this->server->httpRequest->setUrl('/testdir');
- $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]);
-
+ $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]);
}
/**
- * @expectedException Sabre\DAVACL\Exception\NeedPrivileges
+ * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges
*/
- function testOPTIONS() {
-
+ public function testOPTIONS()
+ {
$this->server->httpRequest->setMethod('OPTIONS');
$this->server->httpRequest->setUrl('/testdir');
- $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]);
-
+ $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]);
}
/**
- * @expectedException Sabre\DAVACL\Exception\NeedPrivileges
+ * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges
*/
- function testPUT() {
-
+ public function testPUT()
+ {
$this->server->httpRequest->setMethod('PUT');
$this->server->httpRequest->setUrl('/testdir');
- $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]);
-
+ $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]);
}
/**
- * @expectedException Sabre\DAVACL\Exception\NeedPrivileges
+ * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges
*/
- function testPROPPATCH() {
-
+ public function testPROPPATCH()
+ {
$this->server->httpRequest->setMethod('PROPPATCH');
$this->server->httpRequest->setUrl('/testdir');
- $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]);
-
+ $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]);
}
/**
- * @expectedException Sabre\DAVACL\Exception\NeedPrivileges
+ * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges
*/
- function testCOPY() {
-
+ public function testCOPY()
+ {
$this->server->httpRequest->setMethod('COPY');
$this->server->httpRequest->setUrl('/testdir');
- $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]);
-
+ $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]);
}
/**
- * @expectedException Sabre\DAVACL\Exception\NeedPrivileges
+ * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges
*/
- function testMOVE() {
-
+ public function testMOVE()
+ {
$this->server->httpRequest->setMethod('MOVE');
$this->server->httpRequest->setUrl('/testdir');
- $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]);
-
+ $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]);
}
/**
- * @expectedException Sabre\DAVACL\Exception\NeedPrivileges
+ * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges
*/
- function testACL() {
-
+ public function testACL()
+ {
$this->server->httpRequest->setMethod('ACL');
$this->server->httpRequest->setUrl('/testdir');
- $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]);
-
+ $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]);
}
/**
- * @expectedException Sabre\DAVACL\Exception\NeedPrivileges
+ * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges
*/
- function testLOCK() {
-
+ public function testLOCK()
+ {
$this->server->httpRequest->setMethod('LOCK');
$this->server->httpRequest->setUrl('/testdir');
- $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]);
-
+ $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]);
}
/**
- * @expectedException Sabre\DAVACL\Exception\NeedPrivileges
+ * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges
*/
- function testBeforeBind() {
-
+ public function testBeforeBind()
+ {
$this->server->emit('beforeBind', ['testdir/file']);
-
}
/**
- * @expectedException Sabre\DAVACL\Exception\NeedPrivileges
+ * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges
*/
- function testBeforeUnbind() {
-
+ public function testBeforeUnbind()
+ {
$this->server->emit('beforeUnbind', ['testdir']);
-
}
- function testPropFind() {
-
+ public function testPropFind()
+ {
$propFind = new DAV\PropFind('testdir', [
'{DAV:}displayname',
'{DAV:}getcontentlength',
@@ -187,19 +176,18 @@ class BlockAccessTest extends \PHPUnit_Framework_TestCase {
200 => [],
404 => [],
403 => [
- '{DAV:}displayname' => null,
+ '{DAV:}displayname' => null,
'{DAV:}getcontentlength' => null,
- '{DAV:}bar' => null,
- '{DAV:}owner' => null,
+ '{DAV:}bar' => null,
+ '{DAV:}owner' => null,
],
];
$this->assertEquals($expected, $propFind->getResultForMultiStatus());
-
}
- function testBeforeGetPropertiesNoListing() {
-
+ public function testBeforeGetPropertiesNoListing()
+ {
$this->plugin->hideNodesFromListings = true;
$propFind = new DAV\PropFind('testdir', [
'{DAV:}displayname',
@@ -210,6 +198,5 @@ class BlockAccessTest extends \PHPUnit_Framework_TestCase {
$r = $this->server->emit('propFind', [$propFind, new DAV\SimpleCollection('testdir')]);
$this->assertFalse($r);
-
}
}