diff options
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAVACL')
23 files changed, 717 insertions, 866 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/ACLMethodTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/ACLMethodTest.php index 7d7a54d06..3627991bf 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/ACLMethodTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/ACLMethodTest.php @@ -1,38 +1,39 @@ <?php +declare(strict_types=1); + namespace Sabre\DAVACL; use Sabre\DAV; use Sabre\HTTP; -class ACLMethodTest extends \PHPUnit_Framework_TestCase { - +class ACLMethodTest extends \PHPUnit\Framework\TestCase +{ /** - * @expectedException Sabre\DAV\Exception\BadRequest + * @expectedException \Sabre\DAV\Exception\BadRequest */ - function testCallback() { - + public function testCallback() + { $acl = new Plugin(); $server = new DAV\Server(); $server->addPlugin(new DAV\Auth\Plugin()); $server->addPlugin($acl); $acl->httpAcl($server->httpRequest, $server->httpResponse); - } /** /** - * @expectedException Sabre\DAV\Exception\MethodNotAllowed + * @expectedException \Sabre\DAV\Exception\MethodNotAllowed */ - function testNotSupportedByNode() { - + public function testNotSupportedByNode() + { $tree = [ new DAV\SimpleCollection('test'), ]; $acl = new Plugin(); $server = new DAV\Server($tree); - $server->httpRequest = new HTTP\Request(); + $server->httpRequest = new HTTP\Request('GET', '/'); $body = '<?xml version="1.0"?> <d:acl xmlns:d="DAV:"> </d:acl>'; @@ -41,17 +42,16 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase { $server->addPlugin($acl); $acl->httpACL($server->httpRequest, $server->httpResponse); - } - function testSuccessSimple() { - + public function testSuccessSimple() + { $tree = [ new MockACLNode('test', []), ]; $acl = new Plugin(); $server = new DAV\Server($tree); - $server->httpRequest = new HTTP\Request(); + $server->httpRequest = new HTTP\Request('GET', '/'); $server->httpRequest->setUrl('/test'); $body = '<?xml version="1.0"?> @@ -62,14 +62,13 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase { $server->addPlugin($acl); $this->assertFalse($acl->httpACL($server->httpRequest, $server->httpResponse)); - } /** - * @expectedException Sabre\DAVACL\Exception\NotRecognizedPrincipal + * @expectedException \Sabre\DAVACL\Exception\NotRecognizedPrincipal */ - function testUnrecognizedPrincipal() { - + public function testUnrecognizedPrincipal() + { $tree = [ new MockACLNode('test', []), ]; @@ -88,14 +87,13 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase { $server->addPlugin($acl); $acl->httpACL($server->httpRequest, $server->httpResponse); - } /** - * @expectedException Sabre\DAVACL\Exception\NotRecognizedPrincipal + * @expectedException \Sabre\DAVACL\Exception\NotRecognizedPrincipal */ - function testUnrecognizedPrincipal2() { - + public function testUnrecognizedPrincipal2() + { $tree = [ new MockACLNode('test', []), new DAV\SimpleCollection('principals', [ @@ -117,14 +115,13 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase { $server->addPlugin($acl); $acl->httpACL($server->httpRequest, $server->httpResponse); - } /** - * @expectedException Sabre\DAVACL\Exception\NotSupportedPrivilege + * @expectedException \Sabre\DAVACL\Exception\NotSupportedPrivilege */ - function testUnknownPrivilege() { - + public function testUnknownPrivilege() + { $tree = [ new MockACLNode('test', []), ]; @@ -143,20 +140,19 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase { $server->addPlugin($acl); $acl->httpACL($server->httpRequest, $server->httpResponse); - } /** - * @expectedException Sabre\DAVACL\Exception\NoAbstract + * @expectedException \Sabre\DAVACL\Exception\NoAbstract */ - function testAbstractPrivilege() { - + public function testAbstractPrivilege() + { $tree = [ new MockACLNode('test', []), ]; $acl = new Plugin(); $server = new DAV\Server($tree); - $server->on('getSupportedPrivilegeSet', function($node, &$supportedPrivilegeSet) { + $server->on('getSupportedPrivilegeSet', function ($node, &$supportedPrivilegeSet) { $supportedPrivilegeSet['{DAV:}foo'] = ['abstract' => true]; }); $server->httpRequest = new HTTP\Request('ACL', '/test'); @@ -172,14 +168,13 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase { $server->addPlugin($acl); $acl->httpACL($server->httpRequest, $server->httpResponse); - } /** - * @expectedException Sabre\DAVACL\Exception\AceConflict + * @expectedException \Sabre\DAVACL\Exception\AceConflict */ - function testUpdateProtectedPrivilege() { - + public function testUpdateProtectedPrivilege() + { $oldACL = [ [ 'principal' => 'principals/notfound', @@ -206,14 +201,13 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase { $server->addPlugin($acl); $acl->httpACL($server->httpRequest, $server->httpResponse); - } /** - * @expectedException Sabre\DAVACL\Exception\AceConflict + * @expectedException \Sabre\DAVACL\Exception\AceConflict */ - function testUpdateProtectedPrivilege2() { - + public function testUpdateProtectedPrivilege2() + { $oldACL = [ [ 'principal' => 'principals/notfound', @@ -240,14 +234,13 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase { $server->addPlugin($acl); $acl->httpACL($server->httpRequest, $server->httpResponse); - } /** - * @expectedException Sabre\DAVACL\Exception\AceConflict + * @expectedException \Sabre\DAVACL\Exception\AceConflict */ - function testUpdateProtectedPrivilege3() { - + public function testUpdateProtectedPrivilege3() + { $oldACL = [ [ 'principal' => 'principals/notfound', @@ -274,11 +267,10 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase { $server->addPlugin($acl); $acl->httpACL($server->httpRequest, $server->httpResponse); - } - function testSuccessComplex() { - + public function testSuccessComplex() + { $oldACL = [ [ 'principal' => 'principals/foo', @@ -317,7 +309,6 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase { $server->addPlugin(new DAV\Auth\Plugin()); $server->addPlugin($acl); - $this->assertFalse($acl->httpAcl($server->httpRequest, $server->httpResponse)); $this->assertEquals([ @@ -332,6 +323,5 @@ class ACLMethodTest extends \PHPUnit_Framework_TestCase { 'protected' => false, ], ], $node->getACL()); - } } diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/AllowAccessTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/AllowAccessTest.php index f16693625..724abc685 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/AllowAccessTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/AllowAccessTest.php @@ -1,18 +1,20 @@ <?php +declare(strict_types=1); + namespace Sabre\DAVACL; use Sabre\DAV; -class AllowAccessTest extends \PHPUnit_Framework_TestCase { - +class AllowAccessTest extends \PHPUnit\Framework\TestCase +{ /** * @var DAV\Server */ protected $server; - function setUp() { - + public function setUp() + { $nodes = [ new DAV\Mock\Collection('testdir', [ 'file1.txt' => 'contents', @@ -27,106 +29,92 @@ class AllowAccessTest extends \PHPUnit_Framework_TestCase { ); // Login $this->server->getPlugin('auth')->beforeMethod( - new \Sabre\HTTP\Request(), + new \Sabre\HTTP\Request('GET', '/'), new \Sabre\HTTP\Response() ); $aclPlugin = new Plugin(); $this->server->addPlugin($aclPlugin); - } - function testGet() { - + public function testGet() + { $this->server->httpRequest->setMethod('GET'); $this->server->httpRequest->setUrl('/testdir'); - $this->assertTrue($this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse])); - + $this->assertTrue($this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse])); } - function testGetDoesntExist() { - + public function testGetDoesntExist() + { $this->server->httpRequest->setMethod('GET'); $this->server->httpRequest->setUrl('/foo'); - $this->assertTrue($this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse])); - + $this->assertTrue($this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse])); } - function testHEAD() { - + public function testHEAD() + { $this->server->httpRequest->setMethod('HEAD'); $this->server->httpRequest->setUrl('/testdir'); - $this->assertTrue($this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse])); - + $this->assertTrue($this->server->emit('beforeMethod:HEAD', [$this->server->httpRequest, $this->server->httpResponse])); } - function testOPTIONS() { - + public function testOPTIONS() + { $this->server->httpRequest->setMethod('OPTIONS'); $this->server->httpRequest->setUrl('/testdir'); - $this->assertTrue($this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse])); - + $this->assertTrue($this->server->emit('beforeMethod:OPTIONS', [$this->server->httpRequest, $this->server->httpResponse])); } - function testPUT() { - + public function testPUT() + { $this->server->httpRequest->setMethod('PUT'); $this->server->httpRequest->setUrl('/testdir/file1.txt'); - $this->assertTrue($this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse])); - + $this->assertTrue($this->server->emit('beforeMethod:PUT', [$this->server->httpRequest, $this->server->httpResponse])); } - function testPROPPATCH() { - + public function testPROPPATCH() + { $this->server->httpRequest->setMethod('PROPPATCH'); $this->server->httpRequest->setUrl('/testdir'); - $this->assertTrue($this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse])); - + $this->assertTrue($this->server->emit('beforeMethod:PROPPATCH', [$this->server->httpRequest, $this->server->httpResponse])); } - function testCOPY() { - + public function testCOPY() + { $this->server->httpRequest->setMethod('COPY'); $this->server->httpRequest->setUrl('/testdir'); - $this->assertTrue($this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse])); - + $this->assertTrue($this->server->emit('beforeMethod:COPY', [$this->server->httpRequest, $this->server->httpResponse])); } - function testMOVE() { - + public function testMOVE() + { $this->server->httpRequest->setMethod('MOVE'); $this->server->httpRequest->setUrl('/testdir'); - $this->assertTrue($this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse])); - + $this->assertTrue($this->server->emit('beforeMethod:MOVE', [$this->server->httpRequest, $this->server->httpResponse])); } - function testLOCK() { - + public function testLOCK() + { $this->server->httpRequest->setMethod('LOCK'); $this->server->httpRequest->setUrl('/testdir'); - $this->assertTrue($this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse])); - + $this->assertTrue($this->server->emit('beforeMethod:LOCK', [$this->server->httpRequest, $this->server->httpResponse])); } - function testBeforeBind() { - + public function testBeforeBind() + { $this->assertTrue($this->server->emit('beforeBind', ['testdir/file'])); - } - - function testBeforeUnbind() { - + public function testBeforeUnbind() + { $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 ceae9aed0..3c3aaf6c9 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php @@ -1,19 +1,21 @@ <?php +declare(strict_types=1); + namespace Sabre\DAVACL; use Sabre\DAV; -class BlockAccessTest extends \PHPUnit_Framework_TestCase { - +class BlockAccessTest extends \PHPUnit\Framework\TestCase +{ /** * @var DAV\Server */ protected $server; protected $plugin; - function setUp() { - + public function setUp() + { $nodes = [ new DAV\SimpleCollection('testdir'), ]; @@ -28,151 +30,138 @@ class BlockAccessTest extends \PHPUnit_Framework_TestCase { ); // Login $this->server->getPlugin('auth')->beforeMethod( - new \Sabre\HTTP\Request(), + new \Sabre\HTTP\Request('GET', '/'), new \Sabre\HTTP\Response() ); $this->server->addPlugin($this->plugin); - } /** - * @expectedException Sabre\DAVACL\Exception\NeedPrivileges + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges */ - function testGet() { - + public function testGet() + { $this->server->httpRequest->setMethod('GET'); $this->server->httpRequest->setUrl('/testdir'); - $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]); - + $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } - function testGetDoesntExist() { - + public function testGetDoesntExist() + { $this->server->httpRequest->setMethod('GET'); $this->server->httpRequest->setUrl('/foo'); - $r = $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]); + $r = $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); $this->assertTrue($r); - } /** - * @expectedException Sabre\DAVACL\Exception\NeedPrivileges + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges */ - function testHEAD() { - + public function testHEAD() + { $this->server->httpRequest->setMethod('HEAD'); $this->server->httpRequest->setUrl('/testdir'); - $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]); - + $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } /** - * @expectedException Sabre\DAVACL\Exception\NeedPrivileges + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges */ - function testOPTIONS() { - + public function testOPTIONS() + { $this->server->httpRequest->setMethod('OPTIONS'); $this->server->httpRequest->setUrl('/testdir'); - $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]); - + $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } /** - * @expectedException Sabre\DAVACL\Exception\NeedPrivileges + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges */ - function testPUT() { - + public function testPUT() + { $this->server->httpRequest->setMethod('PUT'); $this->server->httpRequest->setUrl('/testdir'); - $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]); - + $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } /** - * @expectedException Sabre\DAVACL\Exception\NeedPrivileges + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges */ - function testPROPPATCH() { - + public function testPROPPATCH() + { $this->server->httpRequest->setMethod('PROPPATCH'); $this->server->httpRequest->setUrl('/testdir'); - $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]); - + $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } /** - * @expectedException Sabre\DAVACL\Exception\NeedPrivileges + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges */ - function testCOPY() { - + public function testCOPY() + { $this->server->httpRequest->setMethod('COPY'); $this->server->httpRequest->setUrl('/testdir'); - $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]); - + $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } /** - * @expectedException Sabre\DAVACL\Exception\NeedPrivileges + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges */ - function testMOVE() { - + public function testMOVE() + { $this->server->httpRequest->setMethod('MOVE'); $this->server->httpRequest->setUrl('/testdir'); - $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]); - + $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } /** - * @expectedException Sabre\DAVACL\Exception\NeedPrivileges + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges */ - function testACL() { - + public function testACL() + { $this->server->httpRequest->setMethod('ACL'); $this->server->httpRequest->setUrl('/testdir'); - $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]); - + $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } /** - * @expectedException Sabre\DAVACL\Exception\NeedPrivileges + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges */ - function testLOCK() { - + public function testLOCK() + { $this->server->httpRequest->setMethod('LOCK'); $this->server->httpRequest->setUrl('/testdir'); - $this->server->emit('beforeMethod', [$this->server->httpRequest, $this->server->httpResponse]); - + $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); } /** - * @expectedException Sabre\DAVACL\Exception\NeedPrivileges + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges */ - function testBeforeBind() { - + public function testBeforeBind() + { $this->server->emit('beforeBind', ['testdir/file']); - } /** - * @expectedException Sabre\DAVACL\Exception\NeedPrivileges + * @expectedException \Sabre\DAVACL\Exception\NeedPrivileges */ - function testBeforeUnbind() { - + public function testBeforeUnbind() + { $this->server->emit('beforeUnbind', ['testdir']); - } - function testPropFind() { - + public function testPropFind() + { $propFind = new DAV\PropFind('testdir', [ '{DAV:}displayname', '{DAV:}getcontentlength', @@ -187,19 +176,18 @@ class BlockAccessTest extends \PHPUnit_Framework_TestCase { 200 => [], 404 => [], 403 => [ - '{DAV:}displayname' => null, + '{DAV:}displayname' => null, '{DAV:}getcontentlength' => null, - '{DAV:}bar' => null, - '{DAV:}owner' => null, + '{DAV:}bar' => null, + '{DAV:}owner' => null, ], ]; $this->assertEquals($expected, $propFind->getResultForMultiStatus()); - } - function testBeforeGetPropertiesNoListing() { - + public function testBeforeGetPropertiesNoListing() + { $this->plugin->hideNodesFromListings = true; $propFind = new DAV\PropFind('testdir', [ '{DAV:}displayname', @@ -210,6 +198,5 @@ class BlockAccessTest extends \PHPUnit_Framework_TestCase { $r = $this->server->emit('propFind', [$propFind, new DAV\SimpleCollection('testdir')]); $this->assertFalse($r); - } } diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/AceConflictTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/AceConflictTest.php index 1cdf2949f..60fb8f3e8 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/AceConflictTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/AceConflictTest.php @@ -1,13 +1,15 @@ <?php +declare(strict_types=1); + namespace Sabre\DAVACL\Exception; use Sabre\DAV; -class AceConflictTest extends \PHPUnit_Framework_TestCase { - - function testSerialize() { - +class AceConflictTest extends \PHPUnit\Framework\TestCase +{ + public function testSerialize() + { $ex = new AceConflict('message'); $server = new DAV\Server(); @@ -18,7 +20,7 @@ class AceConflictTest extends \PHPUnit_Framework_TestCase { $ex->serialize($server, $root); $xpaths = [ - '/d:root' => 1, + '/d:root' => 1, '/d:root/d:no-ace-conflict' => 1, ]; @@ -29,11 +31,7 @@ class AceConflictTest extends \PHPUnit_Framework_TestCase { $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); } - } - } diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NeedPrivilegesExceptionTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NeedPrivilegesExceptionTest.php index b13e7722d..f08e536b5 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NeedPrivilegesExceptionTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NeedPrivilegesExceptionTest.php @@ -1,13 +1,15 @@ <?php +declare(strict_types=1); + namespace Sabre\DAVACL\Exception; use Sabre\DAV; -class NeedPrivilegesExceptionTest extends \PHPUnit_Framework_TestCase { - - function testSerialize() { - +class NeedPrivilegesExceptionTest extends \PHPUnit\Framework\TestCase +{ + public function testSerialize() + { $uri = 'foo'; $privileges = [ '{DAV:}read', @@ -23,12 +25,12 @@ class NeedPrivilegesExceptionTest extends \PHPUnit_Framework_TestCase { $ex->serialize($server, $root); $xpaths = [ - '/d:root' => 1, - '/d:root/d:need-privileges' => 1, - '/d:root/d:need-privileges/d:resource' => 2, - '/d:root/d:need-privileges/d:resource/d:href' => 2, - '/d:root/d:need-privileges/d:resource/d:privilege' => 2, - '/d:root/d:need-privileges/d:resource/d:privilege/d:read' => 1, + '/d:root' => 1, + '/d:root/d:need-privileges' => 1, + '/d:root/d:need-privileges/d:resource' => 2, + '/d:root/d:need-privileges/d:resource/d:href' => 2, + '/d:root/d:need-privileges/d:resource/d:privilege' => 2, + '/d:root/d:need-privileges/d:resource/d:privilege/d:read' => 1, '/d:root/d:need-privileges/d:resource/d:privilege/d:write' => 1, ]; @@ -39,11 +41,7 @@ class NeedPrivilegesExceptionTest extends \PHPUnit_Framework_TestCase { $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); } - } - } diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NoAbstractTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NoAbstractTest.php index f52b17371..38e9d8b93 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NoAbstractTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NoAbstractTest.php @@ -1,13 +1,15 @@ <?php +declare(strict_types=1); + namespace Sabre\DAVACL\Exception; use Sabre\DAV; -class NoAbstractTest extends \PHPUnit_Framework_TestCase { - - function testSerialize() { - +class NoAbstractTest extends \PHPUnit\Framework\TestCase +{ + public function testSerialize() + { $ex = new NoAbstract('message'); $server = new DAV\Server(); @@ -18,7 +20,7 @@ class NoAbstractTest extends \PHPUnit_Framework_TestCase { $ex->serialize($server, $root); $xpaths = [ - '/d:root' => 1, + '/d:root' => 1, '/d:root/d:no-abstract' => 1, ]; @@ -29,11 +31,7 @@ class NoAbstractTest extends \PHPUnit_Framework_TestCase { $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); } - } - } diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NotRecognizedPrincipalTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NotRecognizedPrincipalTest.php index df89aaf84..62915ea1d 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NotRecognizedPrincipalTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NotRecognizedPrincipalTest.php @@ -1,13 +1,15 @@ <?php +declare(strict_types=1); + namespace Sabre\DAVACL\Exception; use Sabre\DAV; -class NotRecognizedPrincipalTest extends \PHPUnit_Framework_TestCase { - - function testSerialize() { - +class NotRecognizedPrincipalTest extends \PHPUnit\Framework\TestCase +{ + public function testSerialize() + { $ex = new NotRecognizedPrincipal('message'); $server = new DAV\Server(); @@ -18,7 +20,7 @@ class NotRecognizedPrincipalTest extends \PHPUnit_Framework_TestCase { $ex->serialize($server, $root); $xpaths = [ - '/d:root' => 1, + '/d:root' => 1, '/d:root/d:recognized-principal' => 1, ]; @@ -29,11 +31,7 @@ class NotRecognizedPrincipalTest extends \PHPUnit_Framework_TestCase { $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); } - } - } diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NotSupportedPrivilegeTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NotSupportedPrivilegeTest.php index 50623952b..668c713d2 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NotSupportedPrivilegeTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NotSupportedPrivilegeTest.php @@ -1,13 +1,15 @@ <?php +declare(strict_types=1); + namespace Sabre\DAVACL\Exception; use Sabre\DAV; -class NotSupportedPrivilegeTest extends \PHPUnit_Framework_TestCase { - - function testSerialize() { - +class NotSupportedPrivilegeTest extends \PHPUnit\Framework\TestCase +{ + public function testSerialize() + { $ex = new NotSupportedPrivilege('message'); $server = new DAV\Server(); @@ -18,7 +20,7 @@ class NotSupportedPrivilegeTest extends \PHPUnit_Framework_TestCase { $ex->serialize($server, $root); $xpaths = [ - '/d:root' => 1, + '/d:root' => 1, '/d:root/d:not-supported-privilege' => 1, ]; @@ -29,11 +31,7 @@ class NotSupportedPrivilegeTest extends \PHPUnit_Framework_TestCase { $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); } - } - } diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php index 91de64372..28e328ea6 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\DAVACL; use Sabre\DAV; @@ -7,24 +9,24 @@ use Sabre\HTTP; require_once 'Sabre/HTTP/ResponseMock.php'; -class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase { - - function getServer() { - +class ExpandPropertiesTest extends \PHPUnit\Framework\TestCase +{ + public function getServer() + { $tree = [ new DAV\Mock\PropertiesCollection('node1', [], [ '{http://sabredav.org/ns}simple' => 'foo', - '{http://sabredav.org/ns}href' => new DAV\Xml\Property\Href('node2'), - '{DAV:}displayname' => 'Node 1', + '{http://sabredav.org/ns}href' => new DAV\Xml\Property\Href('node2'), + '{DAV:}displayname' => 'Node 1', ]), new DAV\Mock\PropertiesCollection('node2', [], [ - '{http://sabredav.org/ns}simple' => 'simple', + '{http://sabredav.org/ns}simple' => 'simple', '{http://sabredav.org/ns}hreflist' => new DAV\Xml\Property\Href(['node1', 'node3']), - '{DAV:}displayname' => 'Node 2', + '{DAV:}displayname' => 'Node 2', ]), new DAV\Mock\PropertiesCollection('node3', [], [ '{http://sabredav.org/ns}simple' => 'simple', - '{DAV:}displayname' => 'Node 3', + '{DAV:}displayname' => 'Node 3', ]), ]; @@ -39,7 +41,7 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase { [ 'principal' => '{DAV:}all', 'privilege' => '{DAV:}all', - ] + ], ]); $this->assertTrue($plugin instanceof Plugin); @@ -47,11 +49,10 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase { $this->assertEquals($plugin, $fakeServer->getPlugin('acl')); return $fakeServer; - } - function testSimple() { - + public function testSimple() + { $xml = '<?xml version="1.0"?> <d:expand-property xmlns:d="DAV:"> <d:property name="displayname" /> @@ -62,8 +63,8 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase { $serverVars = [ 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/node1', + 'HTTP_DEPTH' => '0', + 'REQUEST_URI' => '/node1', ]; $request = HTTP\Sapi::createFromServerArray($serverVars); @@ -74,22 +75,21 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase { $server->exec(); - $this->assertEquals(207, $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([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], + 'Content-Type' => ['application/xml; charset=utf-8'], ], $server->httpResponse->getHeaders()); - $check = [ '/d:multistatus', - '/d:multistatus/d:response' => 1, - '/d:multistatus/d:response/d:href' => 1, - '/d:multistatus/d:response/d:propstat' => 2, - '/d:multistatus/d:response/d:propstat/d:prop' => 2, + '/d:multistatus/d:response' => 1, + '/d:multistatus/d:response/d:href' => 1, + '/d:multistatus/d:response/d:propstat' => 2, + '/d:multistatus/d:response/d:propstat/d:prop' => 2, '/d:multistatus/d:response/d:propstat/d:prop/d:displayname' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:simple' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:href' => 1, + '/d:multistatus/d:response/d:propstat/d:prop/s:simple' => 1, + '/d:multistatus/d:response/d:propstat/d:prop/s:href' => 1, '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:href' => 1, ]; @@ -97,25 +97,24 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase { $xml->registerXPathNamespace('d', 'DAV:'); $xml->registerXPathNamespace('s', 'http://sabredav.org/ns'); 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: ' . $server->httpResponse->body); + if (!is_int($v1)) { + $count = $v2; + } + $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response: '.$server->httpResponse->body); } - } /** * @depends testSimple */ - function testExpand() { - + public function testExpand() + { $xml = '<?xml version="1.0"?> <d:expand-property xmlns:d="DAV:"> <d:property name="href" namespace="http://sabredav.org/ns"> @@ -125,8 +124,8 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase { $serverVars = [ 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/node1', + 'HTTP_DEPTH' => '0', + 'REQUEST_URI' => '/node1', ]; $request = HTTP\Sapi::createFromServerArray($serverVars); @@ -137,24 +136,23 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase { $server->exec(); - $this->assertEquals(207, $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([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], + 'Content-Type' => ['application/xml; charset=utf-8'], ], $server->httpResponse->getHeaders()); - $check = [ '/d:multistatus', - '/d:multistatus/d:response' => 1, - '/d:multistatus/d:response/d:href' => 1, - '/d:multistatus/d:response/d:propstat' => 1, - '/d:multistatus/d:response/d:propstat/d:prop' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:href' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:response' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:response/d:href' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:response/d:propstat' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:response/d:propstat/d:prop' => 1, + '/d:multistatus/d:response' => 1, + '/d:multistatus/d:response/d:href' => 1, + '/d:multistatus/d:response/d:propstat' => 1, + '/d:multistatus/d:response/d:propstat/d:prop' => 1, + '/d:multistatus/d:response/d:propstat/d:prop/s:href' => 1, + '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:response' => 1, + '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:response/d:href' => 1, + '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:response/d:propstat' => 1, + '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:response/d:propstat/d:prop' => 1, '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:response/d:propstat/d:prop/d:displayname' => 1, ]; @@ -162,25 +160,24 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase { $xml->registerXPathNamespace('d', 'DAV:'); $xml->registerXPathNamespace('s', 'http://sabredav.org/ns'); 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->getBodyAsString()); + 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->getBodyAsString()); } - } /** * @depends testSimple */ - function testExpandHrefList() { - + public function testExpandHrefList() + { $xml = '<?xml version="1.0"?> <d:expand-property xmlns:d="DAV:"> <d:property name="hreflist" namespace="http://sabredav.org/ns"> @@ -190,8 +187,8 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase { $serverVars = [ 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/node2', + 'HTTP_DEPTH' => '0', + 'REQUEST_URI' => '/node2', ]; $request = HTTP\Sapi::createFromServerArray($serverVars); @@ -205,21 +202,20 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase { $this->assertEquals(207, $server->httpResponse->status); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], + 'Content-Type' => ['application/xml; charset=utf-8'], ], $server->httpResponse->getHeaders()); - $check = [ '/d:multistatus', - '/d:multistatus/d:response' => 1, - '/d:multistatus/d:response/d:href' => 1, - '/d:multistatus/d:response/d:propstat' => 1, - '/d:multistatus/d:response/d:propstat/d:prop' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response' => 2, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:href' => 2, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat' => 2, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop' => 2, + '/d:multistatus/d:response' => 1, + '/d:multistatus/d:response/d:href' => 1, + '/d:multistatus/d:response/d:propstat' => 1, + '/d:multistatus/d:response/d:propstat/d:prop' => 1, + '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist' => 1, + '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response' => 2, + '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:href' => 2, + '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat' => 2, + '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop' => 2, '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/d:displayname' => 2, ]; @@ -227,25 +223,24 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase { $xml->registerXPathNamespace('d', 'DAV:'); $xml->registerXPathNamespace('s', 'http://sabredav.org/ns'); 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)); + if (!is_int($v1)) { + $count = $v2; + } + $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result)); } - } /** * @depends testExpand */ - function testExpandDeep() { - + public function testExpandDeep() + { $xml = '<?xml version="1.0"?> <d:expand-property xmlns:d="DAV:"> <d:property name="hreflist" namespace="http://sabredav.org/ns"> @@ -258,8 +253,8 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase { $serverVars = [ 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/node2', + 'HTTP_DEPTH' => '0', + 'REQUEST_URI' => '/node2', ]; $request = HTTP\Sapi::createFromServerArray($serverVars); @@ -273,27 +268,26 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase { $this->assertEquals(207, $server->httpResponse->status); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], + 'Content-Type' => ['application/xml; charset=utf-8'], ], $server->httpResponse->getHeaders()); - $check = [ '/d:multistatus', - '/d:multistatus/d:response' => 1, - '/d:multistatus/d:response/d:href' => 1, - '/d:multistatus/d:response/d:propstat' => 1, - '/d:multistatus/d:response/d:propstat/d:prop' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response' => 2, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:href' => 2, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat' => 3, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop' => 3, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/d:displayname' => 2, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href' => 2, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href/d:response' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href/d:response/d:href' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href/d:response/d:propstat' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href/d:response/d:propstat/d:prop' => 1, + '/d:multistatus/d:response' => 1, + '/d:multistatus/d:response/d:href' => 1, + '/d:multistatus/d:response/d:propstat' => 1, + '/d:multistatus/d:response/d:propstat/d:prop' => 1, + '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist' => 1, + '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response' => 2, + '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:href' => 2, + '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat' => 3, + '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop' => 3, + '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/d:displayname' => 2, + '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href' => 2, + '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href/d:response' => 1, + '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href/d:response/d:href' => 1, + '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href/d:response/d:propstat' => 1, + '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href/d:response/d:propstat/d:prop' => 1, '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href/d:response/d:propstat/d:prop/d:displayname' => 1, ]; @@ -301,17 +295,16 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase { $xml->registerXPathNamespace('d', 'DAV:'); $xml->registerXPathNamespace('s', 'http://sabredav.org/ns'); 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)); + if (!is_int($v1)) { + $count = $v2; + } + $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result)); } - } } diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/MockACLNode.php b/vendor/sabre/dav/tests/Sabre/DAVACL/MockACLNode.php index 2d9744e29..51411f304 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/MockACLNode.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/MockACLNode.php @@ -1,55 +1,49 @@ <?php +declare(strict_types=1); + namespace Sabre\DAVACL; use Sabre\DAV; -class MockACLNode extends DAV\Node implements IACL { - +class MockACLNode extends DAV\Node implements IACL +{ public $name; public $acl; - function __construct($name, array $acl = []) { - + public function __construct($name, array $acl = []) + { $this->name = $name; $this->acl = $acl; - } - function getName() { - + public function getName() + { return $this->name; - } - function getOwner() { - + public function getOwner() + { return null; - } - function getGroup() { - + public function getGroup() + { return null; - } - function getACL() { - + public function getACL() + { return $this->acl; - } - function setACL(array $acl) { - + public function setACL(array $acl) + { $this->acl = $acl; - } - function getSupportedPrivilegeSet() { - + public function getSupportedPrivilegeSet() + { return null; - } - } diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/MockPrincipal.php b/vendor/sabre/dav/tests/Sabre/DAVACL/MockPrincipal.php index 934906802..f67025c5a 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/MockPrincipal.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/MockPrincipal.php @@ -1,64 +1,58 @@ <?php +declare(strict_types=1); + namespace Sabre\DAVACL; use Sabre\DAV; -class MockPrincipal extends DAV\Node implements IPrincipal { - +class MockPrincipal extends DAV\Node implements IPrincipal +{ public $name; public $principalUrl; public $groupMembership = []; public $groupMemberSet = []; - function __construct($name, $principalUrl, array $groupMembership = [], array $groupMemberSet = []) { - + public function __construct($name, $principalUrl, array $groupMembership = [], array $groupMemberSet = []) + { $this->name = $name; $this->principalUrl = $principalUrl; $this->groupMembership = $groupMembership; $this->groupMemberSet = $groupMemberSet; - } - function getName() { - + public function getName() + { return $this->name; - } - function getDisplayName() { - + public function getDisplayName() + { return $this->getName(); - } - function getAlternateUriSet() { - + public function getAlternateUriSet() + { return []; - } - function getPrincipalUrl() { - + public function getPrincipalUrl() + { return $this->principalUrl; - } - function getGroupMemberSet() { - + public function getGroupMemberSet() + { return $this->groupMemberSet; - } - function getGroupMemberShip() { - + public function getGroupMemberShip() + { return $this->groupMembership; - } - function setGroupMemberSet(array $groupMemberSet) { - + public function setGroupMemberSet(array $groupMemberSet) + { $this->groupMemberSet = $groupMemberSet; - } } diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php index 8552448f5..9ab16df74 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\DAVACL; use Sabre\DAV; @@ -8,12 +10,12 @@ use Sabre\HTTP; require_once 'Sabre/DAVACL/MockACLNode.php'; require_once 'Sabre/HTTP/ResponseMock.php'; -class PluginAdminTest extends \PHPUnit_Framework_TestCase { - +class PluginAdminTest extends \PHPUnit\Framework\TestCase +{ public $server; - function setUp() { - + public function setUp() + { $principalBackend = new PrincipalBackend\Mock(); $tree = [ @@ -27,15 +29,15 @@ class PluginAdminTest extends \PHPUnit_Framework_TestCase { $this->server->addPlugin($plugin); } - function testNoAdminAccess() { - + public function testNoAdminAccess() + { $plugin = new Plugin(); $this->server->addPlugin($plugin); $request = HTTP\Sapi::createFromServerArray([ 'REQUEST_METHOD' => 'OPTIONS', - 'HTTP_DEPTH' => 1, - 'REQUEST_URI' => '/adminonly', + 'HTTP_DEPTH' => 1, + 'REQUEST_URI' => '/adminonly', ]); $response = new HTTP\ResponseMock(); @@ -46,14 +48,13 @@ class PluginAdminTest extends \PHPUnit_Framework_TestCase { $this->server->exec(); $this->assertEquals(403, $response->status); - } /** * @depends testNoAdminAccess */ - function testAdminAccess() { - + public function testAdminAccess() + { $plugin = new Plugin(); $plugin->adminPrincipals = [ 'principals/admin', @@ -62,8 +63,8 @@ class PluginAdminTest extends \PHPUnit_Framework_TestCase { $request = HTTP\Sapi::createFromServerArray([ 'REQUEST_METHOD' => 'OPTIONS', - 'HTTP_DEPTH' => 1, - 'REQUEST_URI' => '/adminonly', + 'HTTP_DEPTH' => 1, + 'REQUEST_URI' => '/adminonly', ]); $response = new HTTP\ResponseMock(); @@ -74,6 +75,5 @@ class PluginAdminTest extends \PHPUnit_Framework_TestCase { $this->server->exec(); $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 fb42efba7..16d3e781e 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginPropertiesTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginPropertiesTest.php @@ -1,14 +1,16 @@ <?php +declare(strict_types=1); + namespace Sabre\DAVACL; use Sabre\DAV; use Sabre\HTTP; -class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { - - function testPrincipalCollectionSet() { - +class PluginPropertiesTest extends \PHPUnit\Framework\TestCase +{ + public function testPrincipalCollectionSet() + { $plugin = new Plugin(); $plugin->allowUnauthenticatedAccess = false; $plugin->setDefaultACL([ @@ -42,14 +44,11 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { 'principals2/', ]; - $this->assertEquals($expected, $result[200]['{DAV:}principal-collection-set']->getHrefs()); - - } - function testCurrentUserPrincipal() { - + public function testCurrentUserPrincipal() + { $fakeServer = new DAV\Server(); $plugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock()); $fakeServer->addPlugin($plugin); @@ -62,7 +61,6 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { ]); $fakeServer->addPlugin($plugin); - $requestedProperties = [ '{DAV:}current-user-principal', ]; @@ -76,7 +74,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $this->assertEquals(Xml\Property\Principal::UNAUTHENTICATED, $result[200]['{DAV:}current-user-principal']->getType()); // This will force the login - $fakeServer->emit('beforeMethod', [$fakeServer->httpRequest, $fakeServer->httpResponse]); + $fakeServer->emit('beforeMethod:PROPFIND', [$fakeServer->httpRequest, $fakeServer->httpResponse]); $result = $fakeServer->getPropertiesForPath('', $requestedProperties); $result = $result[0]; @@ -86,11 +84,10 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $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()); - } - function testSupportedPrivilegeSet() { - + public function testSupportedPrivilegeSet() + { $plugin = new Plugin(); $plugin->allowUnauthenticatedAccess = false; $plugin->setDefaultACL([ @@ -119,28 +116,27 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $result = $server->xml->write('{DAV:}root', $prop); $xpaths = [ - '/d:root' => 1, - '/d:root/d:supported-privilege' => 1, - '/d:root/d:supported-privilege/d:privilege' => 1, - '/d:root/d:supported-privilege/d:privilege/d:all' => 1, - '/d:root/d:supported-privilege/d:abstract' => 0, - '/d:root/d:supported-privilege/d:supported-privilege' => 2, - '/d:root/d:supported-privilege/d:supported-privilege/d:privilege' => 2, - '/d:root/d:supported-privilege/d:supported-privilege/d:privilege/d:read' => 1, - '/d:root/d:supported-privilege/d:supported-privilege/d:privilege/d:write' => 1, - '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege' => 7, - '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:privilege' => 7, - '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:privilege/d:read-acl' => 1, + '/d:root' => 1, + '/d:root/d:supported-privilege' => 1, + '/d:root/d:supported-privilege/d:privilege' => 1, + '/d:root/d:supported-privilege/d:privilege/d:all' => 1, + '/d:root/d:supported-privilege/d:abstract' => 0, + '/d:root/d:supported-privilege/d:supported-privilege' => 2, + '/d:root/d:supported-privilege/d:supported-privilege/d:privilege' => 2, + '/d:root/d:supported-privilege/d:supported-privilege/d:privilege/d:read' => 1, + '/d:root/d:supported-privilege/d:supported-privilege/d:privilege/d:write' => 1, + '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege' => 7, + '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:privilege' => 7, + '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:privilege/d:read-acl' => 1, '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:privilege/d:read-current-user-privilege-set' => 1, - '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:privilege/d:write-content' => 1, - '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:privilege/d:write-properties' => 1, - '/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' => 0, + '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:privilege/d:write-content' => 1, + '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:privilege/d:write-properties' => 1, + '/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' => 0, ]; - // reloading because php dom sucks $dom2 = new \DOMDocument('1.0', 'utf-8'); $dom2->loadXML($result); @@ -148,15 +144,12 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $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 . ' Full XML: ' . $result); - + $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); } - } - function testACL() { - + public function testACL() + { $plugin = new Plugin(); $plugin->allowUnauthenticatedAccess = false; $plugin->setDefaultACL([ @@ -171,12 +164,11 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { [ 'principal' => 'principals/admin', 'privilege' => '{DAV:}read', - ] + ], ]), new DAV\SimpleCollection('principals', [ $principal = new MockPrincipal('admin', 'principals/admin'), ]), - ]; $server = new DAV\Server($nodes); @@ -185,7 +177,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $server->addPlugin($authPlugin); // Force login - $authPlugin->beforeMethod(new HTTP\Request(), new HTTP\Response()); + $authPlugin->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response()); $requestedProperties = [ '{DAV:}acl', @@ -194,14 +186,13 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $result = $server->getPropertiesForPath('foo', $requestedProperties); $result = $result[0]; - $this->assertEquals(1, count($result[200]), 'The {DAV:}acl property did not return from the list. Full list: ' . print_r($result, true)); + $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']); - } - function testACLRestrictions() { - + public function testACLRestrictions() + { $plugin = new Plugin(); $plugin->allowUnauthenticatedAccess = false; @@ -210,12 +201,11 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { [ 'principal' => 'principals/admin', 'privilege' => '{DAV:}read', - ] + ], ]), new DAV\SimpleCollection('principals', [ $principal = new MockPrincipal('admin', 'principals/admin'), ]), - ]; $server = new DAV\Server($nodes); @@ -224,7 +214,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $server->addPlugin($authPlugin); // Force login - $authPlugin->beforeMethod(new HTTP\Request(), new HTTP\Response()); + $authPlugin->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response()); $requestedProperties = [ '{DAV:}acl-restrictions', @@ -233,18 +223,17 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $result = $server->getPropertiesForPath('foo', $requestedProperties); $result = $result[0]; - $this->assertEquals(1, count($result[200]), 'The {DAV:}acl-restrictions property did not return from the list. Full list: ' . print_r($result, true)); + $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() { - + public function testAlternateUriSet() + { $tree = [ new DAV\SimpleCollection('principals', [ $principal = new MockPrincipal('user', 'principals/user'), - ]) + ]), ]; $fakeServer = new DAV\Server($tree); @@ -271,11 +260,10 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $result[200]['{DAV:}alternate-URI-set']); $this->assertEquals([], $result[200]['{DAV:}alternate-URI-set']->getHrefs()); - } - function testPrincipalURL() { - + public function testPrincipalURL() + { $tree = [ new DAV\SimpleCollection('principals', [ $principal = new MockPrincipal('user', 'principals/user'), @@ -307,11 +295,10 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $result[200]['{DAV:}principal-URL']); $this->assertEquals('principals/user/', $result[200]['{DAV:}principal-URL']->getHref()); - } - function testGroupMemberSet() { - + public function testGroupMemberSet() + { $tree = [ new DAV\SimpleCollection('principals', [ $principal = new MockPrincipal('user', 'principals/user'), @@ -343,11 +330,10 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $result[200]['{DAV:}group-member-set']); $this->assertEquals([], $result[200]['{DAV:}group-member-set']->getHrefs()); - } - function testGroupMemberShip() { - + public function testGroupMemberShip() + { $tree = [ new DAV\SimpleCollection('principals', [ $principal = new MockPrincipal('user', 'principals/user'), @@ -377,11 +363,10 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $result[200]['{DAV:}group-membership']); $this->assertEquals([], $result[200]['{DAV:}group-membership']->getHrefs()); - } - function testGetDisplayName() { - + public function testGetDisplayName() + { $tree = [ new DAV\SimpleCollection('principals', [ $principal = new MockPrincipal('user', 'principals/user'), @@ -410,6 +395,5 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $this->assertTrue(isset($result[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 0147e6a61..169629a03 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php @@ -1,13 +1,15 @@ <?php +declare(strict_types=1); + namespace Sabre\DAVACL; use Sabre\DAV; -class PluginUpdatePropertiesTest extends \PHPUnit_Framework_TestCase { - - function testUpdatePropertiesPassthrough() { - +class PluginUpdatePropertiesTest extends \PHPUnit\Framework\TestCase +{ + public function testUpdatePropertiesPassthrough() + { $tree = [ new DAV\SimpleCollection('foo'), ]; @@ -24,11 +26,10 @@ class PluginUpdatePropertiesTest extends \PHPUnit_Framework_TestCase { ]; $this->assertEquals($expected, $result); - } - function testRemoveGroupMembers() { - + public function testRemoveGroupMembers() + { $tree = [ new MockPrincipal('foo', 'foo'), ]; @@ -42,16 +43,15 @@ class PluginUpdatePropertiesTest extends \PHPUnit_Framework_TestCase { ]); $expected = [ - '{DAV:}group-member-set' => 204 + '{DAV:}group-member-set' => 204, ]; $this->assertEquals($expected, $result); $this->assertEquals([], $tree[0]->getGroupMemberSet()); - } - function testSetGroupMembers() { - + public function testSetGroupMembers() + { $tree = [ new MockPrincipal('foo', 'foo'), ]; @@ -65,19 +65,18 @@ class PluginUpdatePropertiesTest extends \PHPUnit_Framework_TestCase { ]); $expected = [ - '{DAV:}group-member-set' => 200 + '{DAV:}group-member-set' => 200, ]; $this->assertEquals($expected, $result); $this->assertEquals(['bar', 'baz'], $tree[0]->getGroupMemberSet()); - } /** - * @expectedException Sabre\DAV\Exception + * @expectedException \Sabre\DAV\Exception */ - function testSetBadValue() { - + public function testSetBadValue() + { $tree = [ new MockPrincipal('foo', 'foo'), ]; @@ -89,11 +88,10 @@ class PluginUpdatePropertiesTest extends \PHPUnit_Framework_TestCase { $result = $server->updateProperties('foo', [ '{DAV:}group-member-set' => new \StdClass(), ]); - } - function testSetBadNode() { - + public function testSetBadNode() + { $tree = [ new DAV\SimpleCollection('foo'), ]; @@ -111,6 +109,5 @@ class PluginUpdatePropertiesTest extends \PHPUnit_Framework_TestCase { ]; $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 9fef3018d..89f69b10a 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php @@ -1,16 +1,17 @@ <?php +declare(strict_types=1); + namespace Sabre\DAVACL\PrincipalBackend; use Sabre\DAV; -use Sabre\HTTP; - -abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { +abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase +{ use DAV\DbTestHelperTrait; - function setUp() { - + public function setUp() + { $this->dropTables(['principals', 'groupmembers']); $this->createSchema('principals'); @@ -19,92 +20,85 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $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("INSERT INTO groupmembers (principal_id,member_id) VALUES (5,4)"); - + $pdo->query('INSERT INTO groupmembers (principal_id,member_id) VALUES (5,4)'); } - - function testConstruct() { - + public function testConstruct() + { $pdo = $this->getPDO(); $backend = new PDO($pdo); $this->assertTrue($backend instanceof PDO); - } /** * @depends testConstruct */ - function testGetPrincipalsByPrefix() { - + public function testGetPrincipalsByPrefix() + { $pdo = $this->getPDO(); $backend = new PDO($pdo); $expected = [ [ - 'uri' => 'principals/admin', + 'uri' => 'principals/admin', '{http://sabredav.org/ns}email-address' => 'admin@example.org', - '{DAV:}displayname' => 'Administrator', + '{DAV:}displayname' => 'Administrator', ], [ - 'uri' => 'principals/user', + 'uri' => 'principals/user', '{http://sabredav.org/ns}email-address' => 'user@example.org', - '{DAV:}displayname' => 'User', + '{DAV:}displayname' => 'User', ], [ - 'uri' => 'principals/group', + 'uri' => 'principals/group', '{http://sabredav.org/ns}email-address' => 'group@example.org', - '{DAV:}displayname' => 'Group', + '{DAV:}displayname' => 'Group', ], ]; $this->assertEquals($expected, $backend->getPrincipalsByPrefix('principals')); $this->assertEquals([], $backend->getPrincipalsByPrefix('foo')); - } /** * @depends testConstruct */ - function testGetPrincipalByPath() { - + public function testGetPrincipalByPath() + { $pdo = $this->getPDO(); $backend = new PDO($pdo); $expected = [ - 'id' => 4, - 'uri' => 'principals/user', + 'id' => 4, + 'uri' => 'principals/user', '{http://sabredav.org/ns}email-address' => 'user@example.org', - '{DAV:}displayname' => 'User', + '{DAV:}displayname' => 'User', ]; $this->assertEquals($expected, $backend->getPrincipalByPath('principals/user')); $this->assertEquals(null, $backend->getPrincipalByPath('foo')); - } - function testGetGroupMemberSet() { - + public function testGetGroupMemberSet() + { $pdo = $this->getPDO(); $backend = new PDO($pdo); $expected = ['principals/user']; $this->assertEquals($expected, $backend->getGroupMemberSet('principals/group')); - } - function testGetGroupMembership() { - + public function testGetGroupMembership() + { $pdo = $this->getPDO(); $backend = new PDO($pdo); $expected = ['principals/group']; $this->assertEquals($expected, $backend->getGroupMembership('principals/user')); - } - function testSetGroupMemberSet() { - + public function testSetGroupMemberSet() + { $pdo = $this->getPDO(); // Start situation @@ -118,12 +112,10 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { // Adding principals again $backend->setGroupMemberSet('principals/group', ['principals/user']); $this->assertEquals(['principals/user'], $backend->getGroupMemberSet('principals/group')); - - } - function testSearchPrincipals() { - + public function testSearchPrincipals() + { $pdo = $this->getPDO(); $backend = new PDO($pdo); @@ -139,11 +131,10 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $result = $backend->searchPrincipals('mom', ['{DAV:}displayname' => 'UsEr', '{http://sabredav.org/ns}email-address' => 'USER@EXAMPLE']); $this->assertEquals([], $result); - } - function testUpdatePrincipal() { - + public function testUpdatePrincipal() + { $pdo = $this->getPDO(); $backend = new PDO($pdo); @@ -157,22 +148,21 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $this->assertTrue($result); $this->assertEquals([ - 'id' => 4, - 'uri' => 'principals/user', - '{DAV:}displayname' => 'pietje', + 'id' => 4, + 'uri' => 'principals/user', + '{DAV:}displayname' => 'pietje', '{http://sabredav.org/ns}email-address' => 'user@example.org', ], $backend->getPrincipalByPath('principals/user')); - } - function testUpdatePrincipalUnknownField() { - + public function testUpdatePrincipalUnknownField() + { $pdo = $this->getPDO(); $backend = new PDO($pdo); $propPatch = new DAV\PropPatch([ '{DAV:}displayname' => 'pietje', - '{DAV:}unknown' => 'foo', + '{DAV:}unknown' => 'foo', ]); $backend->updatePrincipal('principals/user', $propPatch); @@ -182,36 +172,31 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $this->assertEquals([ '{DAV:}displayname' => 424, - '{DAV:}unknown' => 403 + '{DAV:}unknown' => 403, ], $propPatch->getResult()); $this->assertEquals([ - 'id' => '4', - 'uri' => 'principals/user', - '{DAV:}displayname' => 'User', + 'id' => '4', + 'uri' => 'principals/user', + '{DAV:}displayname' => 'User', '{http://sabredav.org/ns}email-address' => 'user@example.org', ], $backend->getPrincipalByPath('principals/user')); - } - function testFindByUriUnknownScheme() { - + public function testFindByUriUnknownScheme() + { $pdo = $this->getPDO(); $backend = new PDO($pdo); $this->assertNull($backend->findByUri('http://foo', 'principals')); - } - - function testFindByUri() { - + public 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 1464f4c26..551a77900 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/Mock.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/Mock.php @@ -1,121 +1,117 @@ <?php -namespace Sabre\DAVACL\PrincipalBackend; +declare(strict_types=1); -class Mock extends AbstractBackend { +namespace Sabre\DAVACL\PrincipalBackend; +class Mock extends AbstractBackend +{ public $groupMembers = []; public $principals; - function __construct(array $principals = null) { - + public function __construct(array $principals = null) + { $this->principals = $principals; if (is_null($principals)) { - $this->principals = [ [ - 'uri' => 'principals/user1', - '{DAV:}displayname' => 'User 1', + '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', + '{http://sabredav.org/ns}vcard-url' => 'addressbooks/user1/book1/vcard1.vcf', ], [ - 'uri' => 'principals/admin', + 'uri' => 'principals/admin', '{DAV:}displayname' => 'Admin', ], [ - '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) { - + public function getPrincipalsByPrefix($prefix) + { $prefix = trim($prefix, '/'); - if ($prefix) $prefix .= '/'; + if ($prefix) { + $prefix .= '/'; + } $return = []; foreach ($this->principals as $principal) { - - if ($prefix && strpos($principal['uri'], $prefix) !== 0) continue; + if ($prefix && 0 !== strpos($principal['uri'], $prefix)) { + continue; + } $return[] = $principal; - } return $return; - } - function addPrincipal(array $principal) { - + public function addPrincipal(array $principal) + { $this->principals[] = $principal; - } - function getPrincipalByPath($path) { - + public function getPrincipalByPath($path) + { foreach ($this->getPrincipalsByPrefix('principals') as $principal) { - if ($principal['uri'] === $path) return $principal; + if ($principal['uri'] === $path) { + return $principal; + } } - } - function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof') { - + public function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof') + { $matches = []; foreach ($this->getPrincipalsByPrefix($prefixPath) as $principal) { - foreach ($searchProperties as $key => $value) { - if (!isset($principal[$key])) { continue 2; } - if (mb_stripos($principal[$key], $value, 0, 'UTF-8') === false) { + if (false === mb_stripos($principal[$key], $value, 0, 'UTF-8')) { continue 2; } // We have a match for this searchProperty! - if ($test === 'allof') { + if ('allof' === $test) { continue; } else { break; } - } $matches[] = $principal['uri']; - } - return $matches; + return $matches; } - function getGroupMemberSet($path) { - + public function getGroupMemberSet($path) + { return isset($this->groupMembers[$path]) ? $this->groupMembers[$path] : []; - } - function getGroupMembership($path) { - + public function getGroupMembership($path) + { $membership = []; foreach ($this->groupMembers as $group => $members) { - if (in_array($path, $members)) $membership[] = $group; + if (in_array($path, $members)) { + $membership[] = $group; + } } - return $membership; + return $membership; } - function setGroupMemberSet($path, array $members) { - + public function setGroupMemberSet($path, array $members) + { $this->groupMembers[$path] = $members; - } /** @@ -130,11 +126,11 @@ class Mock extends AbstractBackend { * * Read the PropPatch documentation for more info and examples. * - * @param string $path + * @param string $path * @param \Sabre\DAV\PropPatch $propPatch */ - function updatePrincipal($path, \Sabre\DAV\PropPatch $propPatch) { - + public function updatePrincipal($path, \Sabre\DAV\PropPatch $propPatch) + { $value = null; foreach ($this->principals as $principalIndex => $value) { if ($value['uri'] === $path) { @@ -142,27 +138,22 @@ class Mock extends AbstractBackend { break; } } - if (!$principal) return; - - $propPatch->handleRemaining(function($mutations) use ($principal, $principalIndex) { + if (!$principal) { + return; + } + $propPatch->handleRemaining(function ($mutations) use ($principal, $principalIndex) { foreach ($mutations as $prop => $value) { - if (is_null($value) && isset($principal[$prop])) { unset($principal[$prop]); } else { $principal[$prop] = $value; } - } $this->principals[$principalIndex] = $principal; 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 8779eb69f..54795cf4d 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOMySQLTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOMySQLTest.php @@ -1,9 +1,10 @@ <?php -namespace Sabre\DAVACL\PrincipalBackend; +declare(strict_types=1); -class PDOMySQLTest extends AbstractPDOTest { +namespace Sabre\DAVACL\PrincipalBackend; +class PDOMySQLTest extends AbstractPDOTest +{ public $driver = 'mysql'; - } diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOSqliteTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOSqliteTest.php index 48454981d..549e0bd60 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOSqliteTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOSqliteTest.php @@ -1,9 +1,10 @@ <?php -namespace Sabre\DAVACL\PrincipalBackend; +declare(strict_types=1); -class PDOSqliteTest extends AbstractPDOTest { +namespace Sabre\DAVACL\PrincipalBackend; +class PDOSqliteTest extends AbstractPDOTest +{ public $driver = 'sqlite'; - } diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalCollectionTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalCollectionTest.php index bcf78821b..68aebe2ae 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalCollectionTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalCollectionTest.php @@ -1,24 +1,25 @@ <?php -namespace Sabre\DAVACL; - -class PrincipalCollectionTest extends \PHPUnit_Framework_TestCase { +declare(strict_types=1); - function testBasic() { +namespace Sabre\DAVACL; +class PrincipalCollectionTest extends \PHPUnit\Framework\TestCase +{ + public function testBasic() + { $backend = new PrincipalBackend\Mock(); $pc = new PrincipalCollection($backend); $this->assertTrue($pc instanceof PrincipalCollection); $this->assertEquals('principals', $pc->getName()); - } /** * @depends testBasic */ - function testGetChildren() { - + public function testGetChildren() + { $backend = new PrincipalBackend\Mock(); $pc = new PrincipalCollection($backend); @@ -28,30 +29,27 @@ class PrincipalCollectionTest extends \PHPUnit_Framework_TestCase { foreach ($children as $child) { $this->assertTrue($child instanceof IPrincipal); } - } /** * @depends testBasic - * @expectedException Sabre\DAV\Exception\MethodNotAllowed + * @expectedException \Sabre\DAV\Exception\MethodNotAllowed */ - function testGetChildrenDisable() { - + public function testGetChildrenDisable() + { $backend = new PrincipalBackend\Mock(); $pc = new PrincipalCollection($backend); $pc->disableListing = true; $children = $pc->getChildren(); - } - function testFindByUri() { - + 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 60e156d9a..3bdcfbbbd 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\DAVACL; use Sabre\DAV; @@ -7,10 +9,10 @@ use Sabre\HTTP; require_once 'Sabre/HTTP/ResponseMock.php'; -class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase { - - function getServer() { - +class PrincipalPropertySearchTest extends \PHPUnit\Framework\TestCase +{ + public function getServer() + { $backend = new PrincipalBackend\Mock(); $dir = new DAV\SimpleCollection('root'); @@ -30,11 +32,10 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase { $this->assertEquals($plugin, $fakeServer->getPlugin('acl')); return $fakeServer; - } - function testDepth1() { - + public function testDepth1() + { $xml = '<?xml version="1.0"?> <d:principal-property-search xmlns:d="DAV:"> <d:property-search> @@ -51,8 +52,8 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase { $serverVars = [ 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '1', - 'REQUEST_URI' => '/principals', + 'HTTP_DEPTH' => '1', + 'REQUEST_URI' => '/principals', ]; $request = HTTP\Sapi::createFromServerArray($serverVars); @@ -66,14 +67,12 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase { $this->assertEquals(400, $server->httpResponse->getStatus(), $server->httpResponse->getBodyAsString()); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], + 'Content-Type' => ['application/xml; charset=utf-8'], ], $server->httpResponse->getHeaders()); - } - - function testUnknownSearchField() { - + public function testUnknownSearchField() + { $xml = '<?xml version="1.0"?> <d:principal-property-search xmlns:d="DAV:"> <d:property-search> @@ -90,8 +89,8 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase { $serverVars = [ 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/principals', + 'HTTP_DEPTH' => '0', + 'REQUEST_URI' => '/principals', ]; $request = HTTP\Sapi::createFromServerArray($serverVars); @@ -102,17 +101,16 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase { $server->exec(); - $this->assertEquals(207, $server->httpResponse->getStatus(), "Full body: " . $server->httpResponse->getBodyAsString()); + $this->assertEquals(207, $server->httpResponse->getStatus(), 'Full body: '.$server->httpResponse->getBodyAsString()); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'Vary' => ['Brief,Prefer'], + 'Content-Type' => ['application/xml; charset=utf-8'], + 'Vary' => ['Brief,Prefer'], ], $server->httpResponse->getHeaders()); - } - function testCorrect() { - + public function testCorrect() + { $xml = '<?xml version="1.0"?> <d:principal-property-search xmlns:d="DAV:"> <d:apply-to-principal-collection-set /> @@ -130,8 +128,8 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase { $serverVars = [ 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/', + 'HTTP_DEPTH' => '0', + 'REQUEST_URI' => '/', ]; $request = HTTP\Sapi::createFromServerArray($serverVars); @@ -145,41 +143,39 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase { $this->assertEquals(207, $server->httpResponse->status, $server->httpResponse->body); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'Vary' => ['Brief,Prefer'], + 'Content-Type' => ['application/xml; charset=utf-8'], + 'Vary' => ['Brief,Prefer'], ], $server->httpResponse->getHeaders()); - $check = [ '/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' => 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, + '/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); + 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() { - + public function testAND() + { $xml = '<?xml version="1.0"?> <d:principal-property-search xmlns:d="DAV:"> <d:apply-to-principal-collection-set /> @@ -203,8 +199,8 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase { $serverVars = [ 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/', + 'HTTP_DEPTH' => '0', + 'REQUEST_URI' => '/', ]; $request = HTTP\Sapi::createFromServerArray($serverVars); @@ -218,40 +214,39 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase { $this->assertEquals(207, $server->httpResponse->status, $server->httpResponse->body); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'Vary' => ['Brief,Prefer'], + 'Content-Type' => ['application/xml; charset=utf-8'], + 'Vary' => ['Brief,Prefer'], ], $server->httpResponse->getHeaders()); - $check = [ '/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' => 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, + '/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); + 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() { + public function testOR() + { $xml = '<?xml version="1.0"?> <d:principal-property-search xmlns:d="DAV:" test="anyof"> <d:apply-to-principal-collection-set /> @@ -275,8 +270,8 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase { $serverVars = [ 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/', + 'HTTP_DEPTH' => '0', + 'REQUEST_URI' => '/', ]; $request = HTTP\Sapi::createFromServerArray($serverVars); @@ -290,40 +285,39 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase { $this->assertEquals(207, $server->httpResponse->status, $server->httpResponse->body); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'Vary' => ['Brief,Prefer'], + 'Content-Type' => ['application/xml; charset=utf-8'], + 'Vary' => ['Brief,Prefer'], ], $server->httpResponse->getHeaders()); - $check = [ '/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' => 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, + '/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); + 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 testWrongUri() { + public function testWrongUri() + { $xml = '<?xml version="1.0"?> <d:principal-property-search xmlns:d="DAV:"> <d:property-search> @@ -340,8 +334,8 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase { $serverVars = [ 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/', + 'HTTP_DEPTH' => '0', + 'REQUEST_URI' => '/', ]; $request = HTTP\Sapi::createFromServerArray($serverVars); @@ -355,11 +349,10 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase { $this->assertEquals(207, $server->httpResponse->status, $server->httpResponse->body); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'Vary' => ['Brief,Prefer'], + 'Content-Type' => ['application/xml; charset=utf-8'], + 'Vary' => ['Brief,Prefer'], ], $server->httpResponse->getHeaders()); - $check = [ '/d:multistatus', '/d:multistatus/d:response' => 0, @@ -368,30 +361,27 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase { $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); + 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); } - } } -class MockPlugin extends Plugin { - - function getCurrentUserPrivilegeSet($node) { - +class MockPlugin extends Plugin +{ + public function getCurrentUserPrivilegeSet($node) + { return [ '{DAV:}read', '{DAV:}write', ]; - } - } diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php index fa1314d10..04f168f92 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\DAVACL; use Sabre\DAV; @@ -7,10 +9,10 @@ use Sabre\HTTP; require_once 'Sabre/HTTP/ResponseMock.php'; -class PrincipalSearchPropertySetTest extends \PHPUnit_Framework_TestCase { - - function getServer() { - +class PrincipalSearchPropertySetTest extends \PHPUnit\Framework\TestCase +{ + public function getServer() + { $backend = new PrincipalBackend\Mock(); $dir = new DAV\SimpleCollection('root'); @@ -27,18 +29,17 @@ class PrincipalSearchPropertySetTest extends \PHPUnit_Framework_TestCase { $this->assertEquals($plugin, $fakeServer->getPlugin('acl')); return $fakeServer; - } - function testDepth1() { - + public function testDepth1() + { $xml = '<?xml version="1.0"?> <d:principal-search-property-set xmlns:d="DAV:" />'; $serverVars = [ 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '1', - 'REQUEST_URI' => '/principals', + 'HTTP_DEPTH' => '1', + 'REQUEST_URI' => '/principals', ]; $request = HTTP\Sapi::createFromServerArray($serverVars); @@ -52,20 +53,19 @@ class PrincipalSearchPropertySetTest extends \PHPUnit_Framework_TestCase { $this->assertEquals(400, $server->httpResponse->status); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], + 'Content-Type' => ['application/xml; charset=utf-8'], ], $server->httpResponse->getHeaders()); - } - function testDepthIncorrectXML() { - + public function testDepthIncorrectXML() + { $xml = '<?xml version="1.0"?> <d:principal-search-property-set xmlns:d="DAV:"><d:ohell /></d:principal-search-property-set>'; $serverVars = [ 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/principals', + 'HTTP_DEPTH' => '0', + 'REQUEST_URI' => '/principals', ]; $request = HTTP\Sapi::createFromServerArray($serverVars); @@ -79,20 +79,19 @@ class PrincipalSearchPropertySetTest extends \PHPUnit_Framework_TestCase { $this->assertEquals(400, $server->httpResponse->status, $server->httpResponse->body); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], + 'Content-Type' => ['application/xml; charset=utf-8'], ], $server->httpResponse->getHeaders()); - } - function testCorrect() { - + public function testCorrect() + { $xml = '<?xml version="1.0"?> <d:principal-search-property-set xmlns:d="DAV:"/>'; $serverVars = [ 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/principals', + 'HTTP_DEPTH' => '0', + 'REQUEST_URI' => '/principals', ]; $request = HTTP\Sapi::createFromServerArray($serverVars); @@ -106,35 +105,32 @@ class PrincipalSearchPropertySetTest extends \PHPUnit_Framework_TestCase { $this->assertEquals(200, $server->httpResponse->status, $server->httpResponse->body); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], + 'Content-Type' => ['application/xml; charset=utf-8'], ], $server->httpResponse->getHeaders()); - $check = [ '/d:principal-search-property-set', - '/d:principal-search-property-set/d:principal-search-property' => 2, - '/d:principal-search-property-set/d:principal-search-property/d:prop' => 2, - '/d:principal-search-property-set/d:principal-search-property/d:prop/d:displayname' => 1, + '/d:principal-search-property-set/d:principal-search-property' => 2, + '/d:principal-search-property-set/d:principal-search-property/d:prop' => 2, + '/d:principal-search-property-set/d:principal-search-property/d:prop/d:displayname' => 1, '/d:principal-search-property-set/d:principal-search-property/d:prop/s:email-address' => 1, - '/d:principal-search-property-set/d:principal-search-property/d:description' => 2, + '/d:principal-search-property-set/d:principal-search-property/d:description' => 2, ]; $xml = simplexml_load_string($server->httpResponse->body); $xml->registerXPathNamespace('d', 'DAV:'); $xml->registerXPathNamespace('s', 'http://sabredav.org/ns'); 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); + 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); } - } - } diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalTest.php index 20622ad17..a4821da5a 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalTest.php @@ -1,58 +1,55 @@ <?php +declare(strict_types=1); + namespace Sabre\DAVACL; use Sabre\DAV; -use Sabre\HTTP; - -class PrincipalTest extends \PHPUnit_Framework_TestCase { - - function testConstruct() { +class PrincipalTest extends \PHPUnit\Framework\TestCase +{ + public function testConstruct() + { $principalBackend = new PrincipalBackend\Mock(); $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); $this->assertTrue($principal instanceof Principal); - } /** - * @expectedException Sabre\DAV\Exception + * @expectedException \Sabre\DAV\Exception */ - function testConstructNoUri() { - + public function testConstructNoUri() + { $principalBackend = new PrincipalBackend\Mock(); $principal = new Principal($principalBackend, []); - } - function testGetName() { - + public function testGetName() + { $principalBackend = new PrincipalBackend\Mock(); $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); $this->assertEquals('admin', $principal->getName()); - } - function testGetDisplayName() { - + public function testGetDisplayName() + { $principalBackend = new PrincipalBackend\Mock(); $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); $this->assertEquals('admin', $principal->getDisplayname()); $principal = new Principal($principalBackend, [ - 'uri' => 'principals/admin', - '{DAV:}displayname' => 'Mr. Admin' + 'uri' => 'principals/admin', + '{DAV:}displayname' => 'Mr. Admin', ]); $this->assertEquals('Mr. Admin', $principal->getDisplayname()); - } - function testGetProperties() { - + public function testGetProperties() + { $principalBackend = new PrincipalBackend\Mock(); $principal = new Principal($principalBackend, [ - 'uri' => 'principals/admin', - '{DAV:}displayname' => 'Mr. Admin', + 'uri' => 'principals/admin', + '{DAV:}displayname' => 'Mr. Admin', '{http://www.example.org/custom}custom' => 'Custom', '{http://sabredav.org/ns}email-address' => 'admin@example.org', ]); @@ -64,15 +61,17 @@ class PrincipalTest extends \PHPUnit_Framework_TestCase { ]; $props = $principal->getProperties($keys); - foreach ($keys as $key) $this->assertArrayHasKey($key, $props); + foreach ($keys as $key) { + $this->assertArrayHasKey($key, $props); + } $this->assertEquals('Mr. Admin', $props['{DAV:}displayname']); $this->assertEquals('admin@example.org', $props['{http://sabredav.org/ns}email-address']); } - function testUpdateProperties() { - + public function testUpdateProperties() + { $principalBackend = new PrincipalBackend\Mock(); $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); @@ -81,26 +80,24 @@ class PrincipalTest extends \PHPUnit_Framework_TestCase { $result = $principal->propPatch($propPatch); $result = $propPatch->commit(); $this->assertTrue($result); - } - function testGetPrincipalUrl() { - + public function testGetPrincipalUrl() + { $principalBackend = new PrincipalBackend\Mock(); $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); $this->assertEquals('principals/admin', $principal->getPrincipalUrl()); - } - function testGetAlternateUriSet() { - + public function testGetAlternateUriSet() + { $principalBackend = new PrincipalBackend\Mock(); $principal = new Principal($principalBackend, [ - 'uri' => 'principals/admin', - '{DAV:}displayname' => 'Mr. Admin', + 'uri' => 'principals/admin', + '{DAV:}displayname' => 'Mr. Admin', '{http://www.example.org/custom}custom' => 'Custom', '{http://sabredav.org/ns}email-address' => 'admin@example.org', - '{DAV:}alternate-URI-set' => [ + '{DAV:}alternate-URI-set' => [ 'mailto:admin+1@example.org', 'mailto:admin+2@example.org', 'mailto:admin@example.org', @@ -114,10 +111,10 @@ class PrincipalTest extends \PHPUnit_Framework_TestCase { ]; $this->assertEquals($expected, $principal->getAlternateUriSet()); - } - function testGetAlternateUriSetEmpty() { + public function testGetAlternateUriSetEmpty() + { $principalBackend = new PrincipalBackend\Mock(); $principal = new Principal($principalBackend, [ 'uri' => 'principals/admin', @@ -126,26 +123,24 @@ class PrincipalTest extends \PHPUnit_Framework_TestCase { $expected = []; $this->assertEquals($expected, $principal->getAlternateUriSet()); - } - function testGetGroupMemberSet() { - + public function testGetGroupMemberSet() + { $principalBackend = new PrincipalBackend\Mock(); $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); $this->assertEquals([], $principal->getGroupMemberSet()); - } - function testGetGroupMembership() { + public function testGetGroupMembership() + { $principalBackend = new PrincipalBackend\Mock(); $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); $this->assertEquals([], $principal->getGroupMembership()); - } - function testSetGroupMemberSet() { - + public function testSetGroupMemberSet() + { $principalBackend = new PrincipalBackend\Mock(); $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); $principal->setGroupMemberSet(['principals/foo']); @@ -153,27 +148,24 @@ class PrincipalTest extends \PHPUnit_Framework_TestCase { $this->assertEquals([ 'principals/admin' => ['principals/foo'], ], $principalBackend->groupMembers); - } - function testGetOwner() { - + public function testGetOwner() + { $principalBackend = new PrincipalBackend\Mock(); $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); $this->assertEquals('principals/admin', $principal->getOwner()); - } - function testGetGroup() { - + public function testGetGroup() + { $principalBackend = new PrincipalBackend\Mock(); $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); $this->assertNull($principal->getGroup()); - } - function testGetACl() { - + public function testGetACl() + { $principalBackend = new PrincipalBackend\Mock(); $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); $this->assertEquals([ @@ -181,28 +173,24 @@ class PrincipalTest extends \PHPUnit_Framework_TestCase { 'privilege' => '{DAV:}all', 'principal' => '{DAV:}owner', 'protected' => true, - ] + ], ], $principal->getACL()); - } /** * @expectedException \Sabre\DAV\Exception\Forbidden */ - function testSetACl() { - + public function testSetACl() + { $principalBackend = new PrincipalBackend\Mock(); $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); $principal->setACL([]); - } - function testGetSupportedPrivilegeSet() { - + public function testGetSupportedPrivilegeSet() + { $principalBackend = new PrincipalBackend\Mock(); $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); $this->assertNull($principal->getSupportedPrivilegeSet()); - } - } diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php index 2de0ba6a8..a1e9ee36c 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\DAVACL; use Sabre\DAV; @@ -8,10 +10,10 @@ use Sabre\HTTP; require_once 'Sabre/DAVACL/MockPrincipal.php'; require_once 'Sabre/DAVACL/MockACLNode.php'; -class SimplePluginTest extends \PHPUnit_Framework_TestCase { - - function testValues() { - +class SimplePluginTest extends \PHPUnit\Framework\TestCase +{ + public function testValues() + { $aclPlugin = new Plugin(); $this->assertEquals('acl', $aclPlugin->getPluginName()); $this->assertEquals( @@ -24,25 +26,24 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase { '{DAV:}expand-property', '{DAV:}principal-match', '{DAV:}principal-property-search', - '{DAV:}principal-search-property-set' + '{DAV:}principal-search-property-set', ], $aclPlugin->getSupportedReportSet('')); $this->assertEquals(['ACL'], $aclPlugin->getMethods('')); - $this->assertEquals( 'acl', $aclPlugin->getPluginInfo()['name'] ); } - function testGetFlatPrivilegeSet() { - + public function testGetFlatPrivilegeSet() + { $expected = [ '{DAV:}all' => [ - 'privilege' => '{DAV:}all', - 'abstract' => false, + 'privilege' => '{DAV:}all', + 'abstract' => false, 'aggregates' => [ '{DAV:}read', '{DAV:}write', @@ -50,8 +51,8 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase { 'concrete' => '{DAV:}all', ], '{DAV:}read' => [ - 'privilege' => '{DAV:}read', - 'abstract' => false, + 'privilege' => '{DAV:}read', + 'abstract' => false, 'aggregates' => [ '{DAV:}read-acl', '{DAV:}read-current-user-privilege-set', @@ -59,20 +60,20 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase { 'concrete' => '{DAV:}read', ], '{DAV:}read-acl' => [ - 'privilege' => '{DAV:}read-acl', - 'abstract' => false, + 'privilege' => '{DAV:}read-acl', + 'abstract' => false, 'aggregates' => [], - 'concrete' => '{DAV:}read-acl', + 'concrete' => '{DAV:}read-acl', ], '{DAV:}read-current-user-privilege-set' => [ - 'privilege' => '{DAV:}read-current-user-privilege-set', - 'abstract' => false, + 'privilege' => '{DAV:}read-current-user-privilege-set', + 'abstract' => false, 'aggregates' => [], - 'concrete' => '{DAV:}read-current-user-privilege-set', + 'concrete' => '{DAV:}read-current-user-privilege-set', ], '{DAV:}write' => [ - 'privilege' => '{DAV:}write', - 'abstract' => false, + 'privilege' => '{DAV:}write', + 'abstract' => false, 'aggregates' => [ '{DAV:}write-properties', '{DAV:}write-content', @@ -83,36 +84,35 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase { 'concrete' => '{DAV:}write', ], '{DAV:}write-properties' => [ - 'privilege' => '{DAV:}write-properties', - 'abstract' => false, + 'privilege' => '{DAV:}write-properties', + 'abstract' => false, 'aggregates' => [], - 'concrete' => '{DAV:}write-properties', + 'concrete' => '{DAV:}write-properties', ], '{DAV:}write-content' => [ - 'privilege' => '{DAV:}write-content', - 'abstract' => false, + 'privilege' => '{DAV:}write-content', + 'abstract' => false, 'aggregates' => [], - 'concrete' => '{DAV:}write-content', + 'concrete' => '{DAV:}write-content', ], '{DAV:}unlock' => [ - 'privilege' => '{DAV:}unlock', - 'abstract' => false, + 'privilege' => '{DAV:}unlock', + 'abstract' => false, 'aggregates' => [], - 'concrete' => '{DAV:}unlock', + 'concrete' => '{DAV:}unlock', ], '{DAV:}bind' => [ - 'privilege' => '{DAV:}bind', - 'abstract' => false, + 'privilege' => '{DAV:}bind', + 'abstract' => false, 'aggregates' => [], - 'concrete' => '{DAV:}bind', + 'concrete' => '{DAV:}bind', ], '{DAV:}unbind' => [ - 'privilege' => '{DAV:}unbind', - 'abstract' => false, + 'privilege' => '{DAV:}unbind', + 'abstract' => false, 'aggregates' => [], - 'concrete' => '{DAV:}unbind', + 'concrete' => '{DAV:}unbind', ], - ]; $plugin = new Plugin(); @@ -120,28 +120,24 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase { $server = new DAV\Server(); $server->addPlugin($plugin); $this->assertEquals($expected, $plugin->getFlatPrivilegeSet('')); - } - function testCurrentUserPrincipalsNotLoggedIn() { - + public function testCurrentUserPrincipalsNotLoggedIn() + { $acl = new Plugin(); $acl->allowUnauthenticatedAccess = false; $server = new DAV\Server(); $server->addPlugin($acl); $this->assertEquals([], $acl->getCurrentUserPrincipals()); - } - function testCurrentUserPrincipalsSimple() { - + public function testCurrentUserPrincipalsSimple() + { $tree = [ - new DAV\SimpleCollection('principals', [ new MockPrincipal('admin', 'principals/admin'), - ]) - + ]), ]; $acl = new Plugin(); @@ -153,23 +149,20 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase { $server->addPlugin($auth); //forcing login - $auth->beforeMethod(new HTTP\Request(), new HTTP\Response()); + $auth->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response()); $this->assertEquals(['principals/admin'], $acl->getCurrentUserPrincipals()); - } - function testCurrentUserPrincipalsGroups() { - + public function testCurrentUserPrincipalsGroups() + { $tree = [ - new DAV\SimpleCollection('principals', [ new MockPrincipal('admin', 'principals/admin', ['principals/administrators', 'principals/everyone']), new MockPrincipal('administrators', 'principals/administrators', ['principals/groups'], ['principals/admin']), new MockPrincipal('everyone', 'principals/everyone', [], ['principals/admin']), new MockPrincipal('groups', 'principals/groups', [], ['principals/administrators']), - ]) - + ]), ]; $acl = new Plugin(); @@ -181,7 +174,7 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase { $server->addPlugin($auth); //forcing login - $auth->beforeMethod(new HTTP\Request(), new HTTP\Response()); + $auth->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response()); $expected = [ 'principals/admin', @@ -194,11 +187,10 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase { // The second one should trigger the cache and be identical $this->assertEquals($expected, $acl->getCurrentUserPrincipals()); - } - function testGetACL() { - + public function testGetACL() + { $acl = [ [ 'principal' => 'principals/admin', @@ -210,7 +202,6 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase { ], ]; - $tree = [ new MockACLNode('foo', $acl), ]; @@ -221,11 +212,10 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase { $server->addPlugin($aclPlugin); $this->assertEquals($acl, $aclPlugin->getACL('foo')); - } - function testGetCurrentUserPrivilegeSet() { - + public function testGetCurrentUserPrivilegeSet() + { $acl = [ [ 'principal' => 'principals/admin', @@ -241,14 +231,12 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase { ], ]; - $tree = [ new MockACLNode('foo', $acl), new DAV\SimpleCollection('principals', [ new MockPrincipal('admin', 'principals/admin'), ]), - ]; $server = new DAV\Server($tree); @@ -260,7 +248,7 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase { $server->addPlugin($auth); //forcing login - $auth->beforeMethod(new HTTP\Request(), new HTTP\Response()); + $auth->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response()); $expected = [ '{DAV:}write', @@ -274,11 +262,10 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase { ]; $this->assertEquals($expected, $aclPlugin->getCurrentUserPrivilegeSet('foo')); - } - function testCheckPrivileges() { - + public function testCheckPrivileges() + { $acl = [ [ 'principal' => 'principals/admin', @@ -294,14 +281,12 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase { ], ]; - $tree = [ new MockACLNode('foo', $acl), new DAV\SimpleCollection('principals', [ new MockPrincipal('admin', 'principals/admin'), ]), - ]; $server = new DAV\Server($tree); @@ -316,6 +301,5 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase { //$auth->beforeMethod('GET','/'); $this->assertFalse($aclPlugin->checkPrivileges('foo', ['{DAV:}read'], Plugin::R_PARENT, false)); - } } |