aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php')
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php312
1 files changed, 156 insertions, 156 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php
index ef0e473ae..6511d4e7d 100644
--- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php
@@ -35,13 +35,13 @@ class PluginTest extends DAV\AbstractServer {
function testGetFeatures() {
- $this->assertEquals(array(2),$this->locksPlugin->getFeatures());
+ $this->assertEquals([2], $this->locksPlugin->getFeatures());
}
function testGetHTTPMethods() {
- $this->assertEquals(array('LOCK','UNLOCK'),$this->locksPlugin->getHTTPMethods(''));
+ $this->assertEquals(['LOCK', 'UNLOCK'], $this->locksPlugin->getHTTPMethods(''));
}
@@ -51,10 +51,10 @@ class PluginTest extends DAV\AbstractServer {
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(array(
+ $this->assertEquals([
'X-Sabre-Version' => [DAV\Version::VERSION],
- 'Content-Type' => ['application/xml; charset=utf-8'],
- ),
+ 'Content-Type' => ['application/xml; charset=utf-8'],
+ ],
$this->response->getHeaders()
);
@@ -77,16 +77,16 @@ class PluginTest extends DAV\AbstractServer {
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
- $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
+ $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
- $this->assertEquals(200, $this->response->status,'Got an incorrect status back. Response body: ' . $this->response->body);
+ $this->assertEquals(200, $this->response->status, 'Got an incorrect status back. Response body: ' . $this->response->body);
- $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');
+ $xml->registerXPathNamespace('d', 'urn:DAV');
- $elements = array(
+ $elements = [
'/d:prop',
'/d:prop/d:lockdiscovery',
'/d:prop/d:lockdiscovery/d:activelock',
@@ -101,18 +101,18 @@ class PluginTest extends DAV\AbstractServer {
'/d:prop/d:lockdiscovery/d:activelock/d:timeout',
'/d:prop/d:lockdiscovery/d:activelock/d:locktoken',
'/d:prop/d:lockdiscovery/d:activelock/d:locktoken/d:href',
- );
+ ];
- foreach($elements as $elem) {
+ foreach ($elements as $elem) {
$data = $xml->xpath($elem);
- $this->assertEquals(1,count($data),'We expected 1 match for the xpath expression "' . $elem . '". ' . count($data) . ' were found. Full response body: ' . $this->response->body);
+ $this->assertEquals(1, count($data), 'We expected 1 match for the xpath expression "' . $elem . '". ' . count($data) . ' were found. Full response body: ' . $this->response->body);
}
$depth = $xml->xpath('/d:prop/d:lockdiscovery/d:activelock/d:depth');
- $this->assertEquals('infinity',(string)$depth[0]);
+ $this->assertEquals('infinity', (string)$depth[0]);
$token = $xml->xpath('/d:prop/d:lockdiscovery/d:activelock/d:locktoken/d:href');
- $this->assertEquals($this->response->getHeader('Lock-Token'),'<' . (string)$token[0] . '>','Token in response body didn\'t match token in response header.');
+ $this->assertEquals($this->response->getHeader('Lock-Token'), '<' . (string)$token[0] . '>', 'Token in response body didn\'t match token in response header.');
}
@@ -139,7 +139,7 @@ class PluginTest extends DAV\AbstractServer {
$this->server->exec();
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
$this->assertEquals(423, $this->response->status, 'Full response: ' . $this->response->body);
@@ -174,9 +174,9 @@ class PluginTest extends DAV\AbstractServer {
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
- $this->assertEquals(200, $this->response->status,'We received an incorrect status code. Full response body: ' . $this->response->getBody());
+ $this->assertEquals(200, $this->response->status, 'We received an incorrect status code. Full response body: ' . $this->response->getBody());
}
@@ -209,9 +209,9 @@ class PluginTest extends DAV\AbstractServer {
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
- $this->assertEquals(423, $this->response->getStatus(),'We received an incorrect status code. Full response body: ' . $this->response->getBody());
+ $this->assertEquals(423, $this->response->getStatus(), 'We received an incorrect status code. Full response body: ' . $this->response->getBody());
}
@@ -233,8 +233,8 @@ class PluginTest extends DAV\AbstractServer {
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
- $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
+ $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
$this->assertEquals(201, $this->response->status);
@@ -251,7 +251,7 @@ class PluginTest extends DAV\AbstractServer {
$this->assertEquals([
'X-Sabre-Version' => [DAV\Version::VERSION],
- 'Content-Type' => ['application/xml; charset=utf-8'],
+ 'Content-Type' => ['application/xml; charset=utf-8'],
],
$this->response->getHeaders()
);
@@ -271,7 +271,7 @@ class PluginTest extends DAV\AbstractServer {
$this->assertEquals([
'X-Sabre-Version' => [DAV\Version::VERSION],
- 'Content-Type' => ['application/xml; charset=utf-8'],
+ 'Content-Type' => ['application/xml; charset=utf-8'],
],
$this->response->getHeaders()
);
@@ -298,8 +298,8 @@ class PluginTest extends DAV\AbstractServer {
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
- $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
+ $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
$this->assertEquals(200, $this->response->status);
@@ -308,8 +308,8 @@ class PluginTest extends DAV\AbstractServer {
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
- $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
+ $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
$this->assertEquals(423, $this->response->status);
@@ -340,10 +340,10 @@ class PluginTest extends DAV\AbstractServer {
$this->server->httpResponse = new HTTP\ResponseMock();
$this->server->invokeMethod($request, $this->server->httpResponse);
- $this->assertEquals(204,$this->server->httpResponse->status,'Got an incorrect status code. Full response body: ' . $this->response->body);
+ $this->assertEquals(204, $this->server->httpResponse->status, 'Got an incorrect status code. Full response body: ' . $this->response->body);
$this->assertEquals([
'X-Sabre-Version' => [DAV\Version::VERSION],
- 'Content-Length' => ['0'],
+ 'Content-Length' => ['0'],
],
$this->server->httpResponse->getHeaders()
);
@@ -372,17 +372,17 @@ class PluginTest extends DAV\AbstractServer {
$lockToken = $this->server->httpResponse->getHeader('Lock-Token');
// See Issue 123
- $lockToken = trim($lockToken,'<>');
+ $lockToken = trim($lockToken, '<>');
$request = new HTTP\Request('UNLOCK', '/test.txt', ['Lock-Token' => $lockToken]);
$this->server->httpRequest = $request;
$this->server->httpResponse = new HTTP\ResponseMock();
$this->server->invokeMethod($request, $this->server->httpResponse);
- $this->assertEquals(204, $this->server->httpResponse->status,'Got an incorrect status code. Full response body: ' . $this->response->body);
+ $this->assertEquals(204, $this->server->httpResponse->status, 'Got an incorrect status code. Full response body: ' . $this->response->body);
$this->assertEquals([
'X-Sabre-Version' => [DAV\Version::VERSION],
- 'Content-Length' => ['0'],
+ 'Content-Length' => ['0'],
],
$this->server->httpResponse->getHeaders()
);
@@ -396,7 +396,7 @@ class PluginTest extends DAV\AbstractServer {
function testLockRetainOwner() {
$request = HTTP\Sapi::createFromServerArray([
- 'REQUEST_URI' => '/test.txt',
+ 'REQUEST_URI' => '/test.txt',
'REQUEST_METHOD' => 'LOCK',
]);
$this->server->httpRequest = $request;
@@ -412,8 +412,8 @@ class PluginTest extends DAV\AbstractServer {
$lockToken = $this->server->httpResponse->getHeader('Lock-Token');
$locks = $this->locksPlugin->getLocks('test.txt');
- $this->assertEquals(1,count($locks));
- $this->assertEquals('Evert',$locks[0]->owner);
+ $this->assertEquals(1, count($locks));
+ $this->assertEquals('Evert', $locks[0]->owner);
}
@@ -423,10 +423,10 @@ class PluginTest extends DAV\AbstractServer {
*/
function testLockPutBadToken() {
- $serverVars = array(
+ $serverVars = [
'REQUEST_URI' => '/test.txt',
'REQUEST_METHOD' => 'LOCK',
- );
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody('<?xml version="1.0"?>
@@ -441,24 +441,24 @@ class PluginTest extends DAV\AbstractServer {
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
- $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
+ $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
$this->assertEquals(200, $this->response->status);
- $serverVars = array(
+ $serverVars = [
'REQUEST_URI' => '/test.txt',
'REQUEST_METHOD' => 'PUT',
- 'HTTP_IF' => '(<opaquelocktoken:token1>)',
- );
+ 'HTTP_IF' => '(<opaquelocktoken:token1>)',
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody('newbody');
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
- $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
+ $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
// $this->assertEquals('412 Precondition failed',$this->response->status);
$this->assertEquals(423, $this->response->status);
@@ -470,10 +470,10 @@ class PluginTest extends DAV\AbstractServer {
*/
function testLockDeleteParent() {
- $serverVars = array(
+ $serverVars = [
'REQUEST_URI' => '/dir/child.txt',
'REQUEST_METHOD' => 'LOCK',
- );
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody('<?xml version="1.0"?>
@@ -488,22 +488,22 @@ class PluginTest extends DAV\AbstractServer {
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
- $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
+ $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
$this->assertEquals(200, $this->response->status);
- $serverVars = array(
+ $serverVars = [
'REQUEST_URI' => '/dir',
'REQUEST_METHOD' => 'DELETE',
- );
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$this->server->httpRequest = $request;
$this->server->exec();
$this->assertEquals(423, $this->response->status);
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
}
/**
@@ -511,10 +511,10 @@ class PluginTest extends DAV\AbstractServer {
*/
function testLockDeleteSucceed() {
- $serverVars = array(
+ $serverVars = [
'REQUEST_URI' => '/dir/child.txt',
'REQUEST_METHOD' => 'LOCK',
- );
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody('<?xml version="1.0"?>
@@ -529,23 +529,23 @@ class PluginTest extends DAV\AbstractServer {
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
- $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
+ $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
$this->assertEquals(200, $this->response->status);
- $serverVars = array(
+ $serverVars = [
'REQUEST_URI' => '/dir/child.txt',
'REQUEST_METHOD' => 'DELETE',
- 'HTTP_IF' => '(' . $this->response->getHeader('Lock-Token') . ')',
- );
+ 'HTTP_IF' => '(' . $this->response->getHeader('Lock-Token') . ')',
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$this->server->httpRequest = $request;
$this->server->exec();
$this->assertEquals(204, $this->response->status);
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
}
@@ -554,10 +554,10 @@ class PluginTest extends DAV\AbstractServer {
*/
function testLockCopyLockSource() {
- $serverVars = array(
+ $serverVars = [
'REQUEST_URI' => '/dir/child.txt',
'REQUEST_METHOD' => 'LOCK',
- );
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody('<?xml version="1.0"?>
@@ -572,23 +572,23 @@ class PluginTest extends DAV\AbstractServer {
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
- $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
+ $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
$this->assertEquals(200, $this->response->status);
- $serverVars = array(
- 'REQUEST_URI' => '/dir/child.txt',
- 'REQUEST_METHOD' => 'COPY',
+ $serverVars = [
+ 'REQUEST_URI' => '/dir/child.txt',
+ 'REQUEST_METHOD' => 'COPY',
'HTTP_DESTINATION' => '/dir/child2.txt',
- );
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(201, $this->response->status,'Copy must succeed if only the source is locked, but not the destination');
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
+ $this->assertEquals(201, $this->response->status, 'Copy must succeed if only the source is locked, but not the destination');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
}
/**
@@ -596,10 +596,10 @@ class PluginTest extends DAV\AbstractServer {
*/
function testLockCopyLockDestination() {
- $serverVars = array(
+ $serverVars = [
'REQUEST_URI' => '/dir/child2.txt',
'REQUEST_METHOD' => 'LOCK',
- );
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody('<?xml version="1.0"?>
@@ -614,23 +614,23 @@ class PluginTest extends DAV\AbstractServer {
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
- $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
+ $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
$this->assertEquals(201, $this->response->status);
- $serverVars = array(
- 'REQUEST_URI' => '/dir/child.txt',
- 'REQUEST_METHOD' => 'COPY',
+ $serverVars = [
+ 'REQUEST_URI' => '/dir/child.txt',
+ 'REQUEST_METHOD' => 'COPY',
'HTTP_DESTINATION' => '/dir/child2.txt',
- );
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(423, $this->response->status,'Copy must succeed if only the source is locked, but not the destination');
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
+ $this->assertEquals(423, $this->response->status, 'Copy must succeed if only the source is locked, but not the destination');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
}
@@ -639,10 +639,10 @@ class PluginTest extends DAV\AbstractServer {
*/
function testLockMoveLockSourceLocked() {
- $serverVars = array(
+ $serverVars = [
'REQUEST_URI' => '/dir/child.txt',
'REQUEST_METHOD' => 'LOCK',
- );
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody('<?xml version="1.0"?>
@@ -657,23 +657,23 @@ class PluginTest extends DAV\AbstractServer {
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
- $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
+ $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
$this->assertEquals(200, $this->response->status);
- $serverVars = array(
- 'REQUEST_URI' => '/dir/child.txt',
- 'REQUEST_METHOD' => 'MOVE',
+ $serverVars = [
+ 'REQUEST_URI' => '/dir/child.txt',
+ 'REQUEST_METHOD' => 'MOVE',
'HTTP_DESTINATION' => '/dir/child2.txt',
- );
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(423, $this->response->status,'Copy must succeed if only the source is locked, but not the destination');
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
+ $this->assertEquals(423, $this->response->status, 'Copy must succeed if only the source is locked, but not the destination');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
}
@@ -682,10 +682,10 @@ class PluginTest extends DAV\AbstractServer {
*/
function testLockMoveLockSourceSucceed() {
- $serverVars = array(
+ $serverVars = [
'REQUEST_URI' => '/dir/child.txt',
'REQUEST_METHOD' => 'LOCK',
- );
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody('<?xml version="1.0"?>
@@ -700,23 +700,23 @@ class PluginTest extends DAV\AbstractServer {
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
- $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
+ $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
$this->assertEquals(200, $this->response->status);
- $serverVars = array(
- 'REQUEST_URI' => '/dir/child.txt',
- 'REQUEST_METHOD' => 'MOVE',
+ $serverVars = [
+ 'REQUEST_URI' => '/dir/child.txt',
+ 'REQUEST_METHOD' => 'MOVE',
'HTTP_DESTINATION' => '/dir/child2.txt',
- 'HTTP_IF' => '(' . $this->response->getHeader('Lock-Token') . ')',
- );
+ 'HTTP_IF' => '(' . $this->response->getHeader('Lock-Token') . ')',
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(201, $this->response->status,'A valid lock-token was provided for the source, so this MOVE operation must succeed. Full response body: ' . $this->response->body);
+ $this->assertEquals(201, $this->response->status, 'A valid lock-token was provided for the source, so this MOVE operation must succeed. Full response body: ' . $this->response->body);
}
@@ -725,10 +725,10 @@ class PluginTest extends DAV\AbstractServer {
*/
function testLockMoveLockDestination() {
- $serverVars = array(
+ $serverVars = [
'REQUEST_URI' => '/dir/child2.txt',
'REQUEST_METHOD' => 'LOCK',
- );
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody('<?xml version="1.0"?>
@@ -743,23 +743,23 @@ class PluginTest extends DAV\AbstractServer {
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
- $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
+ $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
$this->assertEquals(201, $this->response->status);
- $serverVars = array(
- 'REQUEST_URI' => '/dir/child.txt',
- 'REQUEST_METHOD' => 'MOVE',
+ $serverVars = [
+ 'REQUEST_URI' => '/dir/child.txt',
+ 'REQUEST_METHOD' => 'MOVE',
'HTTP_DESTINATION' => '/dir/child2.txt',
- );
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(423, $this->response->status,'Copy must succeed if only the source is locked, but not the destination');
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
+ $this->assertEquals(423, $this->response->status, 'Copy must succeed if only the source is locked, but not the destination');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
}
/**
@@ -767,11 +767,11 @@ class PluginTest extends DAV\AbstractServer {
*/
function testLockMoveLockParent() {
- $serverVars = array(
+ $serverVars = [
'REQUEST_URI' => '/dir',
'REQUEST_METHOD' => 'LOCK',
- 'HTTP_DEPTH' => 'infinite',
- );
+ 'HTTP_DEPTH' => 'infinite',
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody('<?xml version="1.0"?>
@@ -786,24 +786,24 @@ class PluginTest extends DAV\AbstractServer {
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
- $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
+ $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
- $this->assertEquals(200,$this->response->status);
+ $this->assertEquals(200, $this->response->status);
- $serverVars = array(
- 'REQUEST_URI' => '/dir/child.txt',
- 'REQUEST_METHOD' => 'MOVE',
+ $serverVars = [
+ 'REQUEST_URI' => '/dir/child.txt',
+ 'REQUEST_METHOD' => 'MOVE',
'HTTP_DESTINATION' => '/dir/child2.txt',
- 'HTTP_IF' => '</dir> (' . $this->response->getHeader('Lock-Token') . ')',
- );
+ 'HTTP_IF' => '</dir> (' . $this->response->getHeader('Lock-Token') . ')',
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(201, $this->response->status,'We locked the parent of both the source and destination, but the move didn\'t succeed.');
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
+ $this->assertEquals(201, $this->response->status, 'We locked the parent of both the source and destination, but the move didn\'t succeed.');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
}
@@ -812,10 +812,10 @@ class PluginTest extends DAV\AbstractServer {
*/
function testLockPutGoodToken() {
- $serverVars = array(
+ $serverVars = [
'REQUEST_URI' => '/test.txt',
'REQUEST_METHOD' => 'LOCK',
- );
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody('<?xml version="1.0"?>
@@ -830,24 +830,24 @@ class PluginTest extends DAV\AbstractServer {
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
- $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
+ $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
$this->assertEquals(200, $this->response->status);
- $serverVars = array(
+ $serverVars = [
'REQUEST_URI' => '/test.txt',
'REQUEST_METHOD' => 'PUT',
- 'HTTP_IF' => '('.$this->response->getHeader('Lock-Token').')',
- );
+ 'HTTP_IF' => '(' . $this->response->getHeader('Lock-Token') . ')',
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody('newbody');
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
- $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
+ $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
$this->assertEquals(204, $this->response->status);
@@ -871,22 +871,22 @@ class PluginTest extends DAV\AbstractServer {
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
- $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
+ $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
$this->assertEquals(201, $this->response->getStatus());
$request = new HTTP\Request(
'PUT',
'/test.txt',
- ['If' => '</unrelated.txt> ('.$this->response->getHeader('Lock-Token').')']
+ ['If' => '</unrelated.txt> (' . $this->response->getHeader('Lock-Token') . ')']
);
$request->setBody('newbody');
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type'));
- $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
+ $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type'));
+ $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')');
$this->assertEquals(204, $this->response->status);
@@ -894,11 +894,11 @@ class PluginTest extends DAV\AbstractServer {
function testPutWithIncorrectETag() {
- $serverVars = array(
+ $serverVars = [
'REQUEST_URI' => '/test.txt',
'REQUEST_METHOD' => 'PUT',
- 'HTTP_IF' => '(["etag1"])',
- );
+ 'HTTP_IF' => '(["etag1"])',
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody('newbody');
@@ -920,14 +920,14 @@ class PluginTest extends DAV\AbstractServer {
$filename = SABRE_TEMPDIR . '/test.txt';
$etag = sha1(
fileinode($filename) .
- filesize($filename ) .
+ filesize($filename) .
filemtime($filename)
);
- $serverVars = array(
+ $serverVars = [
'REQUEST_URI' => '/test.txt',
'REQUEST_METHOD' => 'PUT',
- 'HTTP_IF' => '(["'.$etag.'"])',
- );
+ 'HTTP_IF' => '(["' . $etag . '"])',
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody('newbody');
@@ -939,11 +939,11 @@ class PluginTest extends DAV\AbstractServer {
function testDeleteWithETagOnCollection() {
- $serverVars = array(
+ $serverVars = [
'REQUEST_URI' => '/dir',
'REQUEST_METHOD' => 'DELETE',
- 'HTTP_IF' => '(["etag1"])',
- );
+ 'HTTP_IF' => '(["etag1"])',
+ ];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$this->server->httpRequest = $request;
@@ -954,9 +954,9 @@ class PluginTest extends DAV\AbstractServer {
function testGetTimeoutHeader() {
- $request = HTTP\Sapi::createFromServerArray(array(
+ $request = HTTP\Sapi::createFromServerArray([
'HTTP_TIMEOUT' => 'second-100',
- ));
+ ]);
$this->server->httpRequest = $request;
$this->assertEquals(100, $this->locksPlugin->getTimeoutHeader());
@@ -965,9 +965,9 @@ class PluginTest extends DAV\AbstractServer {
function testGetTimeoutHeaderTwoItems() {
- $request = HTTP\Sapi::createFromServerArray(array(
+ $request = HTTP\Sapi::createFromServerArray([
'HTTP_TIMEOUT' => 'second-5, infinite',
- ));
+ ]);
$this->server->httpRequest = $request;
$this->assertEquals(5, $this->locksPlugin->getTimeoutHeader());
@@ -976,9 +976,9 @@ class PluginTest extends DAV\AbstractServer {
function testGetTimeoutHeaderInfinite() {
- $request = HTTP\Sapi::createFromServerArray(array(
+ $request = HTTP\Sapi::createFromServerArray([
'HTTP_TIMEOUT' => 'infinite, second-5',
- ));
+ ]);
$this->server->httpRequest = $request;
$this->assertEquals(LockInfo::TIMEOUT_INFINITE, $this->locksPlugin->getTimeoutHeader());
@@ -990,9 +990,9 @@ class PluginTest extends DAV\AbstractServer {
*/
function testGetTimeoutHeaderInvalid() {
- $request = HTTP\Sapi::createFromServerArray(array(
+ $request = HTTP\Sapi::createFromServerArray([
'HTTP_TIMEOUT' => 'yourmom',
- ));
+ ]);
$this->server->httpRequest = $request;
$this->locksPlugin->getTimeoutHeader();