aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/tests/Sabre/DAVACL
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-05-10 17:26:44 -0700
committerredmatrix <git@macgirvin.com>2016-05-10 17:26:44 -0700
commit0b02a6d123b2014705998c94ddf3d460948d3eac (patch)
tree78ff2cab9944a4f5ab3f80ec93cbe1120de90bb2 /vendor/sabre/dav/tests/Sabre/DAVACL
parent40b5b6e9d2da7ab65c8b4d38cdceac83a4d78deb (diff)
downloadvolse-hubzilla-0b02a6d123b2014705998c94ddf3d460948d3eac.tar.gz
volse-hubzilla-0b02a6d123b2014705998c94ddf3d460948d3eac.tar.bz2
volse-hubzilla-0b02a6d123b2014705998c94ddf3d460948d3eac.zip
initial sabre upgrade (needs lots of work - to wit: authentication, redo the browser interface, and rework event export/import)
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAVACL')
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/ACLMethodTest.php55
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/AllowAccessTest.php92
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php100
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php102
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php49
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/PluginPropertiesTest.php335
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php64
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php50
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/Mock.php144
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOMySQLTest.php33
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOSqliteTest.php23
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalCollectionTest.php9
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php192
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php32
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalTest.php10
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/Property/ACLRestrictionsTest.php35
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/Property/ACLTest.php335
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/Property/CurrentUserPrivilegeSetTest.php68
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/Property/PrincipalTest.php181
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/Property/SupportedPrivilegeSetTest.php106
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php51
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/VersionTest.php17
22 files changed, 702 insertions, 1381 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/ACLMethodTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/ACLMethodTest.php
index 9960180a3..4ecd42717 100644
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/ACLMethodTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAVACL/ACLMethodTest.php
@@ -16,17 +16,7 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase {
$server = new DAV\Server();
$server->addPlugin($acl);
- $acl->unknownMethod('ACL','test');
-
- }
-
- function testCallbackPassthru() {
-
- $acl = new Plugin();
- $server = new DAV\Server();
- $server->addPlugin($acl);
-
- $this->assertNull($acl->unknownMethod('FOO','test'));
+ $acl->httpAcl($server->httpRequest, $server->httpResponse);
}
@@ -49,7 +39,7 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase {
$server->httpRequest->setBody($body);
$server->addPlugin($acl);
- $acl->httpACL('test');
+ $acl->httpACL($server->httpRequest, $server->httpResponse);
}
@@ -61,13 +51,15 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase {
$acl = new Plugin();
$server = new DAV\Server($tree);
$server->httpRequest = new HTTP\Request();
+ $server->httpRequest->setUrl('/test');
+
$body = '<?xml version="1.0"?>
<d:acl xmlns:d="DAV:">
</d:acl>';
$server->httpRequest->setBody($body);
$server->addPlugin($acl);
- $this->assertNull($acl->httpACL('test'));
+ $this->assertFalse($acl->httpACL($server->httpRequest, $server->httpResponse));
}
@@ -81,7 +73,7 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase {
);
$acl = new Plugin();
$server = new DAV\Server($tree);
- $server->httpRequest = new HTTP\Request();
+ $server->httpRequest = new HTTP\Request('ACL','/test');
$body = '<?xml version="1.0"?>
<d:acl xmlns:d="DAV:">
<d:ace>
@@ -92,7 +84,7 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase {
$server->httpRequest->setBody($body);
$server->addPlugin($acl);
- $acl->httpACL('test');
+ $acl->httpACL($server->httpRequest, $server->httpResponse);
}
@@ -109,7 +101,7 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase {
);
$acl = new Plugin();
$server = new DAV\Server($tree);
- $server->httpRequest = new HTTP\Request();
+ $server->httpRequest = new HTTP\Request('ACL','/test');
$body = '<?xml version="1.0"?>
<d:acl xmlns:d="DAV:">
<d:ace>
@@ -120,7 +112,7 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase {
$server->httpRequest->setBody($body);
$server->addPlugin($acl);
- $acl->httpACL('test');
+ $acl->httpACL($server->httpRequest, $server->httpResponse);
}
@@ -134,7 +126,7 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase {
);
$acl = new Plugin();
$server = new DAV\Server($tree);
- $server->httpRequest = new HTTP\Request();
+ $server->httpRequest = new HTTP\Request('ACL','/test');
$body = '<?xml version="1.0"?>
<d:acl xmlns:d="DAV:">
<d:ace>
@@ -145,7 +137,7 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase {
$server->httpRequest->setBody($body);
$server->addPlugin($acl);
- $acl->httpACL('test');
+ $acl->httpACL($server->httpRequest, $server->httpResponse);
}
@@ -159,18 +151,18 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase {
);
$acl = new Plugin();
$server = new DAV\Server($tree);
- $server->httpRequest = new HTTP\Request();
+ $server->httpRequest = new HTTP\Request('ACL','/test');
$body = '<?xml version="1.0"?>
<d:acl xmlns:d="DAV:">
<d:ace>
- <d:grant><d:privilege><d:read-acl /></d:privilege></d:grant>
+ <d:grant><d:privilege><d:all /></d:privilege></d:grant>
<d:principal><d:href>/principals/notfound</d:href></d:principal>
</d:ace>
</d:acl>';
$server->httpRequest->setBody($body);
$server->addPlugin($acl);
- $acl->httpACL('test');
+ $acl->httpACL($server->httpRequest, $server->httpResponse);
}
@@ -192,7 +184,7 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase {
);
$acl = new Plugin();
$server = new DAV\Server($tree);
- $server->httpRequest = new HTTP\Request();
+ $server->httpRequest = new HTTP\Request('ACL','/test');
$body = '<?xml version="1.0"?>
<d:acl xmlns:d="DAV:">
<d:ace>
@@ -203,7 +195,7 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase {
$server->httpRequest->setBody($body);
$server->addPlugin($acl);
- $acl->httpACL('test');
+ $acl->httpACL($server->httpRequest, $server->httpResponse);
}
@@ -225,7 +217,7 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase {
);
$acl = new Plugin();
$server = new DAV\Server($tree);
- $server->httpRequest = new HTTP\Request();
+ $server->httpRequest = new HTTP\Request('ACL','/test');
$body = '<?xml version="1.0"?>
<d:acl xmlns:d="DAV:">
<d:ace>
@@ -236,7 +228,7 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase {
$server->httpRequest->setBody($body);
$server->addPlugin($acl);
- $acl->httpACL('test');
+ $acl->httpACL($server->httpRequest, $server->httpResponse);
}
@@ -258,7 +250,7 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase {
);
$acl = new Plugin();
$server = new DAV\Server($tree);
- $server->httpRequest = new HTTP\Request();
+ $server->httpRequest = new HTTP\Request('ACL','/test');
$body = '<?xml version="1.0"?>
<d:acl xmlns:d="DAV:">
<d:ace>
@@ -269,11 +261,11 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase {
$server->httpRequest->setBody($body);
$server->addPlugin($acl);
- $acl->httpACL('test');
+ $acl->httpACL($server->httpRequest, $server->httpResponse);
}
- function testSuccessComplex () {
+ function testSuccessComplex() {
$oldACL = array(
array(
@@ -296,7 +288,7 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase {
);
$acl = new Plugin();
$server = new DAV\Server($tree);
- $server->httpRequest = new HTTP\Request();
+ $server->httpRequest = new HTTP\Request('ACL','/test');
$body = '<?xml version="1.0"?>
<d:acl xmlns:d="DAV:">
<d:ace>
@@ -312,7 +304,8 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase {
$server->httpRequest->setBody($body);
$server->addPlugin($acl);
- $this->assertFalse($acl->unknownMethod('ACL','test'));
+
+ $this->assertFalse($acl->httpAcl($server->httpRequest, $server->httpResponse));
$this->assertEquals(array(
array(
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/AllowAccessTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/AllowAccessTest.php
index 3a9b35b45..14a80003a 100644
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/AllowAccessTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAVACL/AllowAccessTest.php
@@ -27,112 +27,104 @@ class AllowAccessTest extends \PHPUnit_Framework_TestCase {
function testGet() {
- $this->assertTrue($this->server->broadcastEvent('beforeMethod',array('GET','testdir')));
+ $this->server->httpRequest->setMethod('GET');
+ $this->server->httpRequest->setUrl('/testdir');
+
+ $this->assertTrue($this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]));
}
function testGetDoesntExist() {
- $r = $this->server->broadcastEvent('beforeMethod',array('GET','foo'));
- $this->assertTrue($r);
+ $this->server->httpRequest->setMethod('GET');
+ $this->server->httpRequest->setUrl('/foo');
+
+ $this->assertTrue($this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]));
}
function testHEAD() {
- $this->assertTrue($this->server->broadcastEvent('beforeMethod',array('HEAD','testdir')));
+ $this->server->httpRequest->setMethod('HEAD');
+ $this->server->httpRequest->setUrl('/testdir');
+
+ $this->assertTrue($this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]));
}
function testOPTIONS() {
- $this->assertTrue($this->server->broadcastEvent('beforeMethod',array('OPTIONS','testdir')));
+ $this->server->httpRequest->setMethod('OPTIONS');
+ $this->server->httpRequest->setUrl('/testdir');
+
+ $this->assertTrue($this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]));
}
function testPUT() {
- $this->assertTrue($this->server->broadcastEvent('beforeMethod',array('PUT','testdir')));
+ $this->server->httpRequest->setMethod('PUT');
+ $this->server->httpRequest->setUrl('/testdir');
+
+ $this->assertTrue($this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]));
}
function testACL() {
- $this->assertTrue($this->server->broadcastEvent('beforeMethod',array('ACL','testdir')));
+ $this->server->httpRequest->setMethod('ACL');
+ $this->server->httpRequest->setUrl('/testdir');
+
+ $this->assertTrue($this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]));
}
function testPROPPATCH() {
- $this->assertTrue($this->server->broadcastEvent('beforeMethod',array('PROPPATCH','testdir')));
+ $this->server->httpRequest->setMethod('PROPPATCH');
+ $this->server->httpRequest->setUrl('/testdir');
+
+ $this->assertTrue($this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]));
}
function testCOPY() {
- $this->assertTrue($this->server->broadcastEvent('beforeMethod',array('COPY','testdir')));
+ $this->server->httpRequest->setMethod('COPY');
+ $this->server->httpRequest->setUrl('/testdir');
+
+ $this->assertTrue($this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]));
}
function testMOVE() {
- $this->assertTrue($this->server->broadcastEvent('beforeMethod',array('MOVE','testdir')));
+ $this->server->httpRequest->setMethod('MOVE');
+ $this->server->httpRequest->setUrl('/testdir');
+
+ $this->assertTrue($this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]));
}
function testLOCK() {
- $this->assertTrue($this->server->broadcastEvent('beforeMethod',array('LOCK','testdir')));
+ $this->server->httpRequest->setMethod('LOCK');
+ $this->server->httpRequest->setUrl('/testdir');
+
+ $this->assertTrue($this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]));
}
function testBeforeBind() {
- $this->assertTrue($this->server->broadcastEvent('beforeBind',array('testdir/file')));
+ $this->assertTrue($this->server->emit('beforeBind', ['testdir/file']));
}
function testBeforeUnbind() {
- $this->assertTrue($this->server->broadcastEvent('beforeUnbind',array('testdir')));
-
- }
-
- function testAfterGetProperties() {
-
- $properties = array(
- 'href' => 'foo',
- '200' => array(
- '{DAV:}displayname' => 'foo',
- '{DAV:}getcontentlength' => 500,
- ),
- '404' => array(
- '{DAV:}bar' => null,
- ),
- '403' => array(
- '{DAV:}owner' => null,
- ),
- );
-
- $expected = array(
- 'href' => 'foo',
- '200' => array(
- '{DAV:}displayname' => 'foo',
- '{DAV:}getcontentlength' => 500,
- ),
- '404' => array(
- '{DAV:}bar' => null,
- ),
- '403' => array(
- '{DAV:}owner' => null,
- ),
- );
-
- $r = $this->server->broadcastEvent('afterGetProperties',array('testdir',&$properties));
- $this->assertTrue($r);
-
- $this->assertEquals($expected, $properties);
+ $this->assertTrue($this->server->emit('beforeUnbind', ['testdir']));
}
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php
index 345d2cc5d..be3e9dae9 100644
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php
@@ -15,9 +15,9 @@ class BlockAccessTest extends \PHPUnit_Framework_TestCase {
function setUp() {
- $nodes = array(
+ $nodes = [
new DAV\SimpleCollection('testdir'),
- );
+ ];
$this->server = new DAV\Server($nodes);
$this->plugin = new Plugin();
@@ -31,13 +31,19 @@ class BlockAccessTest extends \PHPUnit_Framework_TestCase {
*/
function testGet() {
- $this->server->broadcastEvent('beforeMethod',array('GET','testdir'));
+ $this->server->httpRequest->setMethod('GET');
+ $this->server->httpRequest->setUrl('/testdir');
+
+ $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]);
}
function testGetDoesntExist() {
- $r = $this->server->broadcastEvent('beforeMethod',array('GET','foo'));
+ $this->server->httpRequest->setMethod('GET');
+ $this->server->httpRequest->setUrl('/foo');
+
+ $r = $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]);
$this->assertTrue($r);
}
@@ -47,7 +53,10 @@ class BlockAccessTest extends \PHPUnit_Framework_TestCase {
*/
function testHEAD() {
- $this->server->broadcastEvent('beforeMethod',array('HEAD','testdir'));
+ $this->server->httpRequest->setMethod('HEAD');
+ $this->server->httpRequest->setUrl('/testdir');
+
+ $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]);
}
@@ -56,7 +65,10 @@ class BlockAccessTest extends \PHPUnit_Framework_TestCase {
*/
function testOPTIONS() {
- $this->server->broadcastEvent('beforeMethod',array('OPTIONS','testdir'));
+ $this->server->httpRequest->setMethod('OPTIONS');
+ $this->server->httpRequest->setUrl('/testdir');
+
+ $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]);
}
@@ -65,7 +77,10 @@ class BlockAccessTest extends \PHPUnit_Framework_TestCase {
*/
function testPUT() {
- $this->server->broadcastEvent('beforeMethod',array('PUT','testdir'));
+ $this->server->httpRequest->setMethod('PUT');
+ $this->server->httpRequest->setUrl('/testdir');
+
+ $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]);
}
@@ -74,7 +89,10 @@ class BlockAccessTest extends \PHPUnit_Framework_TestCase {
*/
function testPROPPATCH() {
- $this->server->broadcastEvent('beforeMethod',array('PROPPATCH','testdir'));
+ $this->server->httpRequest->setMethod('PROPPATCH');
+ $this->server->httpRequest->setUrl('/testdir');
+
+ $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]);
}
@@ -83,7 +101,10 @@ class BlockAccessTest extends \PHPUnit_Framework_TestCase {
*/
function testCOPY() {
- $this->server->broadcastEvent('beforeMethod',array('COPY','testdir'));
+ $this->server->httpRequest->setMethod('COPY');
+ $this->server->httpRequest->setUrl('/testdir');
+
+ $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]);
}
@@ -92,7 +113,10 @@ class BlockAccessTest extends \PHPUnit_Framework_TestCase {
*/
function testMOVE() {
- $this->server->broadcastEvent('beforeMethod',array('MOVE','testdir'));
+ $this->server->httpRequest->setMethod('MOVE');
+ $this->server->httpRequest->setUrl('/testdir');
+
+ $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]);
}
@@ -101,7 +125,10 @@ class BlockAccessTest extends \PHPUnit_Framework_TestCase {
*/
function testACL() {
- $this->server->broadcastEvent('beforeMethod',array('ACL','testdir'));
+ $this->server->httpRequest->setMethod('ACL');
+ $this->server->httpRequest->setUrl('/testdir');
+
+ $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]);
}
@@ -110,7 +137,10 @@ class BlockAccessTest extends \PHPUnit_Framework_TestCase {
*/
function testLOCK() {
- $this->server->broadcastEvent('beforeMethod',array('LOCK','testdir'));
+ $this->server->httpRequest->setMethod('LOCK');
+ $this->server->httpRequest->setUrl('/testdir');
+
+ $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]);
}
@@ -119,7 +149,7 @@ class BlockAccessTest extends \PHPUnit_Framework_TestCase {
*/
function testBeforeBind() {
- $this->server->broadcastEvent('beforeBind',array('testdir/file'));
+ $this->server->emit('beforeBind', ['testdir/file']);
}
@@ -128,62 +158,48 @@ class BlockAccessTest extends \PHPUnit_Framework_TestCase {
*/
function testBeforeUnbind() {
- $this->server->broadcastEvent('beforeUnbind',array('testdir'));
+ $this->server->emit('beforeUnbind', ['testdir']);
}
- function testBeforeGetProperties() {
+ function testPropFind() {
- $requestedProperties = array(
+ $propFind = new DAV\PropFind('testdir', [
'{DAV:}displayname',
'{DAV:}getcontentlength',
'{DAV:}bar',
'{DAV:}owner',
- );
- $returnedProperties = array();
+ ]);
- $arguments = array(
- 'testdir',
- new DAV\SimpleCollection('testdir'),
- &$requestedProperties,
- &$returnedProperties
- );
- $r = $this->server->broadcastEvent('beforeGetProperties',$arguments);
+ $r = $this->server->emit('propFind', [$propFind, new DAV\SimpleCollection('testdir')]);
$this->assertTrue($r);
- $expected = array(
- '403' => array(
+ $expected = [
+ 200 => [],
+ 404 => [],
+ 403 => [
'{DAV:}displayname' => null,
'{DAV:}getcontentlength' => null,
'{DAV:}bar' => null,
'{DAV:}owner' => null,
- ),
- );
+ ],
+ ];
- $this->assertEquals($expected, $returnedProperties);
- $this->assertEquals(array(), $requestedProperties);
+ $this->assertEquals($expected, $propFind->getResultForMultiStatus());
}
function testBeforeGetPropertiesNoListing() {
$this->plugin->hideNodesFromListings = true;
-
- $requestedProperties = array(
+ $propFind = new DAV\PropFind('testdir', [
'{DAV:}displayname',
'{DAV:}getcontentlength',
'{DAV:}bar',
'{DAV:}owner',
- );
- $returnedProperties = array();
+ ]);
- $arguments = array(
- 'testdir',
- new DAV\SimpleCollection('testdir'),
- &$requestedProperties,
- &$returnedProperties
- );
- $r = $this->server->broadcastEvent('beforeGetProperties',$arguments);
+ $r = $this->server->emit('propFind', [$propFind, new DAV\SimpleCollection('testdir')]);
$this->assertFalse($r);
}
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php
index 324788d4a..5e99f2e73 100644
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php
@@ -12,23 +12,24 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
function getServer() {
$tree = array(
- new MockPropertyNode('node1', array(
+ new DAV\Mock\PropertiesCollection('node1', [], array(
'{http://sabredav.org/ns}simple' => 'foo',
- '{http://sabredav.org/ns}href' => new DAV\Property\Href('node2'),
+ '{http://sabredav.org/ns}href' => new DAV\Xml\Property\Href('node2'),
'{DAV:}displayname' => 'Node 1',
)),
- new MockPropertyNode('node2', array(
+ new DAV\Mock\PropertiesCollection('node2', [], array(
'{http://sabredav.org/ns}simple' => 'simple',
- '{http://sabredav.org/ns}hreflist' => new DAV\Property\HrefList(array('node1','node3')),
+ '{http://sabredav.org/ns}hreflist' => new DAV\Xml\Property\Href(['node1','node3']),
'{DAV:}displayname' => 'Node 2',
)),
- new MockPropertyNode('node3', array(
+ new DAV\Mock\PropertiesCollection('node3', [], array(
'{http://sabredav.org/ns}simple' => 'simple',
'{DAV:}displayname' => 'Node 3',
)),
);
$fakeServer = new DAV\Server($tree);
+ $fakeServer->sapi = new HTTP\SapiMock();
$fakeServer->debugExceptions = true;
$fakeServer->httpResponse = new HTTP\ResponseMock();
$plugin = new Plugin();
@@ -58,7 +59,7 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
'REQUEST_URI' => '/node1',
);
- $request = new HTTP\Request($serverVars);
+ $request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody($xml);
$server = $this->getServer();
@@ -66,10 +67,11 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
$server->exec();
- $this->assertEquals('HTTP/1.1 207 Multi-Status', $server->httpResponse->status,'Incorrect status code received. Full body: ' . $server->httpResponse->body);
+ $this->assertEquals(207, $server->httpResponse->status,'Incorrect status code received. Full body: ' . $server->httpResponse->body);
$this->assertEquals(array(
- 'Content-Type' => 'application/xml; charset=utf-8',
- ), $server->httpResponse->headers);
+ 'X-Sabre-Version' => [DAV\Version::VERSION],
+ 'Content-Type' => ['application/xml; charset=utf-8'],
+ ), $server->httpResponse->getHeaders());
$check = array(
@@ -120,7 +122,7 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
'REQUEST_URI' => '/node1',
);
- $request = new HTTP\Request($serverVars);
+ $request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody($xml);
$server = $this->getServer();
@@ -128,10 +130,11 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
$server->exec();
- $this->assertEquals('HTTP/1.1 207 Multi-Status', $server->httpResponse->status, 'Incorrect response status received. Full response body: ' . $server->httpResponse->body);
+ $this->assertEquals(207, $server->httpResponse->status, 'Incorrect response status received. Full response body: ' . $server->httpResponse->body);
$this->assertEquals(array(
- 'Content-Type' => 'application/xml; charset=utf-8',
- ), $server->httpResponse->headers);
+ 'X-Sabre-Version' => [DAV\Version::VERSION],
+ 'Content-Type' => ['application/xml; charset=utf-8'],
+ ), $server->httpResponse->getHeaders());
$check = array(
@@ -160,7 +163,7 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
$count = 1;
if (!is_int($v1)) $count = $v2;
- $this->assertEquals($count,count($result), 'we expected ' . $count . ' appearances of ' . $xpath . ' . We found ' . count($result));
+ $this->assertEquals($count,count($result), 'we expected ' . $count . ' appearances of ' . $xpath . ' . We found ' . count($result) . ' Full response body: ' . $server->httpResponse->getBodyAsString());
}
@@ -184,7 +187,7 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
'REQUEST_URI' => '/node2',
);
- $request = new HTTP\Request($serverVars);
+ $request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody($xml);
$server = $this->getServer();
@@ -192,10 +195,11 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
$server->exec();
- $this->assertEquals('HTTP/1.1 207 Multi-Status', $server->httpResponse->status);
+ $this->assertEquals(207, $server->httpResponse->status);
$this->assertEquals(array(
- 'Content-Type' => 'application/xml; charset=utf-8',
- ), $server->httpResponse->headers);
+ 'X-Sabre-Version' => [DAV\Version::VERSION],
+ 'Content-Type' => ['application/xml; charset=utf-8'],
+ ), $server->httpResponse->getHeaders());
$check = array(
@@ -251,7 +255,7 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
'REQUEST_URI' => '/node2',
);
- $request = new HTTP\Request($serverVars);
+ $request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody($xml);
$server = $this->getServer();
@@ -259,10 +263,11 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
$server->exec();
- $this->assertEquals('HTTP/1.1 207 Multi-Status', $server->httpResponse->status);
+ $this->assertEquals(207, $server->httpResponse->status);
$this->assertEquals(array(
- 'Content-Type' => 'application/xml; charset=utf-8',
- ), $server->httpResponse->headers);
+ 'X-Sabre-Version' => [DAV\Version::VERSION],
+ 'Content-Type' => ['application/xml; charset=utf-8'],
+ ), $server->httpResponse->getHeaders());
$check = array(
@@ -303,56 +308,3 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
}
}
-class MockPropertyNode implements DAV\INode, DAV\IProperties {
-
- function __construct($name, array $properties) {
-
- $this->name = $name;
- $this->properties = $properties;
-
- }
-
- function getName() {
-
- return $this->name;
-
- }
-
- function getProperties($requestedProperties) {
-
- $returnedProperties = array();
- foreach($requestedProperties as $requestedProperty) {
- if (isset($this->properties[$requestedProperty])) {
- $returnedProperties[$requestedProperty] =
- $this->properties[$requestedProperty];
- }
- }
- return $returnedProperties;
-
- }
-
- function delete() {
-
- throw new DAV\Exception('Not implemented');
-
- }
-
- function setName($name) {
-
- throw new DAV\Exception('Not implemented');
-
- }
-
- function getLastModified() {
-
- return null;
-
- }
-
- function updateProperties($properties) {
-
- throw new DAV\Exception('Not implemented');
-
- }
-
-}
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php
index 23c4b6e85..fb7516a78 100644
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php
@@ -11,7 +11,9 @@ require_once 'Sabre/HTTP/ResponseMock.php';
class PluginAdminTest extends \PHPUnit_Framework_TestCase {
- function testNoAdminAccess() {
+ public $server;
+
+ function setUp() {
$principalBackend = new PrincipalBackend\Mock();
@@ -20,13 +22,18 @@ class PluginAdminTest extends \PHPUnit_Framework_TestCase {
new PrincipalCollection($principalBackend),
);
- $fakeServer = new DAV\Server($tree);
- $plugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock(),'realm');
- $fakeServer->addPlugin($plugin);
+ $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);
+ }
+
+ function testNoAdminAccess() {
+
$plugin = new Plugin();
- $fakeServer->addPlugin($plugin);
+ $this->server->addPlugin($plugin);
- $request = new HTTP\Request(array(
+ $request = HTTP\Sapi::createFromServerArray(array(
'REQUEST_METHOD' => 'OPTIONS',
'HTTP_DEPTH' => 1,
'REQUEST_URI' => '/adminonly',
@@ -34,12 +41,12 @@ class PluginAdminTest extends \PHPUnit_Framework_TestCase {
$response = new HTTP\ResponseMock();
- $fakeServer->httpRequest = $request;
- $fakeServer->httpResponse = $response;
+ $this->server->httpRequest = $request;
+ $this->server->httpResponse = $response;
- $fakeServer->exec();
+ $this->server->exec();
- $this->assertEquals('HTTP/1.1 403 Forbidden', $response->status);
+ $this->assertEquals(403, $response->status);
}
@@ -48,23 +55,13 @@ class PluginAdminTest extends \PHPUnit_Framework_TestCase {
*/
function testAdminAccess() {
- $principalBackend = new PrincipalBackend\Mock();
-
- $tree = array(
- new MockACLNode('adminonly', array()),
- new PrincipalCollection($principalBackend),
- );
-
- $fakeServer = new DAV\Server($tree);
- $plugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock(),'realm');
- $fakeServer->addPlugin($plugin);
$plugin = new Plugin();
$plugin->adminPrincipals = array(
'principals/admin',
);
- $fakeServer->addPlugin($plugin);
+ $this->server->addPlugin($plugin);
- $request = new HTTP\Request(array(
+ $request = HTTP\Sapi::createFromServerArray(array(
'REQUEST_METHOD' => 'OPTIONS',
'HTTP_DEPTH' => 1,
'REQUEST_URI' => '/adminonly',
@@ -72,12 +69,12 @@ class PluginAdminTest extends \PHPUnit_Framework_TestCase {
$response = new HTTP\ResponseMock();
- $fakeServer->httpRequest = $request;
- $fakeServer->httpResponse = $response;
+ $this->server->httpRequest = $request;
+ $this->server->httpResponse = $response;
- $fakeServer->exec();
+ $this->server->exec();
- $this->assertEquals('HTTP/1.1 200 OK', $response->status);
+ $this->assertEquals(200, $response->status);
}
}
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginPropertiesTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginPropertiesTest.php
index 8c0626e50..e5b7e1a3f 100644
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginPropertiesTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginPropertiesTest.php
@@ -5,42 +5,37 @@ namespace Sabre\DAVACL;
use Sabre\DAV;
use Sabre\HTTP;
-
class PluginPropertiesTest extends \PHPUnit_Framework_TestCase {
function testPrincipalCollectionSet() {
$plugin = new Plugin();
- $plugin->principalCollectionSet = array(
+ $plugin->principalCollectionSet = [
'principals1',
'principals2',
- );
+ ];
- $requestedProperties = array(
+ $requestedProperties = [
'{DAV:}principal-collection-set',
- );
-
- $returnedProperties = array(
- 200 => array(),
- 404 => array(),
- );
+ ];
- $server = new DAV\Server();
+ $server = new DAV\Server(new DAV\SimpleCollection('root'));
$server->addPlugin($plugin);
- $this->assertNull($plugin->beforeGetProperties('', new DAV\SimpleCollection('root'), $requestedProperties, $returnedProperties));
+ $result = $server->getPropertiesForPath('', $requestedProperties);
+ $result = $result[0];
- $this->assertEquals(1,count($returnedProperties[200]));
- $this->assertArrayHasKey('{DAV:}principal-collection-set',$returnedProperties[200]);
- $this->assertInstanceOf('Sabre\\DAV\\Property\\HrefList', $returnedProperties[200]['{DAV:}principal-collection-set']);
+ $this->assertEquals(1,count($result[200]));
+ $this->assertArrayHasKey('{DAV:}principal-collection-set',$result[200]);
+ $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $result[200]['{DAV:}principal-collection-set']);
- $expected = array(
+ $expected = [
'principals1/',
'principals2/',
- );
+ ];
- $this->assertEquals($expected, $returnedProperties[200]['{DAV:}principal-collection-set']->getHrefs());
+ $this->assertEquals($expected, $result[200]['{DAV:}principal-collection-set']->getHrefs());
}
@@ -48,50 +43,35 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase {
function testCurrentUserPrincipal() {
$fakeServer = new DAV\Server();
- $plugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock(),'realm');
+ $plugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock());
$fakeServer->addPlugin($plugin);
$plugin = new Plugin();
$fakeServer->addPlugin($plugin);
- $requestedProperties = array(
+ $requestedProperties = [
'{DAV:}current-user-principal',
- );
-
- $returnedProperties = array(
- 200 => array(),
- 404 => array(),
- );
+ ];
- $this->assertNull($plugin->beforeGetProperties('', new DAV\SimpleCollection('root'), $requestedProperties, $returnedProperties));
+ $result = $fakeServer->getPropertiesForPath('', $requestedProperties);
+ $result = $result[0];
- $this->assertEquals(1,count($returnedProperties[200]));
- $this->assertArrayHasKey('{DAV:}current-user-principal',$returnedProperties[200]);
- $this->assertInstanceOf('Sabre\DAVACL\Property\Principal', $returnedProperties[200]['{DAV:}current-user-principal']);
- $this->assertEquals(Property\Principal::UNAUTHENTICATED, $returnedProperties[200]['{DAV:}current-user-principal']->getType());
+ $this->assertEquals(1,count($result[200]));
+ $this->assertArrayHasKey('{DAV:}current-user-principal',$result[200]);
+ $this->assertInstanceOf('Sabre\DAVACL\Xml\Property\Principal', $result[200]['{DAV:}current-user-principal']);
+ $this->assertEquals(Xml\Property\Principal::UNAUTHENTICATED, $result[200]['{DAV:}current-user-principal']->getType());
// This will force the login
- $fakeServer->broadCastEvent('beforeMethod',array('GET',''));
-
-
- $requestedProperties = array(
- '{DAV:}current-user-principal',
- );
+ $fakeServer->emit('beforeMethod', [$fakeServer->httpRequest, $fakeServer->httpResponse]);
- $returnedProperties = array(
- 200 => array(),
- 404 => array(),
- );
+ $result = $fakeServer->getPropertiesForPath('', $requestedProperties);
+ $result = $result[0];
-
- $this->assertNull($plugin->beforeGetProperties('', new DAV\SimpleCollection('root'), $requestedProperties, $returnedProperties));
-
-
- $this->assertEquals(1,count($returnedProperties[200]));
- $this->assertArrayHasKey('{DAV:}current-user-principal',$returnedProperties[200]);
- $this->assertInstanceOf('Sabre\DAVACL\Property\Principal', $returnedProperties[200]['{DAV:}current-user-principal']);
- $this->assertEquals(Property\Principal::HREF, $returnedProperties[200]['{DAV:}current-user-principal']->getType());
- $this->assertEquals('principals/admin/', $returnedProperties[200]['{DAV:}current-user-principal']->getHref());
+ $this->assertEquals(1,count($result[200]));
+ $this->assertArrayHasKey('{DAV:}current-user-principal',$result[200]);
+ $this->assertInstanceOf('Sabre\DAVACL\Xml\Property\Principal', $result[200]['{DAV:}current-user-principal']);
+ $this->assertEquals(Xml\Property\Principal::HREF, $result[200]['{DAV:}current-user-principal']->getType());
+ $this->assertEquals('principals/admin/', $result[200]['{DAV:}current-user-principal']->getHref());
}
@@ -101,33 +81,23 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase {
$server = new DAV\Server();
$server->addPlugin($plugin);
- $requestedProperties = array(
+ $requestedProperties = [
'{DAV:}supported-privilege-set',
- );
+ ];
- $returnedProperties = array(
- 200 => array(),
- 404 => array(),
- );
+ $result = $server->getPropertiesForPath('', $requestedProperties);
+ $result = $result[0];
-
- $this->assertNull($plugin->beforeGetProperties('', new DAV\SimpleCollection('root'), $requestedProperties, $returnedProperties));
-
- $this->assertEquals(1,count($returnedProperties[200]));
- $this->assertArrayHasKey('{DAV:}supported-privilege-set',$returnedProperties[200]);
- $this->assertInstanceOf('Sabre\\DAVACL\\Property\\SupportedPrivilegeSet', $returnedProperties[200]['{DAV:}supported-privilege-set']);
+ $this->assertEquals(1,count($result[200]));
+ $this->assertArrayHasKey('{DAV:}supported-privilege-set',$result[200]);
+ $this->assertInstanceOf('Sabre\\DAVACL\\Xml\\Property\\SupportedPrivilegeSet', $result[200]['{DAV:}supported-privilege-set']);
$server = new DAV\Server();
- $prop = $returnedProperties[200]['{DAV:}supported-privilege-set'];
-
- $dom = new \DOMDocument('1.0', 'utf-8');
- $root = $dom->createElement('d:root');
- $root->setAttribute('xmlns:d','DAV:');
- $dom->appendChild($root);
- $prop->serialize($server, $root);
+ $prop = $result[200]['{DAV:}supported-privilege-set'];
+ $result = $server->xml->write('{DAV:}root', $prop);
- $xpaths = array(
+ $xpaths = [
'/d:root' => 1,
'/d:root/d:supported-privilege' => 1,
'/d:root/d:supported-privilege/d:privilege' => 1,
@@ -147,19 +117,19 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase {
'/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:privilege/d:bind' => 1,
'/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:privilege/d:unbind' => 1,
'/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:privilege/d:unlock' => 1,
- '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:abstract' => 8,
- );
+ '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:abstract' => 0,
+ ];
// reloading because php dom sucks
$dom2 = new \DOMDocument('1.0', 'utf-8');
- $dom2->loadXML($dom->saveXML());
+ $dom2->loadXML($result);
$dxpath = new \DOMXPath($dom2);
$dxpath->registerNamespace('d','DAV:');
foreach($xpaths as $xpath=>$count) {
- $this->assertEquals($count, $dxpath->query($xpath)->length, 'Looking for : ' . $xpath . ', we could only find ' . $dxpath->query($xpath)->length . ' elements, while we expected ' . $count);
+ $this->assertEquals($count, $dxpath->query($xpath)->length, 'Looking for : ' . $xpath . ', we could only find ' . $dxpath->query($xpath)->length . ' elements, while we expected ' . $count. ' Full XML: ' . $result);
}
@@ -169,42 +139,37 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase {
$plugin = new Plugin();
- $nodes = array(
- new MockACLNode('foo', array(
- array(
+ $nodes = [
+ new MockACLNode('foo', [
+ [
'principal' => 'principals/admin',
'privilege' => '{DAV:}read',
- )
- )),
- new DAV\SimpleCollection('principals', array(
+ ]
+ ]),
+ new DAV\SimpleCollection('principals', [
$principal = new MockPrincipal('admin','principals/admin'),
- )),
+ ]),
- );
+ ];
$server = new DAV\Server($nodes);
$server->addPlugin($plugin);
- $authPlugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock(),'realm');
+ $authPlugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock());
$server->addPlugin($authPlugin);
// Force login
- $authPlugin->beforeMethod('BLA','foo');
+ $authPlugin->beforeMethod(new HTTP\Request(), new HTTP\Response());
- $requestedProperties = array(
+ $requestedProperties = [
'{DAV:}acl',
- );
+ ];
- $returnedProperties = array(
- 200 => array(),
- 404 => array(),
- );
+ $result = $server->getPropertiesForPath('foo', $requestedProperties);
+ $result = $result[0];
-
- $this->assertNull($plugin->beforeGetProperties('foo', $nodes[0], $requestedProperties, $returnedProperties));
-
- $this->assertEquals(1,count($returnedProperties[200]),'The {DAV:}acl property did not return from the list. Full list: ' . print_r($returnedProperties,true));
- $this->assertArrayHasKey('{DAV:}acl',$returnedProperties[200]);
- $this->assertInstanceOf('Sabre\\DAVACL\\Property\\ACL', $returnedProperties[200]['{DAV:}acl']);
+ $this->assertEquals(1,count($result[200]),'The {DAV:}acl property did not return from the list. Full list: ' . print_r($result, true));
+ $this->assertArrayHasKey('{DAV:}acl',$result[200]);
+ $this->assertInstanceOf('Sabre\\DAVACL\\Xml\Property\\Acl', $result[200]['{DAV:}acl']);
}
@@ -212,196 +177,176 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase {
$plugin = new Plugin();
- $nodes = array(
- new MockACLNode('foo', array(
- array(
+ $nodes = [
+ new MockACLNode('foo', [
+ [
'principal' => 'principals/admin',
'privilege' => '{DAV:}read',
- )
- )),
- new DAV\SimpleCollection('principals', array(
+ ]
+ ]),
+ new DAV\SimpleCollection('principals', [
$principal = new MockPrincipal('admin','principals/admin'),
- )),
+ ]),
- );
+ ];
$server = new DAV\Server($nodes);
$server->addPlugin($plugin);
- $authPlugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock(),'realm');
+ $authPlugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock());
$server->addPlugin($authPlugin);
// Force login
- $authPlugin->beforeMethod('BLA','foo');
+ $authPlugin->beforeMethod(new HTTP\Request(), new HTTP\Response());
- $requestedProperties = array(
+ $requestedProperties = [
'{DAV:}acl-restrictions',
- );
-
- $returnedProperties = array(
- 200 => array(),
- 404 => array(),
- );
+ ];
+ $result = $server->getPropertiesForPath('foo', $requestedProperties);
+ $result = $result[0];
- $this->assertNull($plugin->beforeGetProperties('foo', $nodes[0], $requestedProperties, $returnedProperties));
-
- $this->assertEquals(1,count($returnedProperties[200]),'The {DAV:}acl-restrictions property did not return from the list. Full list: ' . print_r($returnedProperties,true));
- $this->assertArrayHasKey('{DAV:}acl-restrictions',$returnedProperties[200]);
- $this->assertInstanceOf('Sabre\\DAVACL\\Property\\ACLRestrictions', $returnedProperties[200]['{DAV:}acl-restrictions']);
+ $this->assertEquals(1,count($result[200]),'The {DAV:}acl-restrictions property did not return from the list. Full list: ' . print_r($result, true));
+ $this->assertArrayHasKey('{DAV:}acl-restrictions',$result[200]);
+ $this->assertInstanceOf('Sabre\\DAVACL\\Xml\\Property\\AclRestrictions', $result[200]['{DAV:}acl-restrictions']);
}
function testAlternateUriSet() {
- $tree = array(
- new DAV\SimpleCollection('principals', array(
+ $tree = [
+ new DAV\SimpleCollection('principals', [
$principal = new MockPrincipal('user','principals/user'),
- )),
- );
+ ])
+ ];
$fakeServer = new DAV\Server($tree);
- //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend(),'realm');
+ //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend())
//$fakeServer->addPlugin($plugin);
$plugin = new Plugin();
$fakeServer->addPlugin($plugin);
- $requestedProperties = array(
+ $requestedProperties = [
'{DAV:}alternate-URI-set',
- );
- $returnedProperties = array();
-
- $result = $plugin->beforeGetProperties('principals/user',$principal,$requestedProperties,$returnedProperties);
-
- $this->assertNull($result);
+ ];
+ $result = $fakeServer->getPropertiesForPath('principals/user', $requestedProperties);
+ $result = $result[0];
- $this->assertTrue(isset($returnedProperties[200]));
- $this->assertTrue(isset($returnedProperties[200]['{DAV:}alternate-URI-set']));
- $this->assertInstanceOf('Sabre\\DAV\\Property\\HrefList', $returnedProperties[200]['{DAV:}alternate-URI-set']);
+ $this->assertTrue(isset($result[200]));
+ $this->assertTrue(isset($result[200]['{DAV:}alternate-URI-set']));
+ $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $result[200]['{DAV:}alternate-URI-set']);
- $this->assertEquals(array(), $returnedProperties[200]['{DAV:}alternate-URI-set']->getHrefs());
+ $this->assertEquals([], $result[200]['{DAV:}alternate-URI-set']->getHrefs());
}
function testPrincipalURL() {
- $tree = array(
- new DAV\SimpleCollection('principals', array(
+ $tree = [
+ new DAV\SimpleCollection('principals', [
$principal = new MockPrincipal('user','principals/user'),
- )),
- );
+ ]),
+ ];
$fakeServer = new DAV\Server($tree);
- //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend(),'realm');
+ //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend());
//$fakeServer->addPlugin($plugin);
$plugin = new Plugin();
$fakeServer->addPlugin($plugin);
- $requestedProperties = array(
+ $requestedProperties = [
'{DAV:}principal-URL',
- );
- $returnedProperties = array();
+ ];
- $result = $plugin->beforeGetProperties('principals/user',$principal,$requestedProperties,$returnedProperties);
+ $result = $fakeServer->getPropertiesForPath('principals/user', $requestedProperties);
+ $result = $result[0];
- $this->assertNull($result);
+ $this->assertTrue(isset($result[200]));
+ $this->assertTrue(isset($result[200]['{DAV:}principal-URL']));
+ $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $result[200]['{DAV:}principal-URL']);
- $this->assertTrue(isset($returnedProperties[200]));
- $this->assertTrue(isset($returnedProperties[200]['{DAV:}principal-URL']));
- $this->assertInstanceOf('Sabre\\DAV\\Property\\Href', $returnedProperties[200]['{DAV:}principal-URL']);
-
- $this->assertEquals('principals/user/', $returnedProperties[200]['{DAV:}principal-URL']->getHref());
+ $this->assertEquals('principals/user/', $result[200]['{DAV:}principal-URL']->getHref());
}
function testGroupMemberSet() {
- $tree = array(
- new DAV\SimpleCollection('principals', array(
+ $tree = [
+ new DAV\SimpleCollection('principals', [
$principal = new MockPrincipal('user','principals/user'),
- )),
- );
+ ]),
+ ];
$fakeServer = new DAV\Server($tree);
- //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend(),'realm');
+ //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend());
//$fakeServer->addPlugin($plugin);
$plugin = new Plugin();
$fakeServer->addPlugin($plugin);
- $requestedProperties = array(
+ $requestedProperties = [
'{DAV:}group-member-set',
- );
- $returnedProperties = array();
-
- $result = $plugin->beforeGetProperties('principals/user',$principal,$requestedProperties,$returnedProperties);
+ ];
- $this->assertNull($result);
+ $result = $fakeServer->getPropertiesForPath('principals/user', $requestedProperties);
+ $result = $result[0];
- $this->assertTrue(isset($returnedProperties[200]));
- $this->assertTrue(isset($returnedProperties[200]['{DAV:}group-member-set']));
- $this->assertInstanceOf('Sabre\\DAV\\Property\\HrefList', $returnedProperties[200]['{DAV:}group-member-set']);
+ $this->assertTrue(isset($result[200]));
+ $this->assertTrue(isset($result[200]['{DAV:}group-member-set']));
+ $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $result[200]['{DAV:}group-member-set']);
- $this->assertEquals(array(), $returnedProperties[200]['{DAV:}group-member-set']->getHrefs());
+ $this->assertEquals([], $result[200]['{DAV:}group-member-set']->getHrefs());
}
function testGroupMemberShip() {
- $tree = array(
- new DAV\SimpleCollection('principals', array(
+ $tree = [
+ new DAV\SimpleCollection('principals', [
$principal = new MockPrincipal('user','principals/user'),
- )),
- );
+ ]),
+ ];
$fakeServer = new DAV\Server($tree);
- //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend(),'realm');
- //$fakeServer->addPlugin($plugin);
$plugin = new Plugin();
$fakeServer->addPlugin($plugin);
- $requestedProperties = array(
+ $requestedProperties = [
'{DAV:}group-membership',
- );
- $returnedProperties = array();
+ ];
- $result = $plugin->beforeGetProperties('principals/user',$principal,$requestedProperties,$returnedProperties);
+ $result = $fakeServer->getPropertiesForPath('principals/user', $requestedProperties);
+ $result = $result[0];
- $this->assertNull($result);
+ $this->assertTrue(isset($result[200]));
+ $this->assertTrue(isset($result[200]['{DAV:}group-membership']));
+ $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $result[200]['{DAV:}group-membership']);
- $this->assertTrue(isset($returnedProperties[200]));
- $this->assertTrue(isset($returnedProperties[200]['{DAV:}group-membership']));
- $this->assertInstanceOf('Sabre\\DAV\\Property\\HrefList', $returnedProperties[200]['{DAV:}group-membership']);
-
- $this->assertEquals(array(), $returnedProperties[200]['{DAV:}group-membership']->getHrefs());
+ $this->assertEquals([], $result[200]['{DAV:}group-membership']->getHrefs());
}
function testGetDisplayName() {
- $tree = array(
- new DAV\SimpleCollection('principals', array(
+ $tree = [
+ new DAV\SimpleCollection('principals', [
$principal = new MockPrincipal('user','principals/user'),
- )),
- );
+ ]),
+ ];
$fakeServer = new DAV\Server($tree);
- //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend(),'realm');
- //$fakeServer->addPlugin($plugin);
$plugin = new Plugin();
$fakeServer->addPlugin($plugin);
- $requestedProperties = array(
+ $requestedProperties = [
'{DAV:}displayname',
- );
- $returnedProperties = array();
-
- $result = $plugin->beforeGetProperties('principals/user',$principal,$requestedProperties,$returnedProperties);
+ ];
- $this->assertNull($result);
+ $result = $fakeServer->getPropertiesForPath('principals/user', $requestedProperties);
+ $result = $result[0];
- $this->assertTrue(isset($returnedProperties[200]));
- $this->assertTrue(isset($returnedProperties[200]['{DAV:}displayname']));
+ $this->assertTrue(isset($result[200]));
+ $this->assertTrue(isset($result[200]['{DAV:}displayname']));
- $this->assertEquals('user', $returnedProperties[200]['{DAV:}displayname']);
+ $this->assertEquals('user', $result[200]['{DAV:}displayname']);
}
}
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php
index 53568654f..64cedd142 100644
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php
@@ -10,7 +10,7 @@ require_once 'Sabre/DAVACL/MockPrincipal.php';
class PluginUpdatePropertiesTest extends \PHPUnit_Framework_TestCase {
- public function testUpdatePropertiesPassthrough() {
+ function testUpdatePropertiesPassthrough() {
$tree = array(
new DAV\SimpleCollection('foo'),
@@ -23,17 +23,14 @@ class PluginUpdatePropertiesTest extends \PHPUnit_Framework_TestCase {
));
$expected = array(
- 'href' => 'foo',
- '403' => array(
- '{DAV:}foo' => null,
- ),
+ '{DAV:}foo' => 403,
);
$this->assertEquals($expected, $result);
}
- public function testRemoveGroupMembers() {
+ function testRemoveGroupMembers() {
$tree = array(
new MockPrincipal('foo','foo'),
@@ -46,10 +43,7 @@ class PluginUpdatePropertiesTest extends \PHPUnit_Framework_TestCase {
));
$expected = array(
- 'href' => 'foo',
- '200' => array(
- '{DAV:}group-member-set' => null,
- ),
+ '{DAV:}group-member-set' => 204
);
$this->assertEquals($expected, $result);
@@ -57,34 +51,31 @@ class PluginUpdatePropertiesTest extends \PHPUnit_Framework_TestCase {
}
- public function testSetGroupMembers() {
+ function testSetGroupMembers() {
- $tree = array(
+ $tree = [
new MockPrincipal('foo','foo'),
- );
+ ];
$server = new DAV\Server($tree);
$server->addPlugin(new Plugin());
- $result = $server->updateProperties('foo', array(
- '{DAV:}group-member-set' => new DAV\Property\HrefList(array('/bar','/baz'), true),
- ));
+ $result = $server->updateProperties('foo', [
+ '{DAV:}group-member-set' => new DAV\Xml\Property\Href(['/bar','/baz'], true),
+ ]);
- $expected = array(
- 'href' => 'foo',
- '200' => array(
- '{DAV:}group-member-set' => null,
- ),
- );
+ $expected = [
+ '{DAV:}group-member-set' => 200
+ ];
$this->assertEquals($expected, $result);
- $this->assertEquals(array('bar','baz'),$tree[0]->getGroupMemberSet());
+ $this->assertEquals(['bar', 'baz'],$tree[0]->getGroupMemberSet());
}
/**
* @expectedException Sabre\DAV\Exception
*/
- public function testSetBadValue() {
+ function testSetBadValue() {
$tree = array(
new MockPrincipal('foo','foo'),
@@ -98,28 +89,21 @@ class PluginUpdatePropertiesTest extends \PHPUnit_Framework_TestCase {
}
- public function testSetBadNode() {
+ function testSetBadNode() {
- $tree = array(
+ $tree = [
new DAV\SimpleCollection('foo'),
- );
+ ];
$server = new DAV\Server($tree);
$server->addPlugin(new Plugin());
- $result = $server->updateProperties('foo', array(
- '{DAV:}group-member-set' => new DAV\Property\HrefList(array('/bar','/baz'),false),
- '{DAV:}bar' => 'baz',
- ));
+ $result = $server->updateProperties('foo', [
+ '{DAV:}group-member-set' => new DAV\Xml\Property\Href(['/bar','/baz'],false),
+ ]);
- $expected = array(
- 'href' => 'foo',
- '403' => array(
- '{DAV:}group-member-set' => null,
- ),
- '424' => array(
- '{DAV:}bar' => null,
- ),
- );
+ $expected = [
+ '{DAV:}group-member-set' => 403,
+ ];
$this->assertEquals($expected, $result);
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php
index 3fe75ca0e..3814ebc0d 100644
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php
@@ -128,10 +128,12 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$pdo = $this->getPDO();
$backend = new PDO($pdo);
- $result = $backend->updatePrincipal('principals/user', array(
+ $propPatch = new DAV\PropPatch([
'{DAV:}displayname' => 'pietje',
- '{http://sabredav.org/ns}vcard-url' => 'blabla',
- ));
+ ]);
+
+ $backend->updatePrincipal('principals/user', $propPatch);
+ $result = $propPatch->commit();
$this->assertTrue($result);
@@ -139,7 +141,6 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
'id' => 1,
'uri' => 'principals/user',
'{DAV:}displayname' => 'pietje',
- '{http://sabredav.org/ns}vcard-url' => 'blabla',
'{http://sabredav.org/ns}email-address' => 'user@example.org',
), $backend->getPrincipalByPath('principals/user'));
@@ -150,21 +151,20 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$pdo = $this->getPDO();
$backend = new PDO($pdo);
- $result = $backend->updatePrincipal('principals/user', array(
+ $propPatch = new DAV\PropPatch([
'{DAV:}displayname' => 'pietje',
- '{http://sabredav.org/ns}vcard-url' => 'blabla',
'{DAV:}unknown' => 'foo',
- ));
+ ]);
+
+ $backend->updatePrincipal('principals/user', $propPatch);
+ $result = $propPatch->commit();
+
+ $this->assertFalse($result);
$this->assertEquals(array(
- 424 => array(
- '{DAV:}displayname' => null,
- '{http://sabredav.org/ns}vcard-url' => null,
- ),
- 403 => array(
- '{DAV:}unknown' => null,
- ),
- ), $result);
+ '{DAV:}displayname' => 424,
+ '{DAV:}unknown' => 403
+ ), $propPatch->getResult());
$this->assertEquals(array(
'id' => '1',
@@ -175,4 +175,24 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
}
+ function testFindByUriUnknownScheme() {
+
+ $pdo = $this->getPDO();
+ $backend = new PDO($pdo);
+ $this->assertNull($backend->findByUri('http://foo', 'principals'));
+
+ }
+
+
+ function testFindByUri() {
+
+ $pdo = $this->getPDO();
+ $backend = new PDO($pdo);
+ $this->assertEquals(
+ 'principals/user',
+ $backend->findByUri('mailto:user@example.org', 'principals')
+ );
+
+ }
+
}
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/Mock.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/Mock.php
index 354446e34..afb094a39 100644
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/Mock.php
+++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/Mock.php
@@ -4,40 +4,46 @@ namespace Sabre\DAVACL\PrincipalBackend;
class Mock extends AbstractBackend {
- public $groupMembers = array();
+ public $groupMembers = [];
public $principals;
- function __construct() {
+ function __construct(array $principals = null) {
- $this->principals = array(
- array(
- 'uri' => 'principals/user1',
- '{DAV:}displayname' => 'User 1',
+ $this->principals = $principals;
+
+ if (is_null($principals)) {
+
+ $this->principals = [
+ [
+ 'uri' => 'principals/user1',
+ '{DAV:}displayname' => 'User 1',
'{http://sabredav.org/ns}email-address' => 'user1.sabredav@sabredav.org',
- '{http://sabredav.org/ns}vcard-url' => 'addressbooks/user1/book1/vcard1.vcf',
- ),
- array(
- 'uri' => 'principals/admin',
+ '{http://sabredav.org/ns}vcard-url' => 'addressbooks/user1/book1/vcard1.vcf',
+ ],
+ [
+ 'uri' => 'principals/admin',
'{DAV:}displayname' => 'Admin',
- ),
- array(
- 'uri' => 'principals/user2',
- '{DAV:}displayname' => 'User 2',
+ ],
+ [
+ 'uri' => 'principals/user2',
+ '{DAV:}displayname' => 'User 2',
'{http://sabredav.org/ns}email-address' => 'user2.sabredav@sabredav.org',
- ),
- );
+ ],
+ ];
+ }
}
function getPrincipalsByPrefix($prefix) {
- $prefix = trim($prefix,'/') . '/';
- $return = array();
+ $prefix = trim($prefix, '/');
+ if ($prefix) $prefix .= '/';
+ $return = [];
- foreach($this->principals as $principal) {
+ foreach ($this->principals as $principal) {
- if (strpos($principal['uri'], $prefix)!==0) continue;
+ if ($prefix && strpos($principal['uri'], $prefix) !== 0) continue;
$return[] = $principal;
@@ -55,26 +61,33 @@ class Mock extends AbstractBackend {
function getPrincipalByPath($path) {
- foreach($this->getPrincipalsByPrefix('principals') as $principal) {
+ foreach ($this->getPrincipalsByPrefix('principals') as $principal) {
if ($principal['uri'] === $path) return $principal;
}
}
- function searchPrincipals($prefixPath, array $searchProperties) {
+ function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof') {
- $matches = array();
- foreach($this->getPrincipalsByPrefix($prefixPath) as $principal) {
+ $matches = [];
+ foreach ($this->getPrincipalsByPrefix($prefixPath) as $principal) {
- foreach($searchProperties as $key=>$value) {
+ foreach ($searchProperties as $key => $value) {
if (!isset($principal[$key])) {
continue 2;
}
- if (mb_stripos($principal[$key],$value, 0, 'UTF-8')===false) {
+ if (mb_stripos($principal[$key], $value, 0, 'UTF-8') === false) {
continue 2;
}
+ // We have a match for this searchProperty!
+ if ($test === 'allof') {
+ continue;
+ } else {
+ break;
+ }
+
}
$matches[] = $principal['uri'];
@@ -85,14 +98,14 @@ class Mock extends AbstractBackend {
function getGroupMemberSet($path) {
- return isset($this->groupMembers[$path]) ? $this->groupMembers[$path] : array();
+ return isset($this->groupMembers[$path]) ? $this->groupMembers[$path] : [];
}
function getGroupMembership($path) {
- $membership = array();
- foreach($this->groupMembers as $group=>$members) {
+ $membership = [];
+ foreach ($this->groupMembers as $group => $members) {
if (in_array($path, $members)) $membership[] = $group;
}
return $membership;
@@ -108,75 +121,46 @@ class Mock extends AbstractBackend {
/**
* Updates one ore more webdav properties on a principal.
*
- * The list of mutations is supplied as an array. Each key in the array is
- * a propertyname, such as {DAV:}displayname.
- *
- * Each value is the actual value to be updated. If a value is null, it
- * must be deleted.
- *
- * This method should be atomic. It must either completely succeed, or
- * completely fail. Success and failure can simply be returned as 'true' or
- * 'false'.
- *
- * It is also possible to return detailed failure information. In that case
- * an array such as this should be returned:
+ * The list of mutations is stored in a Sabre\DAV\PropPatch object.
+ * To do the actual updates, you must tell this object which properties
+ * you're going to process with the handle() method.
*
- * array(
- * 200 => array(
- * '{DAV:}prop1' => null,
- * ),
- * 201 => array(
- * '{DAV:}prop2' => null,
- * ),
- * 403 => array(
- * '{DAV:}prop3' => null,
- * ),
- * 424 => array(
- * '{DAV:}prop4' => null,
- * ),
- * );
+ * Calling the handle method is like telling the PropPatch object "I
+ * promise I can handle updating this property".
*
- * In this previous example prop1 was successfully updated or deleted, and
- * prop2 was succesfully created.
- *
- * prop3 failed to update due to '403 Forbidden' and because of this prop4
- * also could not be updated with '424 Failed dependency'.
- *
- * This last example was actually incorrect. While 200 and 201 could appear
- * in 1 response, if there's any error (403) the other properties should
- * always fail with 423 (failed dependency).
- *
- * But anyway, if you don't want to scratch your head over this, just
- * return true or false.
+ * Read the PropPatch documenation for more info and examples.
*
* @param string $path
- * @param array $mutations
- * @return array|bool
+ * @param \Sabre\DAV\PropPatch $propPatch
*/
- public function updatePrincipal($path, $mutations) {
+ function updatePrincipal($path, \Sabre\DAV\PropPatch $propPatch) {
$value = null;
- foreach($this->principals as $principalIndex=>$value) {
+ foreach ($this->principals as $principalIndex => $value) {
if ($value['uri'] === $path) {
$principal = $value;
break;
}
}
- if (!$principal) return false;
+ if (!$principal) return;
+
+ $propPatch->handleRemaining(function($mutations) use ($principal, $principalIndex) {
- foreach($mutations as $prop=>$value) {
+ foreach ($mutations as $prop => $value) {
+
+ if (is_null($value) && isset($principal[$prop])) {
+ unset($principal[$prop]);
+ } else {
+ $principal[$prop] = $value;
+ }
- if (is_null($value) && isset($principal[$prop])) {
- unset($principal[$prop]);
- } else {
- $principal[$prop] = $value;
}
- }
+ $this->principals[$principalIndex] = $principal;
- $this->principals[$principalIndex] = $principal;
+ return true;
- return true;
+ });
}
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOMySQLTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOMySQLTest.php
index 84ba062ca..83353c86c 100644
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOMySQLTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOMySQLTest.php
@@ -16,25 +16,30 @@ class PDOMySQLTest extends AbstractPDOTest {
$pdo = \Sabre\TestUtil::getMySQLDB();
if (!$pdo) $this->markTestSkipped('Could not connect to MySQL database');
$pdo->query("DROP TABLE IF EXISTS principals");
- $pdo->query("
+ $pdo->query(<<<SQL
create table principals (
- id integer unsigned not null primary key auto_increment,
- uri varchar(50),
- email varchar(80),
- displayname VARCHAR(80),
- vcardurl VARCHAR(80),
- unique(uri)
-);");
+ id integer unsigned not null primary key auto_increment,
+ uri varchar(50),
+ email varchar(80),
+ displayname VARCHAR(80),
+ vcardurl VARCHAR(80),
+ unique(uri)
+)
+SQL
+ );
$pdo->query("INSERT INTO principals (uri,email,displayname) VALUES ('principals/user','user@example.org','User')");
$pdo->query("INSERT INTO principals (uri,email,displayname) VALUES ('principals/group','group@example.org','Group')");
$pdo->query("DROP TABLE IF EXISTS groupmembers");
- $pdo->query("CREATE TABLE groupmembers (
- id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
- principal_id INTEGER UNSIGNED NOT NULL,
- member_id INTEGER UNSIGNED NOT NULL,
- UNIQUE(principal_id, member_id)
- );");
+ $pdo->query(<<<SQL
+CREATE TABLE groupmembers (
+ id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ principal_id INTEGER UNSIGNED NOT NULL,
+ member_id INTEGER UNSIGNED NOT NULL,
+ UNIQUE(principal_id, member_id)
+)
+SQL
+ );
$pdo->query("INSERT INTO groupmembers (principal_id,member_id) VALUES (2,1)");
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOSqliteTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOSqliteTest.php
index 192e188f9..f335ed51f 100644
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOSqliteTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOSqliteTest.php
@@ -22,16 +22,19 @@ class PDOSQLiteTest extends AbstractPDOTest {
if (!SABRE_HASSQLITE) $this->markTestSkipped('SQLite driver is not available');
$pdo = new \PDO('sqlite:'.SABRE_TEMPDIR.'/pdobackend');
$pdo->setAttribute(\PDO::ATTR_ERRMODE,\PDO::ERRMODE_EXCEPTION);
- $pdo->query('CREATE TABLE principals (id INTEGER PRIMARY KEY ASC, uri TEXT, email VARCHAR(80), displayname VARCHAR(80), vcardurl VARCHAR(80))');
- $pdo->query('INSERT INTO principals VALUES (1, "principals/user","user@example.org","User",null)');
- $pdo->query('INSERT INTO principals VALUES (2, "principals/group","group@example.org","Group",null)');
-
- $pdo->query("CREATE TABLE groupmembers (
- id INTEGER PRIMARY KEY ASC,
- principal_id INT,
- member_id INT,
- UNIQUE(principal_id, member_id)
- );");
+ $pdo->query('CREATE TABLE principals (id INTEGER PRIMARY KEY ASC, uri TEXT, email VARCHAR(80), displayname VARCHAR(80))');
+ $pdo->query('INSERT INTO principals VALUES (1, "principals/user","user@example.org","User")');
+ $pdo->query('INSERT INTO principals VALUES (2, "principals/group","group@example.org","Group")');
+
+ $pdo->query(<<<SQL
+CREATE TABLE groupmembers (
+ id INTEGER PRIMARY KEY ASC,
+ principal_id INT,
+ member_id INT,
+ UNIQUE(principal_id, member_id)
+)
+SQL
+ );
$pdo->query("INSERT INTO groupmembers (principal_id,member_id) VALUES (2,1)");
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalCollectionTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalCollectionTest.php
index 10b0c04da..f51d2dcce 100644
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalCollectionTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalCollectionTest.php
@@ -49,4 +49,13 @@ class PrincipalCollectionTest extends \PHPUnit_Framework_TestCase {
}
+ public function testFindByUri() {
+
+ $backend = new PrincipalBackend\Mock();
+ $pc = new PrincipalCollection($backend);
+ $this->assertEquals('principals/user1', $pc->findByUri('mailto:user1.sabredav@sabredav.org'));
+ $this->assertNull($pc->findByUri('mailto:fake.user.sabredav@sabredav.org'));
+ $this->assertNull($pc->findByUri(''));
+ }
+
}
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php
index 9c3be4f9a..8e4c86782 100644
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php
@@ -17,10 +17,11 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase {
$principals = new PrincipalCollection($backend);
$dir->addChild($principals);
- $fakeServer = new DAV\Server(new DAV\ObjectTree($dir));
+ $fakeServer = new DAV\Server($dir);
+ $fakeServer->sapi = new HTTP\SapiMock();
$fakeServer->httpResponse = new HTTP\ResponseMock();
$fakeServer->debugExceptions = true;
- $plugin = new MockPlugin($backend,'realm');
+ $plugin = new MockPlugin();
$plugin->allowAccessToNodesWithoutACL = true;
$this->assertTrue($plugin instanceof Plugin);
@@ -53,7 +54,7 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase {
'REQUEST_URI' => '/principals',
);
- $request = new HTTP\Request($serverVars);
+ $request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody($xml);
$server = $this->getServer();
@@ -61,10 +62,11 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase {
$server->exec();
- $this->assertEquals('HTTP/1.1 400 Bad request', $server->httpResponse->status);
+ $this->assertEquals(400, $server->httpResponse->getStatus(), $server->httpResponse->getBodyAsString());
$this->assertEquals(array(
- 'Content-Type' => 'application/xml; charset=utf-8',
- ), $server->httpResponse->headers);
+ 'X-Sabre-Version' => [DAV\Version::VERSION],
+ 'Content-Type' => ['application/xml; charset=utf-8'],
+ ), $server->httpResponse->getHeaders());
}
@@ -91,7 +93,7 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase {
'REQUEST_URI' => '/principals',
);
- $request = new HTTP\Request($serverVars);
+ $request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody($xml);
$server = $this->getServer();
@@ -99,11 +101,12 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase {
$server->exec();
- $this->assertEquals('HTTP/1.1 207 Multi-Status', $server->httpResponse->status);
+ $this->assertEquals(207, $server->httpResponse->getStatus(), "Full body: " . $server->httpResponse->getBodyAsString());
$this->assertEquals(array(
- 'Content-Type' => 'application/xml; charset=utf-8',
- 'Vary' => 'Brief,Prefer',
- ), $server->httpResponse->headers);
+ 'X-Sabre-Version' => [DAV\Version::VERSION],
+ 'Content-Type' => ['application/xml; charset=utf-8'],
+ 'Vary' => ['Brief,Prefer'],
+ ), $server->httpResponse->getHeaders());
}
@@ -130,7 +133,7 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase {
'REQUEST_URI' => '/',
);
- $request = new HTTP\Request($serverVars);
+ $request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody($xml);
$server = $this->getServer();
@@ -138,11 +141,157 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase {
$server->exec();
- $this->assertEquals('HTTP/1.1 207 Multi-Status', $server->httpResponse->status, $server->httpResponse->body);
+ $this->assertEquals(207, $server->httpResponse->status, $server->httpResponse->body);
$this->assertEquals(array(
- 'Content-Type' => 'application/xml; charset=utf-8',
- 'Vary' => 'Brief,Prefer',
- ), $server->httpResponse->headers);
+ 'X-Sabre-Version' => [DAV\Version::VERSION],
+ 'Content-Type' => ['application/xml; charset=utf-8'],
+ 'Vary' => ['Brief,Prefer'],
+ ), $server->httpResponse->getHeaders());
+
+
+ $check = array(
+ '/d:multistatus',
+ '/d:multistatus/d:response' => 2,
+ '/d:multistatus/d:response/d:href' => 2,
+ '/d:multistatus/d:response/d:propstat' => 4,
+ '/d:multistatus/d:response/d:propstat/d:prop' => 4,
+ '/d:multistatus/d:response/d:propstat/d:prop/d:displayname' => 2,
+ '/d:multistatus/d:response/d:propstat/d:prop/d:getcontentlength' => 2,
+ '/d:multistatus/d:response/d:propstat/d:status' => 4,
+ );
+
+ $xml = simplexml_load_string($server->httpResponse->body);
+ $xml->registerXPathNamespace('d','DAV:');
+ foreach($check as $v1=>$v2) {
+
+ $xpath = is_int($v1)?$v2:$v1;
+
+ $result = $xml->xpath($xpath);
+
+ $count = 1;
+ if (!is_int($v1)) $count = $v2;
+
+ $this->assertEquals($count,count($result), 'we expected ' . $count . ' appearances of ' . $xpath . ' . We found ' . count($result) . '. Full response body: ' . $server->httpResponse->body);
+
+ }
+
+ }
+
+ function testAND() {
+
+ $xml = '<?xml version="1.0"?>
+<d:principal-property-search xmlns:d="DAV:">
+ <d:apply-to-principal-collection-set />
+ <d:property-search>
+ <d:prop>
+ <d:displayname />
+ </d:prop>
+ <d:match>user</d:match>
+ </d:property-search>
+ <d:property-search>
+ <d:prop>
+ <d:foo />
+ </d:prop>
+ <d:match>bar</d:match>
+ </d:property-search>
+ <d:prop>
+ <d:displayname />
+ <d:getcontentlength />
+ </d:prop>
+</d:principal-property-search>';
+
+ $serverVars = array(
+ 'REQUEST_METHOD' => 'REPORT',
+ 'HTTP_DEPTH' => '0',
+ 'REQUEST_URI' => '/',
+ );
+
+ $request = HTTP\Sapi::createFromServerArray($serverVars);
+ $request->setBody($xml);
+
+ $server = $this->getServer();
+ $server->httpRequest = $request;
+
+ $server->exec();
+
+ $this->assertEquals(207, $server->httpResponse->status, $server->httpResponse->body);
+ $this->assertEquals(array(
+ 'X-Sabre-Version' => [DAV\Version::VERSION],
+ 'Content-Type' => ['application/xml; charset=utf-8'],
+ 'Vary' => ['Brief,Prefer'],
+ ), $server->httpResponse->getHeaders());
+
+
+ $check = array(
+ '/d:multistatus',
+ '/d:multistatus/d:response' => 0,
+ '/d:multistatus/d:response/d:href' => 0,
+ '/d:multistatus/d:response/d:propstat' => 0,
+ '/d:multistatus/d:response/d:propstat/d:prop' => 0,
+ '/d:multistatus/d:response/d:propstat/d:prop/d:displayname' => 0,
+ '/d:multistatus/d:response/d:propstat/d:prop/d:getcontentlength' => 0,
+ '/d:multistatus/d:response/d:propstat/d:status' => 0,
+ );
+
+ $xml = simplexml_load_string($server->httpResponse->body);
+ $xml->registerXPathNamespace('d','DAV:');
+ foreach($check as $v1=>$v2) {
+
+ $xpath = is_int($v1)?$v2:$v1;
+
+ $result = $xml->xpath($xpath);
+
+ $count = 1;
+ if (!is_int($v1)) $count = $v2;
+
+ $this->assertEquals($count,count($result), 'we expected ' . $count . ' appearances of ' . $xpath . ' . We found ' . count($result) . '. Full response body: ' . $server->httpResponse->body);
+
+ }
+
+ }
+ function testOR() {
+
+ $xml = '<?xml version="1.0"?>
+<d:principal-property-search xmlns:d="DAV:" test="anyof">
+ <d:apply-to-principal-collection-set />
+ <d:property-search>
+ <d:prop>
+ <d:displayname />
+ </d:prop>
+ <d:match>user</d:match>
+ </d:property-search>
+ <d:property-search>
+ <d:prop>
+ <d:foo />
+ </d:prop>
+ <d:match>bar</d:match>
+ </d:property-search>
+ <d:prop>
+ <d:displayname />
+ <d:getcontentlength />
+ </d:prop>
+</d:principal-property-search>';
+
+ $serverVars = array(
+ 'REQUEST_METHOD' => 'REPORT',
+ 'HTTP_DEPTH' => '0',
+ 'REQUEST_URI' => '/',
+ );
+
+ $request = HTTP\Sapi::createFromServerArray($serverVars);
+ $request->setBody($xml);
+
+ $server = $this->getServer();
+ $server->httpRequest = $request;
+
+ $server->exec();
+
+ $this->assertEquals(207, $server->httpResponse->status, $server->httpResponse->body);
+ $this->assertEquals(array(
+ 'X-Sabre-Version' => [DAV\Version::VERSION],
+ 'Content-Type' => ['application/xml; charset=utf-8'],
+ 'Vary' => ['Brief,Prefer'],
+ ), $server->httpResponse->getHeaders());
$check = array(
@@ -194,7 +343,7 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase {
'REQUEST_URI' => '/',
);
- $request = new HTTP\Request($serverVars);
+ $request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody($xml);
$server = $this->getServer();
@@ -202,11 +351,12 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase {
$server->exec();
- $this->assertEquals('HTTP/1.1 207 Multi-Status', $server->httpResponse->status, $server->httpResponse->body);
+ $this->assertEquals(207, $server->httpResponse->status, $server->httpResponse->body);
$this->assertEquals(array(
- 'Content-Type' => 'application/xml; charset=utf-8',
- 'Vary' => 'Brief,Prefer',
- ), $server->httpResponse->headers);
+ 'X-Sabre-Version' => [DAV\Version::VERSION],
+ 'Content-Type' => ['application/xml; charset=utf-8'],
+ 'Vary' => ['Brief,Prefer'],
+ ), $server->httpResponse->getHeaders());
$check = array(
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php
index 412389e8b..952dc174a 100644
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php
@@ -17,9 +17,10 @@ class PrincipalSearchPropertySetTest extends \PHPUnit_Framework_TestCase {
$principals = new PrincipalCollection($backend);
$dir->addChild($principals);
- $fakeServer = new DAV\Server(new DAV\ObjectTree($dir));
+ $fakeServer = new DAV\Server($dir);
+ $fakeServer->sapi = new HTTP\SapiMock();
$fakeServer->httpResponse = new HTTP\ResponseMock();
- $plugin = new Plugin($backend,'realm');
+ $plugin = new Plugin();
$this->assertTrue($plugin instanceof Plugin);
$fakeServer->addPlugin($plugin);
$this->assertEquals($plugin, $fakeServer->getPlugin('acl'));
@@ -39,7 +40,7 @@ class PrincipalSearchPropertySetTest extends \PHPUnit_Framework_TestCase {
'REQUEST_URI' => '/principals',
);
- $request = new HTTP\Request($serverVars);
+ $request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody($xml);
$server = $this->getServer();
@@ -47,10 +48,11 @@ class PrincipalSearchPropertySetTest extends \PHPUnit_Framework_TestCase {
$server->exec();
- $this->assertEquals('HTTP/1.1 400 Bad request', $server->httpResponse->status);
+ $this->assertEquals(400, $server->httpResponse->status);
$this->assertEquals(array(
- 'Content-Type' => 'application/xml; charset=utf-8',
- ), $server->httpResponse->headers);
+ 'X-Sabre-Version' => [DAV\Version::VERSION],
+ 'Content-Type' => ['application/xml; charset=utf-8'],
+ ), $server->httpResponse->getHeaders());
}
@@ -65,7 +67,7 @@ class PrincipalSearchPropertySetTest extends \PHPUnit_Framework_TestCase {
'REQUEST_URI' => '/principals',
);
- $request = new HTTP\Request($serverVars);
+ $request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody($xml);
$server = $this->getServer();
@@ -73,10 +75,11 @@ class PrincipalSearchPropertySetTest extends \PHPUnit_Framework_TestCase {
$server->exec();
- $this->assertEquals('HTTP/1.1 400 Bad request', $server->httpResponse->status, $server->httpResponse->body);
+ $this->assertEquals(400, $server->httpResponse->status, $server->httpResponse->body);
$this->assertEquals(array(
- 'Content-Type' => 'application/xml; charset=utf-8',
- ), $server->httpResponse->headers);
+ 'X-Sabre-Version' => [DAV\Version::VERSION],
+ 'Content-Type' => ['application/xml; charset=utf-8'],
+ ), $server->httpResponse->getHeaders());
}
@@ -91,7 +94,7 @@ class PrincipalSearchPropertySetTest extends \PHPUnit_Framework_TestCase {
'REQUEST_URI' => '/principals',
);
- $request = new HTTP\Request($serverVars);
+ $request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody($xml);
$server = $this->getServer();
@@ -99,10 +102,11 @@ class PrincipalSearchPropertySetTest extends \PHPUnit_Framework_TestCase {
$server->exec();
- $this->assertEquals('HTTP/1.1 200 OK', $server->httpResponse->status, $server->httpResponse->body);
+ $this->assertEquals(200, $server->httpResponse->status, $server->httpResponse->body);
$this->assertEquals(array(
- 'Content-Type' => 'application/xml; charset=utf-8',
- ), $server->httpResponse->headers);
+ 'X-Sabre-Version' => [DAV\Version::VERSION],
+ 'Content-Type' => ['application/xml; charset=utf-8'],
+ ), $server->httpResponse->getHeaders());
$check = array(
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalTest.php
index 2d4371138..03fd9d64d 100644
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalTest.php
@@ -75,8 +75,12 @@ class PrincipalTest extends \PHPUnit_Framework_TestCase {
$principalBackend = new PrincipalBackend\Mock();
$principal = new Principal($principalBackend, array('uri' => 'principals/admin'));
- $result = $principal->updateProperties(array('{DAV:}yourmom'=>'test'));
- $this->assertEquals(true,$result);
+
+ $propPatch = new DAV\PropPatch(array('{DAV:}yourmom' => 'test'));
+
+ $result = $principal->propPatch($propPatch);
+ $result = $propPatch->commit();
+ $this->assertTrue($result);
}
@@ -175,7 +179,7 @@ class PrincipalTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals(array(
array(
'privilege' => '{DAV:}read',
- 'principal' => 'principals/admin',
+ 'principal' => '{DAV:}authenticated',
'protected' => true,
)
),$principal->getACL());
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/Property/ACLRestrictionsTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/Property/ACLRestrictionsTest.php
deleted file mode 100644
index 72a2f36a4..000000000
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/Property/ACLRestrictionsTest.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-namespace Sabre\DAVACL\Property;
-
-use Sabre\DAV;
-use Sabre\HTTP;
-
-class ACLRestrictionsTest extends \PHPUnit_Framework_TestCase {
-
- function testConstruct() {
-
- $prop = new AclRestrictions();
-
- }
-
- function testSerializeEmpty() {
-
- $dom = new \DOMDocument('1.0');
- $root = $dom->createElementNS('DAV:','d:root');
-
- $dom->appendChild($root);
-
- $acl = new AclRestrictions();
- $acl->serialize(new DAV\Server(), $root);
-
- $xml = $dom->saveXML();
- $expected = '<?xml version="1.0"?>
-<d:root xmlns:d="DAV:"><d:grant-only/><d:no-invert/></d:root>
-';
- $this->assertEquals($expected, $xml);
-
- }
-
-
-}
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/Property/ACLTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/Property/ACLTest.php
deleted file mode 100644
index 7f2014df3..000000000
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/Property/ACLTest.php
+++ /dev/null
@@ -1,335 +0,0 @@
-<?php
-
-namespace Sabre\DAVACL\Property;
-
-use Sabre\DAV;
-use Sabre\HTTP;
-
-
-class ACLTest extends \PHPUnit_Framework_TestCase {
-
- function testConstruct() {
-
- $acl = new Acl(array());
-
- }
-
- function testSerializeEmpty() {
-
- $dom = new \DOMDocument('1.0');
- $root = $dom->createElementNS('DAV:','d:root');
-
- $dom->appendChild($root);
-
- $acl = new Acl(array());
- $acl->serialize(new DAV\Server(), $root);
-
- $xml = $dom->saveXML();
- $expected = '<?xml version="1.0"?>
-<d:root xmlns:d="DAV:"/>
-';
- $this->assertEquals($expected, $xml);
-
- }
-
- function testSerialize() {
-
- $dom = new \DOMDocument('1.0');
- $root = $dom->createElementNS('DAV:','d:root');
-
- $dom->appendChild($root);
-
- $privileges = array(
- array(
- 'principal' => 'principals/evert',
- 'privilege' => '{DAV:}write',
- 'uri' => 'articles',
- ),
- array(
- 'principal' => 'principals/foo',
- 'privilege' => '{DAV:}read',
- 'uri' => 'articles',
- 'protected' => true,
- ),
- );
-
- $acl = new Acl($privileges);
- $acl->serialize(new DAV\Server(), $root);
-
- $dom->formatOutput = true;
-
- $xml = $dom->saveXML();
- $expected = '<?xml version="1.0"?>
-<d:root xmlns:d="DAV:">
- <d:ace>
- <d:principal>
- <d:href>/principals/evert/</d:href>
- </d:principal>
- <d:grant>
- <d:privilege>
- <d:write/>
- </d:privilege>
- </d:grant>
- </d:ace>
- <d:ace>
- <d:principal>
- <d:href>/principals/foo/</d:href>
- </d:principal>
- <d:grant>
- <d:privilege>
- <d:read/>
- </d:privilege>
- </d:grant>
- <d:protected/>
- </d:ace>
-</d:root>
-';
- $this->assertEquals($expected, $xml);
-
- }
-
- function testSerializeSpecialPrincipals() {
-
- $dom = new \DOMDocument('1.0');
- $root = $dom->createElementNS('DAV:','d:root');
-
- $dom->appendChild($root);
-
- $privileges = array(
- array(
- 'principal' => '{DAV:}authenticated',
- 'privilege' => '{DAV:}write',
- 'uri' => 'articles',
- ),
- array(
- 'principal' => '{DAV:}unauthenticated',
- 'privilege' => '{DAV:}write',
- 'uri' => 'articles',
- ),
- array(
- 'principal' => '{DAV:}all',
- 'privilege' => '{DAV:}write',
- 'uri' => 'articles',
- ),
-
- );
-
- $acl = new Acl($privileges);
- $acl->serialize(new DAV\Server(), $root);
-
- $dom->formatOutput = true;
-
- $xml = $dom->saveXML();
- $expected = '<?xml version="1.0"?>
-<d:root xmlns:d="DAV:">
- <d:ace>
- <d:principal>
- <d:authenticated/>
- </d:principal>
- <d:grant>
- <d:privilege>
- <d:write/>
- </d:privilege>
- </d:grant>
- </d:ace>
- <d:ace>
- <d:principal>
- <d:unauthenticated/>
- </d:principal>
- <d:grant>
- <d:privilege>
- <d:write/>
- </d:privilege>
- </d:grant>
- </d:ace>
- <d:ace>
- <d:principal>
- <d:all/>
- </d:principal>
- <d:grant>
- <d:privilege>
- <d:write/>
- </d:privilege>
- </d:grant>
- </d:ace>
-</d:root>
-';
- $this->assertEquals($expected, $xml);
-
- }
-
- function testUnserialize() {
-
- $source = '<?xml version="1.0"?>
-<d:root xmlns:d="DAV:">
- <d:ace>
- <d:principal>
- <d:href>/principals/evert/</d:href>
- </d:principal>
- <d:grant>
- <d:privilege>
- <d:write/>
- </d:privilege>
- </d:grant>
- </d:ace>
- <d:ace>
- <d:principal>
- <d:href>/principals/foo/</d:href>
- </d:principal>
- <d:grant>
- <d:privilege>
- <d:read/>
- </d:privilege>
- </d:grant>
- <d:protected/>
- </d:ace>
-</d:root>
-';
-
- $dom = DAV\XMLUtil::loadDOMDocument($source);
- $result = Acl::unserialize($dom->firstChild);
-
- $this->assertInstanceOf('Sabre\\DAVACL\\Property\\ACL', $result);
-
- $expected = array(
- array(
- 'principal' => '/principals/evert/',
- 'protected' => false,
- 'privilege' => '{DAV:}write',
- ),
- array(
- 'principal' => '/principals/foo/',
- 'protected' => true,
- 'privilege' => '{DAV:}read',
- ),
- );
-
- $this->assertEquals($expected, $result->getPrivileges());
-
-
- }
-
- /**
- * @expectedException Sabre\DAV\Exception\BadRequest
- */
- function testUnserializeNoPrincipal() {
-
- $source = '<?xml version="1.0"?>
-<d:root xmlns:d="DAV:">
- <d:ace>
- <d:grant>
- <d:privilege>
- <d:write/>
- </d:privilege>
- </d:grant>
- </d:ace>
-</d:root>
-';
-
- $dom = DAV\XMLUtil::loadDOMDocument($source);
- Acl::unserialize($dom->firstChild);
-
- }
-
- function testUnserializeOtherPrincipal() {
-
- $source = '<?xml version="1.0"?>
-<d:root xmlns:d="DAV:">
- <d:ace>
- <d:grant>
- <d:privilege>
- <d:write/>
- </d:privilege>
- </d:grant>
- <d:principal><d:authenticated /></d:principal>
- </d:ace>
- <d:ace>
- <d:grant>
- <d:privilege>
- <d:write/>
- </d:privilege>
- </d:grant>
- <d:principal><d:unauthenticated /></d:principal>
- </d:ace>
- <d:ace>
- <d:grant>
- <d:privilege>
- <d:write/>
- </d:privilege>
- </d:grant>
- <d:principal><d:all /></d:principal>
- </d:ace>
-</d:root>
-';
-
- $dom = DAV\XMLUtil::loadDOMDocument($source);
- $result = Acl::unserialize($dom->firstChild);
-
- $this->assertInstanceOf('Sabre\\DAVACL\\Property\\Acl', $result);
-
- $expected = array(
- array(
- 'principal' => '{DAV:}authenticated',
- 'protected' => false,
- 'privilege' => '{DAV:}write',
- ),
- array(
- 'principal' => '{DAV:}unauthenticated',
- 'protected' => false,
- 'privilege' => '{DAV:}write',
- ),
- array(
- 'principal' => '{DAV:}all',
- 'protected' => false,
- 'privilege' => '{DAV:}write',
- ),
- );
-
- $this->assertEquals($expected, $result->getPrivileges());
-
-
- }
-
- /**
- * @expectedException Sabre\DAV\Exception\NotImplemented
- */
- function testUnserializeDeny() {
-
- $source = '<?xml version="1.0"?>
-<d:root xmlns:d="DAV:">
- <d:ace>
- <d:deny>
- <d:privilege>
- <d:write/>
- </d:privilege>
- </d:deny>
- <d:principal><d:href>/principals/evert</d:href></d:principal>
- </d:ace>
-</d:root>
-';
-
- $dom = DAV\XMLUtil::loadDOMDocument($source);
- Acl::unserialize($dom->firstChild);
- }
-
- /**
- * @expectedException Sabre\DAV\Exception\BadRequest
- */
- function testUnserializeMissingPriv() {
-
- $source = '<?xml version="1.0"?>
-<d:root xmlns:d="DAV:">
- <d:ace>
- <d:grant>
- <d:privilege />
- </d:grant>
- <d:principal><d:href>/principals/evert</d:href></d:principal>
- </d:ace>
-</d:root>
-';
-
- $dom = DAV\XMLUtil::loadDOMDocument($source);
- Acl::unserialize($dom->firstChild);
-
- }
-}
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/Property/CurrentUserPrivilegeSetTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/Property/CurrentUserPrivilegeSetTest.php
deleted file mode 100644
index e71addb65..000000000
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/Property/CurrentUserPrivilegeSetTest.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-namespace Sabre\DAVACL\Property;
-
-use Sabre\DAV;
-use Sabre\HTTP;
-
-
-class CurrentUserPrivilegeSetTest extends \PHPUnit_Framework_TestCase {
-
- function testSerialize() {
-
- $privileges = array(
- '{DAV:}read',
- '{DAV:}write',
- );
- $prop = new CurrentUserPrivilegeSet($privileges);
-
- $server = new DAV\Server();
- $dom = new \DOMDocument('1.0','utf-8');
- $root = $dom->createElementNS('DAV:','d:root');
- $dom->appendChild($root);
-
- $prop->serialize($server, $root);
-
- $xpaths = array(
- '/d:root' => 1,
- '/d:root/d:privilege' => 2,
- '/d:root/d:privilege/d:read' => 1,
- '/d:root/d:privilege/d:write' => 1,
- );
-
- // Reloading because PHP DOM sucks
- $dom2 = new \DOMDocument('1.0', 'utf-8');
- $dom2->loadXML($dom->saveXML());
-
- $dxpath = new \DOMXPath($dom2);
- $dxpath->registerNamespace('d','DAV:');
- foreach($xpaths as $xpath=>$count) {
-
- $this->assertEquals($count, $dxpath->query($xpath)->length, 'Looking for : ' . $xpath . ', we could only find ' . $dxpath->query($xpath)->length . ' elements, while we expected ' . $count);
-
- }
-
- }
-
- function testUnserialize() {
-
- $source = '<?xml version="1.0"?>
-<d:root xmlns:d="DAV:">
- <d:privilege>
- <d:write-properties />
- </d:privilege>
- <d:privilege>
- <d:read />
- </d:privilege>
-</d:root>
-';
-
- $dom = DAV\XMLUtil::loadDOMDocument($source);
- $result = CurrentUserPrivilegeSet::unserialize($dom->firstChild, array());
- $this->assertTrue($result->has('{DAV:}read'));
- $this->assertTrue($result->has('{DAV:}write-properties'));
- $this->assertFalse($result->has('{DAV:}bind'));
-
- }
-
-}
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/Property/PrincipalTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/Property/PrincipalTest.php
deleted file mode 100644
index be12c79ee..000000000
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/Property/PrincipalTest.php
+++ /dev/null
@@ -1,181 +0,0 @@
-<?php
-
-namespace Sabre\DAVACL\Property;
-
-use Sabre\DAV;
-use Sabre\HTTP;
-
-class PrincipalTest extends \PHPUnit_Framework_TestCase {
-
- function testSimple() {
-
- $principal = new Principal(Principal::UNAUTHENTICATED);
- $this->assertEquals(Principal::UNAUTHENTICATED, $principal->getType());
- $this->assertNull($principal->getHref());
-
- $principal = new Principal(Principal::AUTHENTICATED);
- $this->assertEquals(Principal::AUTHENTICATED, $principal->getType());
- $this->assertNull($principal->getHref());
-
- $principal = new Principal(Principal::HREF,'admin');
- $this->assertEquals(Principal::HREF, $principal->getType());
- $this->assertEquals('admin',$principal->getHref());
-
- }
-
- /**
- * @depends testSimple
- * @expectedException Sabre\DAV\Exception
- */
- function testNoHref() {
-
- $principal = new Principal(Principal::HREF);
-
- }
-
- /**
- * @depends testSimple
- */
- function testSerializeUnAuthenticated() {
-
- $prin = new Principal(Principal::UNAUTHENTICATED);
-
- $doc = new \DOMDocument();
- $root = $doc->createElement('d:principal');
- $root->setAttribute('xmlns:d','DAV:');
-
- $doc->appendChild($root);
- $objectTree = new DAV\ObjectTree(new DAV\SimpleCollection('rootdir'));
- $server = new DAV\Server($objectTree);
-
- $prin->serialize($server, $root);
-
- $xml = $doc->saveXML();
-
- $this->assertEquals(
-'<?xml version="1.0"?>
-<d:principal xmlns:d="DAV:">' .
-'<d:unauthenticated/>' .
-'</d:principal>
-', $xml);
-
- }
-
-
- /**
- * @depends testSerializeUnAuthenticated
- */
- function testSerializeAuthenticated() {
-
- $prin = new Principal(Principal::AUTHENTICATED);
-
- $doc = new \DOMDocument();
- $root = $doc->createElement('d:principal');
- $root->setAttribute('xmlns:d','DAV:');
-
- $doc->appendChild($root);
- $objectTree = new DAV\ObjectTree(new DAV\SimpleCollection('rootdir'));
- $server = new DAV\Server($objectTree);
-
- $prin->serialize($server, $root);
-
- $xml = $doc->saveXML();
-
- $this->assertEquals(
-'<?xml version="1.0"?>
-<d:principal xmlns:d="DAV:">' .
-'<d:authenticated/>' .
-'</d:principal>
-', $xml);
-
- }
-
-
- /**
- * @depends testSerializeUnAuthenticated
- */
- function testSerializeHref() {
-
- $prin = new Principal(Principal::HREF,'principals/admin');
-
- $doc = new \DOMDocument();
- $root = $doc->createElement('d:principal');
- $root->setAttribute('xmlns:d','DAV:');
-
- $doc->appendChild($root);
- $objectTree = new DAV\ObjectTree(new DAV\SimpleCollection('rootdir'));
- $server = new DAV\Server($objectTree);
-
- $prin->serialize($server, $root);
-
- $xml = $doc->saveXML();
-
- $this->assertEquals(
-'<?xml version="1.0"?>
-<d:principal xmlns:d="DAV:">' .
-'<d:href>/principals/admin</d:href>' .
-'</d:principal>
-', $xml);
-
- }
-
- function testUnserializeHref() {
-
- $xml = '<?xml version="1.0"?>
-<d:principal xmlns:d="DAV:">' .
-'<d:href>/principals/admin</d:href>' .
-'</d:principal>';
-
- $dom = DAV\XMLUtil::loadDOMDocument($xml);
-
- $principal = Principal::unserialize($dom->firstChild);
- $this->assertEquals(Principal::HREF, $principal->getType());
- $this->assertEquals('/principals/admin', $principal->getHref());
-
- }
-
- function testUnserializeAuthenticated() {
-
- $xml = '<?xml version="1.0"?>
-<d:principal xmlns:d="DAV:">' .
-' <d:authenticated />' .
-'</d:principal>';
-
- $dom = DAV\XMLUtil::loadDOMDocument($xml);
-
- $principal = Principal::unserialize($dom->firstChild);
- $this->assertEquals(Principal::AUTHENTICATED, $principal->getType());
-
- }
-
- function testUnserializeUnauthenticated() {
-
- $xml = '<?xml version="1.0"?>
-<d:principal xmlns:d="DAV:">' .
-' <d:unauthenticated />' .
-'</d:principal>';
-
- $dom = DAV\XMLUtil::loadDOMDocument($xml);
-
- $principal = Principal::unserialize($dom->firstChild);
- $this->assertEquals(Principal::UNAUTHENTICATED, $principal->getType());
-
- }
-
- /**
- * @expectedException Sabre\DAV\Exception\BadRequest
- */
- function testUnserializeUnknown() {
-
- $xml = '<?xml version="1.0"?>
-<d:principal xmlns:d="DAV:">' .
-' <d:foo />' .
-'</d:principal>';
-
- $dom = DAV\XMLUtil::loadDOMDocument($xml);
-
- Principal::unserialize($dom->firstChild);
-
- }
-
-}
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/Property/SupportedPrivilegeSetTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/Property/SupportedPrivilegeSetTest.php
deleted file mode 100644
index 943316331..000000000
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/Property/SupportedPrivilegeSetTest.php
+++ /dev/null
@@ -1,106 +0,0 @@
-<?php
-
-namespace Sabre\DAVACL\Property;
-
-use Sabre\DAV;
-use Sabre\HTTP;
-
-
-
-class SupportedPrivilegeSetTest extends \PHPUnit_Framework_TestCase {
-
- function testSimple() {
-
- $prop = new SupportedPrivilegeSet(array(
- 'privilege' => '{DAV:}all',
- ));
-
- }
-
-
- /**
- * @depends testSimple
- */
- function testSerializeSimple() {
-
- $prop = new SupportedPrivilegeSet(array(
- 'privilege' => '{DAV:}all',
- ));
-
- $doc = new \DOMDocument();
- $root = $doc->createElementNS('DAV:', 'd:supported-privilege-set');
-
- $doc->appendChild($root);
-
- $server = new DAV\Server();
- $prop->serialize($server, $root);
-
- $xml = $doc->saveXML();
-
- $this->assertEquals(
-'<?xml version="1.0"?>
-<d:supported-privilege-set xmlns:d="DAV:">' .
-'<d:supported-privilege>' .
-'<d:privilege>' .
-'<d:all/>' .
-'</d:privilege>' .
-'</d:supported-privilege>' .
-'</d:supported-privilege-set>
-', $xml);
-
- }
-
- /**
- * @depends testSimple
- */
- function testSerializeAggregate() {
-
- $prop = new SupportedPrivilegeSet(array(
- 'privilege' => '{DAV:}all',
- 'abstract' => true,
- 'aggregates' => array(
- array(
- 'privilege' => '{DAV:}read',
- ),
- array(
- 'privilege' => '{DAV:}write',
- 'description' => 'booh',
- ),
- ),
- ));
-
- $doc = new \DOMDocument();
- $root = $doc->createElementNS('DAV:', 'd:supported-privilege-set');
-
- $doc->appendChild($root);
-
- $server = new DAV\Server();
- $prop->serialize($server, $root);
-
- $xml = $doc->saveXML();
-
- $this->assertEquals(
-'<?xml version="1.0"?>
-<d:supported-privilege-set xmlns:d="DAV:">' .
-'<d:supported-privilege>' .
-'<d:privilege>' .
-'<d:all/>' .
-'</d:privilege>' .
-'<d:abstract/>' .
-'<d:supported-privilege>' .
-'<d:privilege>' .
-'<d:read/>' .
-'</d:privilege>' .
-'</d:supported-privilege>' .
-'<d:supported-privilege>' .
-'<d:privilege>' .
-'<d:write/>' .
-'</d:privilege>' .
-'<d:description>booh</d:description>' .
-'</d:supported-privilege>' .
-'</d:supported-privilege>' .
-'</d:supported-privilege-set>
-', $xml);
-
- }
-}
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php
index 04ed5c330..fb73cc16a 100644
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php
@@ -30,6 +30,11 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals(array('ACL'), $aclPlugin->getMethods(''));
+
+ $this->assertEquals(
+ 'acl',
+ $aclPlugin->getPluginInfo()['name']
+ );
}
function testGetFlatPrivilegeSet() {
@@ -55,15 +60,15 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
),
'{DAV:}read-acl' => array(
'privilege' => '{DAV:}read-acl',
- 'abstract' => true,
+ 'abstract' => false,
'aggregates' => array(),
- 'concrete' => '{DAV:}read',
+ 'concrete' => '{DAV:}read-acl',
),
'{DAV:}read-current-user-privilege-set' => array(
'privilege' => '{DAV:}read-current-user-privilege-set',
- 'abstract' => true,
+ 'abstract' => false,
'aggregates' => array(),
- 'concrete' => '{DAV:}read',
+ 'concrete' => '{DAV:}read-current-user-privilege-set',
),
'{DAV:}write' => array(
'privilege' => '{DAV:}write',
@@ -80,39 +85,39 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
),
'{DAV:}write-acl' => array(
'privilege' => '{DAV:}write-acl',
- 'abstract' => true,
+ 'abstract' => false,
'aggregates' => array(),
- 'concrete' => '{DAV:}write',
+ 'concrete' => '{DAV:}write-acl',
),
'{DAV:}write-properties' => array(
'privilege' => '{DAV:}write-properties',
- 'abstract' => true,
+ 'abstract' => false,
'aggregates' => array(),
- 'concrete' => '{DAV:}write',
+ 'concrete' => '{DAV:}write-properties',
),
'{DAV:}write-content' => array(
'privilege' => '{DAV:}write-content',
- 'abstract' => true,
+ 'abstract' => false,
'aggregates' => array(),
- 'concrete' => '{DAV:}write',
+ 'concrete' => '{DAV:}write-content',
),
'{DAV:}unlock' => array(
'privilege' => '{DAV:}unlock',
- 'abstract' => true,
+ 'abstract' => false,
'aggregates' => array(),
- 'concrete' => '{DAV:}write',
+ 'concrete' => '{DAV:}unlock',
),
'{DAV:}bind' => array(
'privilege' => '{DAV:}bind',
- 'abstract' => true,
+ 'abstract' => false,
'aggregates' => array(),
- 'concrete' => '{DAV:}write',
+ 'concrete' => '{DAV:}bind',
),
'{DAV:}unbind' => array(
'privilege' => '{DAV:}unbind',
- 'abstract' => true,
+ 'abstract' => false,
'aggregates' => array(),
- 'concrete' => '{DAV:}write',
+ 'concrete' => '{DAV:}unbind',
),
);
@@ -148,11 +153,11 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
$server = new DAV\Server($tree);
$server->addPlugin($acl);
- $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock(),'SabreDAV');
+ $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock());
$server->addPlugin($auth);
//forcing login
- $auth->beforeMethod('GET','/');
+ $auth->beforeMethod(new HTTP\Request(), new HTTP\Response());
$this->assertEquals(array('principals/admin'),$acl->getCurrentUserPrincipals());
@@ -175,11 +180,11 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
$server = new DAV\Server($tree);
$server->addPlugin($acl);
- $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock(),'SabreDAV');
+ $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock());
$server->addPlugin($auth);
//forcing login
- $auth->beforeMethod('GET','/');
+ $auth->beforeMethod(new HTTP\Request(), new HTTP\Response());
$expected = array(
'principals/admin',
@@ -252,11 +257,11 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
$aclPlugin = new Plugin();
$server->addPlugin($aclPlugin);
- $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock(),'SabreDAV');
+ $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock());
$server->addPlugin($auth);
//forcing login
- $auth->beforeMethod('GET','/');
+ $auth->beforeMethod(new HTTP\Request(), new HTTP\Response());
$expected = array(
'{DAV:}write',
@@ -306,7 +311,7 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
$aclPlugin = new Plugin();
$server->addPlugin($aclPlugin);
- $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock(),'SabreDAV');
+ $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock());
$server->addPlugin($auth);
//forcing login
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/VersionTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/VersionTest.php
deleted file mode 100644
index c432527dc..000000000
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/VersionTest.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-
-namespace Sabre\DAVACL;
-
-class VersionTest extends \PHPUnit_Framework_TestCase {
-
- function testString() {
-
- $v = Version::VERSION;
- $this->assertEquals(-1, version_compare('1.0.0',$v));
-
- $s = Version::STABILITY;
- $this->assertTrue($s == 'alpha' || $s == 'beta' || $s =='stable');
-
- }
-
-}