[Pkg-owncloud-commits] [php-sabredav] 02/11: Fixes #456

David Prévot taffit at moszumanska.debian.org
Thu May 22 17:11:49 UTC 2014


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

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

commit 40469536be772cdb6c210fefdf231ff1d7579ffd
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Tue May 20 11:25:50 2014 -0400

    Fixes #456
---
 ChangeLog.md                         |   5 ++
 lib/DAV/Version.php                  |   2 +-
 tests/Sabre/DAV/ClientTest.php       | 109 +++++++++++++++++++++++++++++++++++
 tests/Sabre/DAV/ServerSimpleTest.php |  30 +++++++---
 4 files changed, 138 insertions(+), 8 deletions(-)

diff --git a/ChangeLog.md b/ChangeLog.md
index f2229a3..7d0de5a 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,6 +1,11 @@
 ChangeLog
 =========
 
+2.0.0-beta2 (2014-??-??)
+------------------------
+* Fixed: #456: Issue in sqlite migration script.
+
+
 2.0.0-beta1 (2014-05-15)
 -------------------------
 
diff --git a/lib/DAV/Version.php b/lib/DAV/Version.php
index 4cee3f8..7afe549 100644
--- a/lib/DAV/Version.php
+++ b/lib/DAV/Version.php
@@ -14,6 +14,6 @@ class Version {
     /**
      * Full version number
      */
-    const VERSION = '2.0.0beta1';
+    const VERSION = '2.0.0beta2';
 
 }
diff --git a/tests/Sabre/DAV/ClientTest.php b/tests/Sabre/DAV/ClientTest.php
index dd04f91..b9556a2 100644
--- a/tests/Sabre/DAV/ClientTest.php
+++ b/tests/Sabre/DAV/ClientTest.php
@@ -149,4 +149,113 @@ XML;
 
     }
 
+    /**
+     * @expectedException \Sabre\DAV\Exception
+     */
+    function testPropFindError() {
+
+        $client = new ClientMock([
+            'baseUri' => '/',
+        ]);
+
+        $client->response = new Response(405, []);
+        $client->propfind('foo', ['{DAV:}displayname', '{urn:zim}gir']);
+
+    }
+
+    function testPropFindDepth1() {
+
+        $client = new ClientMock([
+            'baseUri' => '/',
+        ]);
+
+        $responseBody = <<<XML
+<?xml version="1.0"?>
+<multistatus xmlns="DAV:">
+<response>
+  <href>/foo</href>
+  <propstat>
+    <prop>
+      <displayname>bar</displayname>
+    </prop>
+    <status>HTTP/1.1 200 OK</status>
+  </propstat>
+</response>
+</multistatus>
+XML;
+
+        $client->response = new Response(207, [], $responseBody);
+        $result = $client->propfind('foo', ['{DAV:}displayname', '{urn:zim}gir'], 1);
+
+        $this->assertEquals([
+            '/foo' => [
+            '{DAV:}displayname' => 'bar'
+            ],
+        ], $result);
+
+        $request = $client->request;
+        $this->assertEquals('PROPFIND', $request->getMethod());
+        $this->assertEquals('/foo', $request->getUrl());
+        $this->assertEquals([
+            'Depth' => '1',
+            'Content-Type' => 'application/xml',
+        ], $request->getHeaders());
+
+    }
+
+    function testPropPatch() {
+
+        $client = new ClientMock([
+            'baseUri' => '/',
+        ]);
+
+        $responseBody = <<<XML
+<?xml version="1.0"?>
+<multistatus xmlns="DAV:">
+<response>
+  <href>/foo</href>
+  <propstat>
+    <prop>
+      <displayname>bar</displayname>
+    </prop>
+    <status>HTTP/1.1 200 OK</status>
+  </propstat>
+</response>
+</multistatus>
+XML;
+
+        $client->response = new Response(207, [], $responseBody);
+        $result = $client->propPatch('foo', ['{DAV:}displayname' => 'hi', '{urn:zim}gir' => null], 1);
+        $request = $client->request;
+        $this->assertEquals('PROPPATCH', $request->getMethod());
+        $this->assertEquals('/foo', $request->getUrl());
+        $this->assertEquals([
+            'Content-Type' => 'application/xml',
+        ], $request->getHeaders());
+
+    }
+
+    function testOPTIONS() {
+
+        $client = new ClientMock([
+            'baseUri' => '/',
+        ]);
+
+        $client->response = new Response(207, [
+            'DAV' => 'calendar-access, extended-mkcol',
+        ]);
+        $result = $client->options();
+
+        $this->assertEquals(
+            ['calendar-access', 'extended-mkcol'],
+            $result
+        );
+
+        $request = $client->request;
+        $this->assertEquals('OPTIONS', $request->getMethod());
+        $this->assertEquals('/', $request->getUrl());
+        $this->assertEquals([
+        ], $request->getHeaders());
+
+    }
 }
diff --git a/tests/Sabre/DAV/ServerSimpleTest.php b/tests/Sabre/DAV/ServerSimpleTest.php
index 7b09295..5876d19 100644
--- a/tests/Sabre/DAV/ServerSimpleTest.php
+++ b/tests/Sabre/DAV/ServerSimpleTest.php
@@ -174,13 +174,8 @@ class ServerSimpleTest extends AbstractServer{
 
     function testOptions() {
 
-        $serverVars = array(
-            'REQUEST_URI'    => '/',
-            'REQUEST_METHOD' => 'OPTIONS',
-        );
-
-        $request = HTTP\Sapi::createFromServerArray($serverVars);
-        $this->server->httpRequest = ($request);
+        $request = new HTTP\Request('OPTIONS', '/');
+        $this->server->httpRequest = $request;
         $this->server->exec();
 
         $this->assertEquals(array(
@@ -195,8 +190,29 @@ class ServerSimpleTest extends AbstractServer{
         $this->assertEquals(200, $this->response->status);
         $this->assertEquals('', $this->response->body);
 
+    }
+
+    function testOptionsUnmapped() {
+
+        $request = new HTTP\Request('OPTIONS', '/unmapped');
+        $this->server->httpRequest = $request;
+
+        $this->server->exec();
+
+        $this->assertEquals(array(
+            'DAV'            => '1, 3, extended-mkcol',
+            'MS-Author-Via'  => 'DAV',
+            'Allow'          => 'OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, COPY, MOVE, REPORT, MKCOL',
+            'Accept-Ranges'  => 'bytes',
+            'Content-Length' => '0',
+            'X-Sabre-Version' => Version::VERSION,
+        ),$this->response->headers);
+
+        $this->assertEquals(200, $this->response->status);
+        $this->assertEquals('', $this->response->body);
 
     }
+
     function testNonExistantMethod() {
 
         $serverVars = array(

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