aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-11-10 12:49:51 +0000
committerMario <mario@mariovavti.com>2019-11-10 14:10:03 +0100
commit580c3f4ffe9608d2beb56d418c68b3b112420e76 (patch)
tree82335d01179ac361d3f547a4b8e8c598d302e9f3 /vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php
parentd22766f458a8539a40a57f3946459a9be1f21cd6 (diff)
downloadvolse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.tar.gz
volse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.tar.bz2
volse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.zip
another bulk of composer updates
(cherry picked from commit 6685381fd8db507493c3d7c1793f8c05c681bbce)
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php')
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php108
1 files changed, 52 insertions, 56 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php
index 253200be7..462fba664 100644
--- a/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\DAV;
use Sabre\HTTP;
@@ -7,95 +9,93 @@ use Sabre\HTTP;
require_once 'Sabre/HTTP/ResponseMock.php';
require_once 'Sabre/DAV/AbstractServer.php';
-class ServerPropsTest extends AbstractServer {
-
- protected function getRootNode() {
-
+class ServerPropsTest extends AbstractServer
+{
+ protected function getRootNode()
+ {
return new FSExt\Directory(SABRE_TEMPDIR);
-
}
- function setUp() {
-
- if (file_exists(SABRE_TEMPDIR . '../.sabredav')) unlink(SABRE_TEMPDIR . '../.sabredav');
+ public function setUp()
+ {
+ 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');
- $this->server->addPlugin(new Locks\Plugin(new Locks\Backend\File(SABRE_TEMPDIR . '/.locksdb')));
-
+ file_put_contents(SABRE_TEMPDIR.'/test2.txt', 'Test contents2');
+ mkdir(SABRE_TEMPDIR.'/col');
+ file_put_contents(SABRE_TEMPDIR.'col/test.txt', 'Test contents');
+ $this->server->addPlugin(new Locks\Plugin(new Locks\Backend\File(SABRE_TEMPDIR.'/.locksdb')));
}
- function tearDown() {
-
+ public function tearDown()
+ {
parent::tearDown();
- if (file_exists(SABRE_TEMPDIR . '../.locksdb')) unlink(SABRE_TEMPDIR . '../.locksdb');
-
+ if (file_exists(SABRE_TEMPDIR.'../.locksdb')) {
+ unlink(SABRE_TEMPDIR.'../.locksdb');
+ }
}
- private function sendRequest($body, $path = '/', $headers = ['Depth' => '0']) {
-
+ private function sendRequest($body, $path = '/', $headers = ['Depth' => '0'])
+ {
$request = new HTTP\Request('PROPFIND', $path, $headers, $body);
$this->server->httpRequest = $request;
$this->server->exec();
-
}
- function testPropFindEmptyBody() {
-
- $this->sendRequest("");
+ public function testPropFindEmptyBody()
+ {
+ $this->sendRequest('');
$this->assertEquals(207, $this->response->status);
$this->assertEquals([
'X-Sabre-Version' => [Version::VERSION],
- 'Content-Type' => ['application/xml; charset=utf-8'],
- 'DAV' => ['1, 3, extended-mkcol, 2'],
- 'Vary' => ['Brief,Prefer'],
+ 'Content-Type' => ['application/xml; charset=utf-8'],
+ 'DAV' => ['1, 3, extended-mkcol, 2'],
+ 'Vary' => ['Brief,Prefer'],
],
$this->response->getHeaders()
);
- $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", "xmlns\\1=\"urn:DAV\"", $this->response->body);
+ $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->body);
$xml = simplexml_load_string($body);
$xml->registerXPathNamespace('d', 'urn:DAV');
list($data) = $xml->xpath('/d:multistatus/d:response/d:href');
- $this->assertEquals('/', (string)$data, 'href element should have been /');
+ $this->assertEquals('/', (string) $data, 'href element should have been /');
$data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:resourcetype');
$this->assertEquals(1, count($data));
-
}
- function testPropFindEmptyBodyFile() {
-
- $this->sendRequest("", '/test2.txt', []);
+ public function testPropFindEmptyBodyFile()
+ {
+ $this->sendRequest('', '/test2.txt', []);
$this->assertEquals(207, $this->response->status);
$this->assertEquals([
'X-Sabre-Version' => [Version::VERSION],
- 'Content-Type' => ['application/xml; charset=utf-8'],
- 'DAV' => ['1, 3, extended-mkcol, 2'],
- 'Vary' => ['Brief,Prefer'],
+ 'Content-Type' => ['application/xml; charset=utf-8'],
+ 'DAV' => ['1, 3, extended-mkcol, 2'],
+ 'Vary' => ['Brief,Prefer'],
],
$this->response->getHeaders()
);
- $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", "xmlns\\1=\"urn:DAV\"", $this->response->body);
+ $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->body);
$xml = simplexml_load_string($body);
$xml->registerXPathNamespace('d', 'urn:DAV');
list($data) = $xml->xpath('/d:multistatus/d:response/d:href');
- $this->assertEquals('/test2.txt', (string)$data, 'href element should have been /test2.txt');
+ $this->assertEquals('/test2.txt', (string) $data, 'href element should have been /test2.txt');
$data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:getcontentlength');
$this->assertEquals(1, count($data));
-
}
- function testSupportedLocks() {
-
+ public function testSupportedLocks()
+ {
$xml = '<?xml version="1.0"?>
<d:propfind xmlns:d="DAV:">
<d:prop>
@@ -105,7 +105,7 @@ class ServerPropsTest extends AbstractServer {
$this->sendRequest($xml);
- $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", "xmlns\\1=\"urn:DAV\"", $this->response->body);
+ $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->body);
$xml = simplexml_load_string($body);
$xml->registerXPathNamespace('d', 'urn:DAV');
@@ -128,8 +128,8 @@ class ServerPropsTest extends AbstractServer {
$this->assertEquals(2, count($data), 'We expected two \'d:write\' tags');
}
- function testLockDiscovery() {
-
+ public function testLockDiscovery()
+ {
$xml = '<?xml version="1.0"?>
<d:propfind xmlns:d="DAV:">
<d:prop>
@@ -139,17 +139,16 @@ class ServerPropsTest extends AbstractServer {
$this->sendRequest($xml);
- $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", "xmlns\\1=\"urn:DAV\"", $this->response->body);
+ $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->body);
$xml = simplexml_load_string($body);
$xml->registerXPathNamespace('d', 'urn:DAV');
$data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:lockdiscovery');
$this->assertEquals(1, count($data), 'We expected a \'d:lockdiscovery\' tag');
-
}
- function testUnknownProperty() {
-
+ public function testUnknownProperty()
+ {
$xml = '<?xml version="1.0"?>
<d:propfind xmlns:d="DAV:">
<d:prop>
@@ -158,7 +157,7 @@ class ServerPropsTest extends AbstractServer {
</d:propfind>';
$this->sendRequest($xml);
- $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", "xmlns\\1=\"urn:DAV\"", $this->response->body);
+ $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->body);
$xml = simplexml_load_string($body);
$xml->registerXPathNamespace('d', 'urn:DAV');
$pathTests = [
@@ -170,17 +169,16 @@ class ServerPropsTest extends AbstractServer {
'/d:multistatus/d:response/d:propstat/d:prop/d:macaroni',
];
foreach ($pathTests as $test) {
- $this->assertTrue(count($xml->xpath($test)) == true, 'We expected the ' . $test . ' element to appear in the response, we got: ' . $body);
+ $this->assertTrue(true == count($xml->xpath($test)), 'We expected the '.$test.' element to appear in the response, we got: '.$body);
}
$val = $xml->xpath('/d:multistatus/d:response/d:propstat/d:status');
$this->assertEquals(1, count($val), $body);
- $this->assertEquals('HTTP/1.1 404 Not Found', (string)$val[0]);
-
+ $this->assertEquals('HTTP/1.1 404 Not Found', (string) $val[0]);
}
- function testParsePropPatchRequest() {
-
+ public function testParsePropPatchRequest()
+ {
$body = '<?xml version="1.0"?>
<d:propertyupdate xmlns:d="DAV:" xmlns:s="http://sabredav.org/NS/test">
<d:set><d:prop><s:someprop>somevalue</s:someprop></d:prop></d:set>
@@ -191,11 +189,9 @@ class ServerPropsTest extends AbstractServer {
$result = $this->server->xml->parse($body);
$this->assertEquals([
- '{http://sabredav.org/NS/test}someprop' => 'somevalue',
+ '{http://sabredav.org/NS/test}someprop' => 'somevalue',
'{http://sabredav.org/NS/test}someprop2' => null,
'{http://sabredav.org/NS/test}someprop3' => null,
], $result->properties);
-
}
-
}