[Pkg-owncloud-commits] [php-sabredav] 31/163: Upgraded tests to php 5.4 and sabre/http 2

David Prévot taffit at moszumanska.debian.org
Tue May 20 18:54:51 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 1cd742d310747c2330d68665d63ba8fc6b1ab6fb
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Thu Apr 3 14:44:15 2014 -0400

    Upgraded tests to php 5.4 and sabre/http 2
---
 tests/Sabre/DAV/HttpDeleteTest.php | 82 ++++++++++++++++----------------------
 1 file changed, 34 insertions(+), 48 deletions(-)

diff --git a/tests/Sabre/DAV/HttpDeleteTest.php b/tests/Sabre/DAV/HttpDeleteTest.php
index da28b69..b17f501 100644
--- a/tests/Sabre/DAV/HttpDeleteTest.php
+++ b/tests/Sabre/DAV/HttpDeleteTest.php
@@ -21,13 +21,13 @@ class HttpDeleteTest extends DAVServerTest {
      */
     public function setUpTree() {
 
-        $this->tree = new Mock\Collection('root', array(
+        $this->tree = new Mock\Collection('root', [
             'file1' => 'foo',
-            'dir' => array(
+            'dir' => [
                 'subfile' => 'bar',
                 'subfile2' => 'baz',
-            ),
-        ));
+            ],
+        ]);
 
     }
 
@@ -36,24 +36,21 @@ class HttpDeleteTest extends DAVServerTest {
      */
     public function testDelete() {
 
-        $request = new HTTP\Request(array(
-            'REQUEST_URI' => '/file1',
-            'REQUEST_METHOD' => 'DELETE',
-        ));
+        $request = new HTTP\Request('DELETE', '/file1');
 
         $response = $this->request($request);
 
         $this->assertEquals(
-            'HTTP/1.1 204 No Content',
-            $response->status,
-            "Incorrect status code. Response body:  " . $response->body
+            204,
+            $response->getStatus(),
+            "Incorrect status code. Response body:  " . $response->getBodyAsString()
         );
 
         $this->assertEquals(
-            array(
+            [
                 'Content-Length' => '0',
-            ),
-            $response->headers
+            ],
+            $response->getHeaders()
         );
 
     }
@@ -63,24 +60,21 @@ class HttpDeleteTest extends DAVServerTest {
      */
     public function testDeleteDirectory() {
 
-        $request = new HTTP\Request(array(
-            'REQUEST_URI' => '/dir',
-            'REQUEST_METHOD' => 'DELETE',
-        ));
+        $request = new HTTP\Request('DELETE', '/dir');
 
         $response = $this->request($request);
 
         $this->assertEquals(
-            'HTTP/1.1 204 No Content',
-            $response->status,
-            "Incorrect status code. Response body:  " . $response->body
+            204,
+            $response->getStatus(),
+            "Incorrect status code. Response body:  " . $response->getBodyAsString()
         );
 
         $this->assertEquals(
-            array(
+            [
                 'Content-Length' => '0',
-            ),
-            $response->headers
+            ],
+            $response->getHeaders()
         );
 
     }
@@ -90,17 +84,13 @@ class HttpDeleteTest extends DAVServerTest {
      */
     public function testDeleteNotFound() {
 
-        $request = new HTTP\Request(array(
-            'REQUEST_URI' => '/file2',
-            'REQUEST_METHOD' => 'DELETE',
-        ));
-
+        $request = new HTTP\Request('DELETE', '/file2');
         $response = $this->request($request);
 
         $this->assertEquals(
-            'HTTP/1.1 404 Not Found',
-            $response->status,
-            "Incorrect status code. Response body:  " . $response->body
+            404,
+            $response->getStatus(),
+            "Incorrect status code. Response body:  " . $response->getBodyAsString()
         );
 
     }
@@ -110,18 +100,16 @@ class HttpDeleteTest extends DAVServerTest {
      */
     public function testDeletePreconditions() {
 
-        $request = new HTTP\Request(array(
-            'REQUEST_URI' => '/file1',
-            'REQUEST_METHOD' => 'DELETE',
-            'HTTP_IF_MATCH' => '"' . md5('foo') . '"',
-        ));
+        $request = new HTTP\Request('DELETE', '/file1', [
+            'If-Match' => '"' . md5('foo') . '"',
+        ]);
 
         $response = $this->request($request);
 
         $this->assertEquals(
-            'HTTP/1.1 204 No Content',
-            $response->status,
-            "Incorrect status code. Response body:  " . $response->body
+            204,
+            $response->getStatus(),
+            "Incorrect status code. Response body:  " . $response->getBodyAsString()
         );
 
     }
@@ -131,18 +119,16 @@ class HttpDeleteTest extends DAVServerTest {
      */
     public function testDeletePreconditionsFailed() {
 
-        $request = new HTTP\Request(array(
-            'REQUEST_URI' => '/file1',
-            'REQUEST_METHOD' => 'DELETE',
-            'HTTP_IF_MATCH' => '"' . md5('bar') . '"',
-        ));
+        $request = new HTTP\Request('DELETE', '/file1', [
+            'If-Match' => '"' . md5('bar') . '"',
+        ]);
 
         $response = $this->request($request);
 
         $this->assertEquals(
-            'HTTP/1.1 412 Precondition failed',
-            $response->status,
-            "Incorrect status code. Response body:  " . $response->body
+            412,
+            $response->getStatus(),
+            "Incorrect status code. Response body:  " . $response->getBodyAsString()
         );
 
     }

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