[Pkg-owncloud-commits] [php-sabredav] 15/24: Added proof for #439.

David Prévot taffit at moszumanska.debian.org
Tue May 20 17:19:43 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch 1.7
in repository php-sabredav.

commit 48444bd0d8a243c434ee09981243d1124ff452bf
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Sat Apr 26 13:01:32 2014 -0400

    Added proof for #439.
---
 tests/Sabre/DAV/PartialUpdate/FullStackTest.php | 49 +++++++++++++++++++++++++
 tests/bootstrap.php                             |  1 +
 2 files changed, 50 insertions(+)

diff --git a/tests/Sabre/DAV/PartialUpdate/FullStackTest.php b/tests/Sabre/DAV/PartialUpdate/FullStackTest.php
new file mode 100644
index 0000000..318de9f
--- /dev/null
+++ b/tests/Sabre/DAV/PartialUpdate/FullStackTest.php
@@ -0,0 +1,49 @@
+<?php
+
+/**
+ * This test sets up the entire stack and tests every bit.
+ */
+class Sabre_DAV_PartialUpdate_FullStackTest extends PHPUnit_Framework_TestCase {
+
+    protected $server;
+
+    public function setUp() {
+
+        $tree = array(
+            new Sabre_DAV_FSExt_File(SABRE_TEMPDIR . '/foobar.txt')
+        );
+        $server = new Sabre_DAV_Server($tree);
+        $server->addPlugin(new Sabre_DAV_PartialUpdate_Plugin());
+
+        $tree[0]->put('1234567890');
+
+        $this->server = $server;
+
+    }
+
+    public function tearDown() {
+
+        Sabre_TestUtil::clearTempDir();
+
+    }
+
+    public function testUpdateRange() {
+
+        $request = new Sabre_HTTP_Request(array(
+            'REQUEST_METHOD' => 'PATCH',
+            'HTTP_CONTENT_TYPE' => 'application/x-sabredav-partialupdate',
+            'HTTP_X_UPDATE_RANGE' => 'bytes=3-4',
+            'REQUEST_URI' => '/foobar.txt',
+            'HTTP_CONTENT_LENGTH' => '2',
+        ));
+        $request->setBody('--');
+        $this->server->httpRequest = $request;
+        $this->server->httpResponse = new Sabre_HTTP_ResponseMock();
+        $this->server->exec();
+
+        $this->assertEquals('HTTP/1.1 204 No Content', $this->server->httpResponse->status, 'Incorrect http status received: ' . $this->server->httpResponse->body);
+        $this->assertEquals('12--4567890', file_get_contents(SABRE_TEMPDIR . '/foobar.txt'));
+
+    } 
+
+}
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index fe200a9..a6493ce 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -7,6 +7,7 @@ define('SABRE_MYSQLPASS','');
 set_include_path(__DIR__ . '/../lib/' . PATH_SEPARATOR . __DIR__ . PATH_SEPARATOR . get_include_path());
 
 include __DIR__ . '/../vendor/autoload.php';
+include 'Sabre/TestUtil.php';
 include 'Sabre/DAVServerTest.php';
 
 date_default_timezone_set('UTC');

-- 
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