[Pkg-owncloud-commits] [php-sabredav] 93/163: Making the tests pass for master as well. #439
David Prévot
taffit at moszumanska.debian.org
Tue May 20 18:54:57 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag upstream/2.0.0_beta1
in repository php-sabredav.
commit fd7af0e3f89e08cb89599cf1682badc3d5de8ccc
Author: Evert Pot <evert at rooftopsolutions.nl>
Date: Sun Apr 27 23:07:54 2014 -0400
Making the tests pass for master as well. #439
---
lib/Sabre/DAV/PartialUpdate/Plugin.php | 6 ++--
.../Sabre/DAV/PartialUpdate/SpecificationTest.php | 38 +++++++++++-----------
2 files changed, 21 insertions(+), 23 deletions(-)
diff --git a/lib/Sabre/DAV/PartialUpdate/Plugin.php b/lib/Sabre/DAV/PartialUpdate/Plugin.php
index 512c34f..c92ec28 100644
--- a/lib/Sabre/DAV/PartialUpdate/Plugin.php
+++ b/lib/Sabre/DAV/PartialUpdate/Plugin.php
@@ -118,7 +118,7 @@ class Plugin extends DAV\ServerPlugin {
$path = $request->getPath();
// Get the node. Will throw a 404 if not found
- $node = $this->server->tree->getNodeForPath($uri);
+ $node = $this->server->tree->getNodeForPath($path);
if (!$node instanceof IFile && !$node instanceof IPatchSupport) {
throw new DAV\Exception\MethodNotAllowed('The target resource does not support the PATCH method.');
}
@@ -155,10 +155,8 @@ class Plugin extends DAV\ServerPlugin {
}
break;
}
- // Checking If-None-Match and related headers.
- if (!$this->server->checkPreconditions()) return;
- if (!$this->server->broadcastEvent('beforeWriteContent',array($uri, $node, null)))
+ if (!$this->server->emit('beforeWriteContent', [$path, $node, null]))
return;
$body = $this->server->httpRequest->getBody();
diff --git a/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php b/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php
index 7abe69c..31be2a1 100644
--- a/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php
+++ b/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php
@@ -42,21 +42,21 @@ class SpecificationTest extends \PHPUnit_Framework_TestCase {
*/
public function testUpdateRange($headerValue, $httpStatus, $endResult, $contentLength = 4) {
- $vars = array(
- 'REQUEST_METHOD' => 'PATCH',
- 'HTTP_CONTENT_TYPE' => 'application/x-sabredav-partialupdate',
- 'HTTP_X_UPDATE_RANGE' => $headerValue,
- 'REQUEST_URI' => '/foobar.txt',
- );
+ $headers = [
+ 'Content-Type' => 'application/x-sabredav-partialupdate',
+ 'X-Update-Range' => $headerValue,
+ ];
+
if ($contentLength) {
- $vars['HTTP_CONTENT_LENGTH'] = (string)$contentLength;
+ $headers['Content-Length'] = (string)$contentLength;
}
- $request = new HTTP\Request($vars);
+ $request = new HTTP\Request('PATCH', '/foobar.txt', $headers, '----');
$request->setBody('----');
$this->server->httpRequest = $request;
$this->server->httpResponse = new HTTP\ResponseMock();
+ $this->server->sapi = new HTTP\SapiMock();
$this->server->exec();
$this->assertEquals($httpStatus, $this->server->httpResponse->status, 'Incorrect http status received: ' . $this->server->httpResponse->body);
@@ -70,17 +70,17 @@ class SpecificationTest extends \PHPUnit_Framework_TestCase {
return array(
// Problems
- array('foo', 'HTTP/1.1 400 Bad request', null),
- array('bytes=0-3', 'HTTP/1.1 411 Length Required', null, 0),
- array('bytes=4-1', 'HTTP/1.1 416 Requested Range Not Satisfiable', null),
-
- array('bytes=0-3', 'HTTP/1.1 204 No Content', '----567890'),
- array('bytes=1-4', 'HTTP/1.1 204 No Content', '1----67890'),
- array('bytes=0-', 'HTTP/1.1 204 No Content', '----567890'),
- array('bytes=-4', 'HTTP/1.1 204 No Content', '123456----'),
- array('bytes=-2', 'HTTP/1.1 204 No Content', '12345678----'),
- array('bytes=2-', 'HTTP/1.1 204 No Content', '12----7890'),
- array('append', 'HTTP/1.1 204 No Content', '1234567890----'),
+ array('foo', 400, null),
+ array('bytes=0-3', 411, null, 0),
+ array('bytes=4-1', 416, null),
+
+ array('bytes=0-3', 204, '----567890'),
+ array('bytes=1-4', 204, '1----67890'),
+ array('bytes=0-', 204, '----567890'),
+ array('bytes=-4', 204, '123456----'),
+ array('bytes=-2', 204, '12345678----'),
+ array('bytes=2-', 204, '12----7890'),
+ array('append', 204, '1234567890----'),
);
--
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