[Pkg-owncloud-commits] [php-sabredav] 55/66: adopt unit tests for depth infinity
David Prévot
taffit at moszumanska.debian.org
Sat Jan 18 20:08:22 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository php-sabredav.
commit e0b550fc948894d2f55fb24dc8d97e9a017b66ce
Author: Thomas Müller <thomas.mueller at tmit.eu>
Date: Fri Jan 10 00:22:37 2014 +0100
adopt unit tests for depth infinity
---
tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php | 32 +++++++++++++-----------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php b/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php
index d52b6bf..e3e24d8 100644
--- a/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php
+++ b/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php
@@ -19,9 +19,11 @@ class ServerPropsInfiniteDepthTest extends AbstractServer {
if (file_exists(SABRE_TEMPDIR.'../.sabredav')) unlink(SABRE_TEMPDIR.'../.sabredav');
parent::setUp();
file_put_contents(SABRE_TEMPDIR . '/test2.txt', 'Test contents2');
- mkdir(SABRE_TEMPDIR . '/col');
- file_put_contents(SABRE_TEMPDIR . 'col/test.txt', 'Test contents');
+ mkdir(SABRE_TEMPDIR . '/col');
+ mkdir(SABRE_TEMPDIR . '/col/col');
+ file_put_contents(SABRE_TEMPDIR . 'col/col/test.txt', 'Test contents');
$this->server->addPlugin(new Locks\Plugin(new Locks\Backend\File(SABRE_TEMPDIR . '/.locksdb')));
+ $this->server->enablePropfindDepthInfinity = true;
}
@@ -37,7 +39,7 @@ class ServerPropsInfiniteDepthTest extends AbstractServer {
$serverVars = array(
'REQUEST_URI' => '/',
'REQUEST_METHOD' => 'PROPFIND',
- 'HTTP_DEPTH' => '1',
+ 'HTTP_DEPTH' => 'infinity',
);
$request = HTTP\Sapi::createFromServerArray($serverVars);
@@ -59,7 +61,7 @@ class ServerPropsInfiniteDepthTest extends AbstractServer {
$hasFired = true;
$self->assertEquals('', $path);
$self->assertEquals([], $properties);
- $self->assertEquals(1, $depth);
+ $self->assertEquals(-1, $depth);
});
@@ -85,8 +87,8 @@ class ServerPropsInfiniteDepthTest extends AbstractServer {
$this->assertEquals('/',(string)$data,'href element should have been /');
$data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:resourcetype');
- // 5 resources are to be returned: test.txt, test2.txt, col, dir and col/test.txt
- $this->assertEquals(5,count($data));
+ // 8 resources are to be returned: /, col, col/col, col/col/test.txt, dir, dir/child.txt, test.txt and test2.txt
+ $this->assertEquals(8,count($data));
}
@@ -106,22 +108,22 @@ class ServerPropsInfiniteDepthTest extends AbstractServer {
$xml->registerXPathNamespace('d','urn:DAV');
$data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry');
- $this->assertEquals(10,count($data),'We expected ten \'d:lockentry\' tags');
+ $this->assertEquals(16,count($data),'We expected sixteen \'d:lockentry\' tags');
$data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry/d:lockscope');
- $this->assertEquals(10,count($data),'We expected ten \'d:lockscope\' tags');
+ $this->assertEquals(16,count($data),'We expected sixteen \'d:lockscope\' tags');
$data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry/d:locktype');
- $this->assertEquals(10,count($data),'We expected ten \'d:locktype\' tags');
+ $this->assertEquals(16,count($data),'We expected sixteen \'d:locktype\' tags');
$data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry/d:lockscope/d:shared');
- $this->assertEquals(5,count($data),'We expected five \'d:shared\' tags');
+ $this->assertEquals(8,count($data),'We expected eight \'d:shared\' tags');
$data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry/d:lockscope/d:exclusive');
- $this->assertEquals(5,count($data),'We expected five \'d:exclusive\' tags');
+ $this->assertEquals(8,count($data),'We expected eight \'d:exclusive\' tags');
$data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry/d:locktype/d:write');
- $this->assertEquals(10,count($data),'We expected ten \'d:write\' tags');
+ $this->assertEquals(16,count($data),'We expected sixteen \'d:write\' tags');
}
function testLockDiscovery() {
@@ -140,7 +142,7 @@ class ServerPropsInfiniteDepthTest extends AbstractServer {
$xml->registerXPathNamespace('d','urn:DAV');
$data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:lockdiscovery');
- $this->assertEquals(5,count($data),'We expected a \'d:lockdiscovery\' tag');
+ $this->assertEquals(8,count($data),'We expected eight \'d:lockdiscovery\' tags');
}
@@ -170,7 +172,7 @@ class ServerPropsInfiniteDepthTest extends AbstractServer {
}
$val = $xml->xpath('/d:multistatus/d:response/d:propstat/d:status');
- $this->assertEquals(5,count($val),$body);
+ $this->assertEquals(8,count($val),$body);
$this->assertEquals('HTTP/1.1 404 Not Found',(string)$val[0]);
}
@@ -372,7 +374,7 @@ class ServerPropsInfiniteDepthTest extends AbstractServer {
$xpath='//bla:someprop';
$result = $xml->xpath($xpath);
- $this->assertEquals(5,count($result),'We couldn\'t find our new property in the response. Full response body:' . "\n" . $body);
+ $this->assertEquals(8,count($result),'We couldn\'t find our new property in the response. Full response body:' . "\n" . $body);
$this->assertEquals('somevalue',(string)$result[0],'We couldn\'t find our new property in the response. Full response body:' . "\n" . $body);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git
More information about the Pkg-owncloud-commits
mailing list