From 66effbfe0827fc61fff6d248797a894213ad20d6 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 28 May 2016 17:46:24 +0200 Subject: upgrade to sabre32 --- .../tests/Sabre/DAVACL/PluginPropertiesTest.php | 90 ++++++++++++---------- 1 file changed, 49 insertions(+), 41 deletions(-) (limited to 'vendor/sabre/dav/tests/Sabre/DAVACL/PluginPropertiesTest.php') diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginPropertiesTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginPropertiesTest.php index e5b7e1a3f..5762ac902 100644 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginPropertiesTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginPropertiesTest.php @@ -10,6 +10,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { function testPrincipalCollectionSet() { $plugin = new Plugin(); + $plugin->allowUnauthenticatedAccess = false; $plugin->principalCollectionSet = [ 'principals1', 'principals2', @@ -25,8 +26,8 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $result = $server->getPropertiesForPath('', $requestedProperties); $result = $result[0]; - $this->assertEquals(1,count($result[200])); - $this->assertArrayHasKey('{DAV:}principal-collection-set',$result[200]); + $this->assertEquals(1, count($result[200])); + $this->assertArrayHasKey('{DAV:}principal-collection-set', $result[200]); $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $result[200]['{DAV:}principal-collection-set']); $expected = [ @@ -56,8 +57,8 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $result = $fakeServer->getPropertiesForPath('', $requestedProperties); $result = $result[0]; - $this->assertEquals(1,count($result[200])); - $this->assertArrayHasKey('{DAV:}current-user-principal',$result[200]); + $this->assertEquals(1, count($result[200])); + $this->assertArrayHasKey('{DAV:}current-user-principal', $result[200]); $this->assertInstanceOf('Sabre\DAVACL\Xml\Property\Principal', $result[200]['{DAV:}current-user-principal']); $this->assertEquals(Xml\Property\Principal::UNAUTHENTICATED, $result[200]['{DAV:}current-user-principal']->getType()); @@ -67,8 +68,8 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $result = $fakeServer->getPropertiesForPath('', $requestedProperties); $result = $result[0]; - $this->assertEquals(1,count($result[200])); - $this->assertArrayHasKey('{DAV:}current-user-principal',$result[200]); + $this->assertEquals(1, count($result[200])); + $this->assertArrayHasKey('{DAV:}current-user-principal', $result[200]); $this->assertInstanceOf('Sabre\DAVACL\Xml\Property\Principal', $result[200]['{DAV:}current-user-principal']); $this->assertEquals(Xml\Property\Principal::HREF, $result[200]['{DAV:}current-user-principal']->getType()); $this->assertEquals('principals/admin/', $result[200]['{DAV:}current-user-principal']->getHref()); @@ -78,6 +79,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { function testSupportedPrivilegeSet() { $plugin = new Plugin(); + $plugin->allowUnauthenticatedAccess = false; $server = new DAV\Server(); $server->addPlugin($plugin); @@ -88,8 +90,8 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $result = $server->getPropertiesForPath('', $requestedProperties); $result = $result[0]; - $this->assertEquals(1,count($result[200])); - $this->assertArrayHasKey('{DAV:}supported-privilege-set',$result[200]); + $this->assertEquals(1, count($result[200])); + $this->assertArrayHasKey('{DAV:}supported-privilege-set', $result[200]); $this->assertInstanceOf('Sabre\\DAVACL\\Xml\\Property\\SupportedPrivilegeSet', $result[200]['{DAV:}supported-privilege-set']); $server = new DAV\Server(); @@ -98,26 +100,25 @@ 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' => 1, - '/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' => 8, - '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:privilege' => 8, - '/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:write-acl' => 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, ]; @@ -126,10 +127,10 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $dom2->loadXML($result); $dxpath = new \DOMXPath($dom2); - $dxpath->registerNamespace('d','DAV:'); - foreach($xpaths as $xpath=>$count) { + $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); } @@ -138,6 +139,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { function testACL() { $plugin = new Plugin(); + $plugin->allowUnauthenticatedAccess = false; $nodes = [ new MockACLNode('foo', [ @@ -147,7 +149,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { ] ]), new DAV\SimpleCollection('principals', [ - $principal = new MockPrincipal('admin','principals/admin'), + $principal = new MockPrincipal('admin', 'principals/admin'), ]), ]; @@ -167,8 +169,8 @@ 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->assertArrayHasKey('{DAV:}acl',$result[200]); + $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']); } @@ -176,6 +178,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { function testACLRestrictions() { $plugin = new Plugin(); + $plugin->allowUnauthenticatedAccess = false; $nodes = [ new MockACLNode('foo', [ @@ -185,7 +188,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { ] ]), new DAV\SimpleCollection('principals', [ - $principal = new MockPrincipal('admin','principals/admin'), + $principal = new MockPrincipal('admin', 'principals/admin'), ]), ]; @@ -205,8 +208,8 @@ 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->assertArrayHasKey('{DAV:}acl-restrictions',$result[200]); + $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']); } @@ -215,7 +218,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $tree = [ new DAV\SimpleCollection('principals', [ - $principal = new MockPrincipal('user','principals/user'), + $principal = new MockPrincipal('user', 'principals/user'), ]) ]; @@ -223,6 +226,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend()) //$fakeServer->addPlugin($plugin); $plugin = new Plugin(); + $plugin->allowUnauthenticatedAccess = false; $fakeServer->addPlugin($plugin); $requestedProperties = [ @@ -243,7 +247,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $tree = [ new DAV\SimpleCollection('principals', [ - $principal = new MockPrincipal('user','principals/user'), + $principal = new MockPrincipal('user', 'principals/user'), ]), ]; @@ -251,6 +255,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend()); //$fakeServer->addPlugin($plugin); $plugin = new Plugin(); + $plugin->allowUnauthenticatedAccess = false; $fakeServer->addPlugin($plugin); $requestedProperties = [ @@ -272,7 +277,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $tree = [ new DAV\SimpleCollection('principals', [ - $principal = new MockPrincipal('user','principals/user'), + $principal = new MockPrincipal('user', 'principals/user'), ]), ]; @@ -280,6 +285,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend()); //$fakeServer->addPlugin($plugin); $plugin = new Plugin(); + $plugin->allowUnauthenticatedAccess = false; $fakeServer->addPlugin($plugin); $requestedProperties = [ @@ -301,12 +307,13 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $tree = [ new DAV\SimpleCollection('principals', [ - $principal = new MockPrincipal('user','principals/user'), + $principal = new MockPrincipal('user', 'principals/user'), ]), ]; $fakeServer = new DAV\Server($tree); $plugin = new Plugin(); + $plugin->allowUnauthenticatedAccess = false; $fakeServer->addPlugin($plugin); $requestedProperties = [ @@ -328,12 +335,13 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase { $tree = [ new DAV\SimpleCollection('principals', [ - $principal = new MockPrincipal('user','principals/user'), + $principal = new MockPrincipal('user', 'principals/user'), ]), ]; $fakeServer = new DAV\Server($tree); $plugin = new Plugin(); + $plugin->allowUnauthenticatedAccess = false; $fakeServer->addPlugin($plugin); $requestedProperties = [ -- cgit v1.2.3