8 require_once
'Sabre/DAV/PartialUpdate/FileMock.php';
22 $this->plugin =
new Plugin();
23 $this->server->addPlugin($this->plugin);
31 $this->assertEquals(
'partialupdate', $this->plugin->getPluginName());
32 $this->assertEquals([
'sabredav-partialupdate'], $this->plugin->getFeatures());
35 ], $this->plugin->getHTTPMethods(
'partial'));
37 ], $this->plugin->getHTTPMethods(
''));
43 $this->node->put(
'aaaaaaaa');
45 'REQUEST_METHOD' =>
'PATCH',
46 'REQUEST_URI' =>
'/partial',
56 $this->node->put(
'aaaaaaaa');
57 $request =
new HTTP\Request(
'PATCH',
'/', [
'X-Update-Range' =>
'3-4']);
69 $this->node->put(
'aaaaaaaa');
70 $request =
new HTTP\Request(
'PATCH',
'/partial', [
'X-Update-Range' =>
'bytes=3-4']);
82 $this->node->put(
'aaaaaaaa');
83 $request =
new HTTP\Request(
'PATCH',
'/partial', [
'X-Update-Range' =>
'bytes=3-4',
'Content-Type' =>
'application/x-sabredav-partialupdate',
'Content-Length' =>
'3']);
95 $this->node->put(
'aaaaaaaa');
96 $request =
new HTTP\Request(
'PATCH',
'/partial', [
'X-Update-Range' =>
'bytes=3-5',
'Content-Type' =>
'application/x-sabredav-partialupdate']);
108 $this->node->put(
'aaaaaaaa');
109 $request =
new HTTP\Request(
'PATCH',
'/partial', [
'X-Update-Range' =>
'bytes=3-5',
'Content-Type' =>
'application/x-sabredav-partialupdate',
'Content-Length' => 3]);
116 $this->assertEquals(
'aaabbbaa', $this->node->get());
122 $this->node->put(
'aaaaa');
123 $request =
new HTTP\Request(
'PATCH',
'/partial', [
'X-Update-Range' =>
'bytes=3-',
'Content-Type' =>
'application/x-sabredav-partialupdate',
'Content-Length' =>
'3']);
130 $this->assertEquals(204,
$response->getStatus(),
'Full response body:' .
$response->getBodyAsString());
131 $this->assertEquals(
'aaabbb', $this->node->get());
foreach($paths as $path) $request
Partial update plugin (Patch method)
This class may be used as a basis for other webdav-related unittests.
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.