[Pkg-owncloud-commits] [php-sabredav] 38/163: All the DAV tests run again.

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 9dda8738f96143e51e1bf96a44dfcbca18c6458f
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Sat Apr 5 00:31:21 2014 -0400

    All the DAV tests run again.
---
 lib/Sabre/DAV/CorePlugin.php                       |   4 +-
 ...PropertiesNode.php => PropertiesCollection.php} |  10 +-
 .../Sabre/DAV/Property/SupportedReportSetTest.php  |   2 -
 tests/Sabre/DAV/ServerPluginTest.php               |   1 -
 tests/Sabre/DAV/ServerPreconditionTest.php         |  20 ---
 tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php   | 179 ---------------------
 tests/Sabre/DAV/ServerPropsTest.php                |  44 ++---
 tests/Sabre/DAV/ServerSimpleTest.php               |   5 -
 tests/Sabre/DAV/ServerUpdatePropertiesTest.php     |  51 +++---
 tests/Sabre/DAV/TreeTest.php                       |   3 -
 tests/Sabre/DAVServerTest.php                      |   1 +
 11 files changed, 48 insertions(+), 272 deletions(-)

diff --git a/lib/Sabre/DAV/CorePlugin.php b/lib/Sabre/DAV/CorePlugin.php
index 1d47c3b..523c453 100644
--- a/lib/Sabre/DAV/CorePlugin.php
+++ b/lib/Sabre/DAV/CorePlugin.php
@@ -43,7 +43,7 @@ class CorePlugin extends ServerPlugin {
         $server->on('method:COPY',      [$this, 'httpCopy']);
         $server->on('method:REPORT',    [$this, 'httpReport']);
 
-        $server->on('propPatch', [$this, 'propPatchProtectedPropertyCheck'], 100);
+        $server->on('propPatch', [$this, 'propPatchProtectedPropertyCheck'], 90);
         $server->on('propPatch', [$this, 'propPatchNodeUpdate'], 200);
 
     }
@@ -748,7 +748,7 @@ class CorePlugin extends ServerPlugin {
         );
 
         if ($protected) {
-            $propPatch->setRemainingResultCode($protected, 403);
+            $propPatch->setResultCode($protected, 403);
         }
 
     }
diff --git a/tests/Sabre/DAV/Mock/PropertiesNode.php b/tests/Sabre/DAV/Mock/PropertiesCollection.php
similarity index 84%
rename from tests/Sabre/DAV/Mock/PropertiesNode.php
rename to tests/Sabre/DAV/Mock/PropertiesCollection.php
index ef1d285..f40aaf2 100644
--- a/tests/Sabre/DAV/Mock/PropertiesNode.php
+++ b/tests/Sabre/DAV/Mock/PropertiesCollection.php
@@ -3,7 +3,9 @@
 namespace Sabre\DAV\Mock;
 
 use
-    Sabre\DAV\IProperties;
+    Sabre\DAV\IProperties,
+    Sabre\DAV\PropPatch;
+
 
 /**
  * A node specifically for testing property-related operations
@@ -30,13 +32,13 @@ class PropertiesCollection extends Collection implements IProperties {
      */
     public function propPatch(PropPatch $proppatch) {
 
-        $proppatch->on('commit', function() {
+        $proppatch->handleRemaining(function($updateProperties) {
 
             switch($this->failMode) {
                 case 'updatepropsfalse' : return false;
                 case 'updatepropsarray' :
-                    $r = array(402 => array());
-                    foreach($updateProperties as $k=>$v) $r[402][$k] = null;
+                    $r = [];
+                    foreach($updateProperties as $k=>$v) $r[$k] = 402;
                     return $r;
                 case 'updatepropsobj' :
                     return new \STDClass();
diff --git a/tests/Sabre/DAV/Property/SupportedReportSetTest.php b/tests/Sabre/DAV/Property/SupportedReportSetTest.php
index e089211..f1d3390 100644
--- a/tests/Sabre/DAV/Property/SupportedReportSetTest.php
+++ b/tests/Sabre/DAV/Property/SupportedReportSetTest.php
@@ -27,7 +27,6 @@ class SupportedReportSetTest extends DAV\AbstractServer {
     }
 
     /**
-     * @covers Sabre\DAV\Property\SupportedReportSet
      */
     function testNoReports() {
 
@@ -60,7 +59,6 @@ class SupportedReportSetTest extends DAV\AbstractServer {
     }
 
     /**
-     * @covers Sabre\DAV\Property\SupportedReportSet
      * @depends testNoReports
      */
     function testCustomReport() {
diff --git a/tests/Sabre/DAV/ServerPluginTest.php b/tests/Sabre/DAV/ServerPluginTest.php
index 29ffc8b..f36cb93 100644
--- a/tests/Sabre/DAV/ServerPluginTest.php
+++ b/tests/Sabre/DAV/ServerPluginTest.php
@@ -24,7 +24,6 @@ class ServerPluginTest extends AbstractServer {
     }
 
     /**
-     * @covers \Sabre\DAV\ServerPlugin
      */
     function testBaseClass() {
 
diff --git a/tests/Sabre/DAV/ServerPreconditionTest.php b/tests/Sabre/DAV/ServerPreconditionTest.php
index 5d65a9f..52defa0 100644
--- a/tests/Sabre/DAV/ServerPreconditionTest.php
+++ b/tests/Sabre/DAV/ServerPreconditionTest.php
@@ -9,7 +9,6 @@ require_once 'Sabre/HTTP/ResponseMock.php';
 class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase {
 
     /**
-     * @covers Sabre\DAV\Server::checkPreconditions
      * @expectedException Sabre\DAV\Exception\PreconditionFailed
      */
     function testIfMatchNoNode() {
@@ -27,7 +26,6 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase {
     }
 
     /**
-     * @covers \Sabre\DAV\Server::checkPreconditions
      */
     function testIfMatchHasNode() {
 
@@ -44,7 +42,6 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase {
     }
 
     /**
-     * @covers \Sabre\DAV\Server::checkPreconditions
      * @expectedException Sabre\DAV\Exception\PreconditionFailed
      */
     function testIfMatchWrongEtag() {
@@ -62,7 +59,6 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase {
     }
 
     /**
-     * @covers \Sabre\DAV\Server::checkPreconditions
      */
     function testIfMatchCorrectEtag() {
 
@@ -81,7 +77,6 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase {
     /**
      * Evolution sometimes uses \" instead of " for If-Match headers.
      *
-     * @covers \Sabre\DAV\Server::checkPreconditions
      * @depends testIfMatchCorrectEtag
      */
     function testIfMatchEvolutionEtag() {
@@ -99,7 +94,6 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase {
     }
 
     /**
-     * @covers \Sabre\DAV\Server::checkPreconditions
      */
     function testIfMatchMultiple() {
 
@@ -116,7 +110,6 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase {
     }
 
     /**
-     * @covers \Sabre\DAV\Server::checkPreconditions
      */
     function testIfNoneMatchNoNode() {
 
@@ -133,7 +126,6 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase {
     }
 
     /**
-     * @covers \Sabre\DAV\Server::checkPreconditions
      * @expectedException Sabre\DAV\Exception\PreconditionFailed
      */
     function testIfNoneMatchHasNode() {
@@ -151,7 +143,6 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase {
     }
 
     /**
-     * @covers \Sabre\DAV\Server::checkPreconditions
      */
     function testIfNoneMatchWrongEtag() {
 
@@ -168,7 +159,6 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase {
     }
 
     /**
-     * @covers \Sabre\DAV\Server::checkPreconditions
      */
     function testIfNoneMatchWrongEtagMultiple() {
 
@@ -185,7 +175,6 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase {
     }
 
     /**
-     * @covers \Sabre\DAV\Server::checkPreconditions
      * @expectedException Sabre\DAV\Exception\PreconditionFailed
      */
     public function testIfNoneMatchCorrectEtag() {
@@ -203,7 +192,6 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase {
     }
 
     /**
-     * @covers \Sabre\DAV\Server::checkPreconditions
      * @expectedException Sabre\DAV\Exception\PreconditionFailed
      */
     public function testIfNoneMatchCorrectEtagMultiple() {
@@ -221,7 +209,6 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase {
     }
 
     /**
-     * @covers \Sabre\DAV\Server::checkPreconditions
      */
     public function testIfNoneMatchCorrectEtagAsGet() {
 
@@ -240,7 +227,6 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase {
     }
 
     /**
-     * @covers \Sabre\DAV\Server::checkPreconditions
      */
     public function testIfModifiedSinceUnModified() {
 
@@ -263,7 +249,6 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase {
 
 
     /**
-     * @covers \Sabre\DAV\Server::checkPreconditions
      */
     public function testIfModifiedSinceModified() {
 
@@ -280,7 +265,6 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase {
     }
 
     /**
-     * @covers \Sabre\DAV\Server::checkPreconditions
      */
     public function testIfModifiedSinceInvalidDate() {
 
@@ -299,7 +283,6 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase {
     }
 
     /**
-     * @covers \Sabre\DAV\Server::checkPreconditions
      */
     public function testIfModifiedSinceInvalidDate2() {
 
@@ -317,7 +300,6 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase {
 
 
     /**
-     * @covers \Sabre\DAV\Server::checkPreconditions
      */
     public function testIfUnmodifiedSinceUnModified() {
 
@@ -334,7 +316,6 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase {
 
 
     /**
-     * @covers \Sabre\DAV\Server::checkPreconditions
      * @expectedException Sabre\DAV\Exception\PreconditionFailed
      */
     public function testIfUnmodifiedSinceModified() {
@@ -352,7 +333,6 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase {
     }
 
     /**
-     * @covers \Sabre\DAV\Server::checkPreconditions
      */
     public function testIfUnmodifiedSinceInvalidDate() {
 
diff --git a/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php b/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php
index 4b7a00b..9c1ff97 100644
--- a/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php
+++ b/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php
@@ -177,7 +177,6 @@ class ServerPropsInfiniteDepthTest extends AbstractServer {
     }
 
     /**
-     * @covers Sabre\DAV\Server::parsePropPatchRequest
      */
     public function testParsePropPatchRequest() {
 
@@ -198,182 +197,4 @@ class ServerPropsInfiniteDepthTest extends AbstractServer {
 
     }
 
-    /**
-     * @covers Sabre\DAV\Server::updateProperties
-     */
-    public function testUpdateProperties() {
-
-        $props = array(
-            '{http://sabredav.org/NS/test}someprop' => 'somevalue',
-        );
-
-        $result = $this->server->updateProperties('/test2.txt',$props);
-
-        $this->assertEquals([
-            '{http://sabredav.org/NS/test}someprop' => 200,
-        ], $result);
-
-    }
-
-    /**
-     * @covers Sabre\DAV\Server::updateProperties
-     * @depends testUpdateProperties
-     */
-    public function testUpdatePropertiesProtected() {
-
-        $props = array(
-            '{http://sabredav.org/NS/test}someprop' => 'somevalue',
-            '{DAV:}getcontentlength' => 50,
-        );
-
-        $result = $this->server->updateProperties('/test2.txt',$props);
-
-        $this->assertEquals(array(
-            '{http://sabredav.org/NS/test}someprop' => array(),
-            '{DAV:}getcontentlength' => array(),
-        ), $result);
-
-    }
-
-    /**
-     * @covers Sabre\DAV\Server::updateProperties
-     * @depends testUpdateProperties
-     */
-    public function testUpdatePropertiesFail1() {
-
-        $dir = new PropInfiniteDepthTestDirMock('updatepropsfalse');
-        $objectTree = new ObjectTree($dir);
-        $this->server->tree = $objectTree;
-
-        $props = array(
-            '{http://sabredav.org/NS/test}someprop' => 'somevalue',
-        );
-
-        $result = $this->server->updateProperties('/',$props);
-
-        $this->assertEquals(array(
-            '403' => array('{http://sabredav.org/NS/test}someprop' => null),
-            'href' => '/',
-        ), $result);
-
-    }
-
-    /**
-     * @covers Sabre\DAV\Server::updateProperties
-     * @depends testUpdateProperties
-     */
-    public function testUpdatePropertiesFail2() {
-
-        $dir = new PropInfiniteDepthTestDirMock('updatepropsarray');
-        $objectTree = new ObjectTree($dir);
-        $this->server->tree = $objectTree;
-
-        $props = array(
-            '{http://sabredav.org/NS/test}someprop' => 'somevalue',
-        );
-
-        $result = $this->server->updateProperties('/',$props);
-
-        $this->assertEquals(array(
-            '402' => array('{http://sabredav.org/NS/test}someprop' => null),
-            'href' => '/',
-        ), $result);
-
-    }
-
-    /**
-     * @covers Sabre\DAV\Server::updateProperties
-     * @depends testUpdateProperties
-     * @expectedException Sabre\DAV\Exception
-     */
-    public function testUpdatePropertiesFail3() {
-
-        $dir = new PropInfiniteDepthTestDirMock('updatepropsobj');
-        $objectTree = new ObjectTree($dir);
-        $this->server->tree = $objectTree;
-
-        $props = array(
-            '{http://sabredav.org/NS/test}someprop' => 'somevalue',
-        );
-
-        $result = $this->server->updateProperties('/',$props);
-
-    }
-
-    /**
-     * @depends testParsePropPatchRequest
-     * @depends testUpdateProperties
-     */
-    public function testPropPatch() {
-
-        $serverVars = array(
-            'REQUEST_URI'    => '/',
-            'REQUEST_METHOD' => 'PROPPATCH',
-        );
-
-        $body = '<?xml version="1.0"?>
-<d:propertyupdate xmlns:d="DAV:" xmlns:s="http://www.rooftopsolutions.nl/testnamespace">
-  <d:set><d:prop><s:someprop>somevalue</s:someprop></d:prop></d:set>
-</d:propertyupdate>';
-
-        $request = HTTP\Sapi::createFromServerArray($serverVars);
-        $request->setBody($body);
-
-        $this->server->httpRequest = ($request);
-        $this->server->exec();
-
-        $this->assertEquals(array(
-                'Content-Type' => 'application/xml; charset=utf-8',
-                'Vary' => 'Brief,Prefer',
-            ),
-            $this->response->headers
-         );
-
-        $this->assertEquals(207, $this->response->status,'We got the wrong status. Full XML response: ' . $this->response->body);
-
-        $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/","xmlns\\1=\"urn:DAV\"",$this->response->body);
-        $xml = simplexml_load_string($body);
-        $xml->registerXPathNamespace('d','urn:DAV');
-        $xml->registerXPathNamespace('bla','http://www.rooftopsolutions.nl/testnamespace');
-
-        $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop');
-        $this->assertEquals(1,count($data),'We expected one \'d:prop\' element. Response body: ' . $body);
-
-        $data = $xml->xpath('//bla:someprop');
-        $this->assertEquals(1,count($data),'We expected one \'s:someprop\' element. Response body: ' . $body);
-
-        $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:status');
-        $this->assertEquals(1,count($data),'We expected one \'s:status\' element. Response body: ' . $body);
-
-        $this->assertEquals('HTTP/1.1 200 OK',(string)$data[0]);
-
-    }
-
-    /**
-     * @depends testPropPatch
-     */
-    public function testPropPatchAndFetch() {
-
-        $this->testPropPatch();
-        $xml = '<?xml version="1.0"?>
-<d:propfind xmlns:d="DAV:" xmlns:s="http://www.rooftopsolutions.nl/testnamespace">
-  <d:prop>
-    <s:someprop />
-  </d:prop>
-</d:propfind>';
-
-        $this->sendRequest($xml);
-
-        $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/","xmlns\\1=\"urn:DAV\"",$this->response->body);
-        $xml = simplexml_load_string($body);
-        $xml->registerXPathNamespace('d','urn:DAV');
-        $xml->registerXPathNamespace('bla','http://www.rooftopsolutions.nl/testnamespace');
-
-        $xpath='//bla:someprop';
-        $result = $xml->xpath($xpath);
-        $this->assertEquals(8,count($result),'We couldn\'t find our new property in the response. Full response body:' . "\n" . $body);
-        $this->assertEquals('somevalue',(string)$result[0],'We couldn\'t find our new property in the response. Full response body:' . "\n" . $body);
-
-    }
-
 }
diff --git a/tests/Sabre/DAV/ServerPropsTest.php b/tests/Sabre/DAV/ServerPropsTest.php
index d3d07d0..06ff724 100644
--- a/tests/Sabre/DAV/ServerPropsTest.php
+++ b/tests/Sabre/DAV/ServerPropsTest.php
@@ -174,9 +174,6 @@ class ServerPropsTest extends AbstractServer {
 
     }
 
-    /**
-     * @covers Sabre\DAV\Server::parsePropPatchRequest
-     */
     public function testParsePropPatchRequest() {
 
         $body = '<?xml version="1.0"?>
@@ -196,9 +193,6 @@ class ServerPropsTest extends AbstractServer {
 
     }
 
-    /**
-     * @covers Sabre\DAV\Server::updateProperties
-     */
     public function testUpdateProperties() {
 
         $props = array(
@@ -208,16 +202,11 @@ class ServerPropsTest extends AbstractServer {
         $result = $this->server->updateProperties('/test2.txt',$props);
 
         $this->assertEquals(array(
-            '200' => array('{http://sabredav.org/NS/test}someprop' => null),
-            'href' => '/test2.txt',
+            '{http://sabredav.org/NS/test}someprop' => 200
         ), $result);
 
     }
 
-    /**
-     * @covers Sabre\DAV\Server::updateProperties
-     * @depends testUpdateProperties
-     */
     public function testUpdatePropertiesProtected() {
 
         $props = array(
@@ -228,20 +217,17 @@ class ServerPropsTest extends AbstractServer {
         $result = $this->server->updateProperties('/test2.txt',$props);
 
         $this->assertEquals(array(
-            '424' => array('{http://sabredav.org/NS/test}someprop' => null),
-            '403' => array('{DAV:}getcontentlength' => null),
-            'href' => '/test2.txt',
+            '{http://sabredav.org/NS/test}someprop' => 424,
+            '{DAV:}getcontentlength' => 403,
         ), $result);
 
     }
 
-    /**
-     * @covers Sabre\DAV\Server::updateProperties
-     * @depends testUpdateProperties
-     */
     public function testUpdatePropertiesFail1() {
 
-        $dir = new PropTestDirMock('updatepropsfalse');
+        $dir = new Mock\PropertiesCollection([]);
+        $dir->failMode = 'updatepropsfalse';
+
         $objectTree = new ObjectTree($dir);
         $this->server->tree = $objectTree;
 
@@ -252,19 +238,19 @@ class ServerPropsTest extends AbstractServer {
         $result = $this->server->updateProperties('/',$props);
 
         $this->assertEquals(array(
-            '403' => array('{http://sabredav.org/NS/test}someprop' => null),
-            'href' => '/',
+            '{http://sabredav.org/NS/test}someprop' => 403,
         ), $result);
 
     }
 
     /**
-     * @covers Sabre\DAV\Server::updateProperties
      * @depends testUpdateProperties
      */
     public function testUpdatePropertiesFail2() {
 
-        $dir = new PropTestDirMock('updatepropsarray');
+        $dir = new Mock\PropertiesCollection([]);
+        $dir->failMode = 'updatepropsarray';
+
         $objectTree = new ObjectTree($dir);
         $this->server->tree = $objectTree;
 
@@ -275,20 +261,20 @@ class ServerPropsTest extends AbstractServer {
         $result = $this->server->updateProperties('/',$props);
 
         $this->assertEquals(array(
-            '402' => array('{http://sabredav.org/NS/test}someprop' => null),
-            'href' => '/',
+            '{http://sabredav.org/NS/test}someprop' => 402
         ), $result);
 
     }
 
     /**
-     * @covers Sabre\DAV\Server::updateProperties
      * @depends testUpdateProperties
-     * @expectedException Sabre\DAV\Exception
+     * @expectedException \UnexpectedValueException
      */
     public function testUpdatePropertiesFail3() {
 
-        $dir = new PropTestDirMock('updatepropsobj');
+        $dir = new Mock\PropertiesCollection([]);
+        $dir->failMode = 'updatepropsobj';
+
         $objectTree = new ObjectTree($dir);
         $this->server->tree = $objectTree;
 
diff --git a/tests/Sabre/DAV/ServerSimpleTest.php b/tests/Sabre/DAV/ServerSimpleTest.php
index 2c1a2df..f04f535 100644
--- a/tests/Sabre/DAV/ServerSimpleTest.php
+++ b/tests/Sabre/DAV/ServerSimpleTest.php
@@ -381,7 +381,6 @@ class ServerSimpleTest extends AbstractServer{
     }
 
     /**
-     * @covers \Sabre\DAV\Server::guessBaseUri
      */
     function testGuessBaseUri() {
 
@@ -400,7 +399,6 @@ class ServerSimpleTest extends AbstractServer{
 
     /**
      * @depends testGuessBaseUri
-     * @covers Sabre\DAV\Server::guessBaseUri
      */
     function testGuessBaseUriPercentEncoding() {
 
@@ -419,7 +417,6 @@ class ServerSimpleTest extends AbstractServer{
 
     /**
      * @depends testGuessBaseUri
-     * @covers \Sabre\DAV\Server::guessBaseUri
      */
     /*
     function testGuessBaseUriPercentEncoding2() {
@@ -483,7 +480,6 @@ class ServerSimpleTest extends AbstractServer{
 
 
     /**
-     * @covers \Sabre\DAV\Server::guessBaseUri
      * @depends testGuessBaseUri
      */
     function testGuessBaseUriQueryString() {
@@ -502,7 +498,6 @@ class ServerSimpleTest extends AbstractServer{
     }
 
     /**
-     * @covers \Sabre\DAV\Server::guessBaseUri
      * @depends testGuessBaseUri
      * @expectedException \Sabre\DAV\Exception
      */
diff --git a/tests/Sabre/DAV/ServerUpdatePropertiesTest.php b/tests/Sabre/DAV/ServerUpdatePropertiesTest.php
index 9e5b963..dd7b134 100644
--- a/tests/Sabre/DAV/ServerUpdatePropertiesTest.php
+++ b/tests/Sabre/DAV/ServerUpdatePropertiesTest.php
@@ -17,10 +17,7 @@ class ServerUpdatePropertiesTest extends \PHPUnit_Framework_TestCase {
         ));
 
         $expected = array(
-            'href' => 'foo',
-            '403' => array(
-                '{DAV:}foo' => null,
-            ),
+            '{DAV:}foo' => 403,
         );
         $this->assertEquals($expected, $result);
 
@@ -33,19 +30,17 @@ class ServerUpdatePropertiesTest extends \PHPUnit_Framework_TestCase {
         );
         $server = new Server($tree);
 
+        $server->on('propPatch', function($path, PropPatch $propPatch) {
+            $propPatch->handleRemaining(function() { return true; });
+        });
         $result = $server->updateProperties('foo', array(
             '{DAV:}getetag' => 'bla',
             '{DAV:}foo' => 'bar'
         ));
 
         $expected = array(
-            'href' => 'foo',
-            '403' => array(
-                '{DAV:}getetag' => null,
-            ),
-            '424' => array(
-                '{DAV:}foo' => null,
-            ),
+            '{DAV:}getetag' => 403,
+            '{DAV:}foo' => 424,
         );
         $this->assertEquals($expected, $result);
 
@@ -57,7 +52,10 @@ class ServerUpdatePropertiesTest extends \PHPUnit_Framework_TestCase {
             new SimpleCollection('foo'),
         );
         $server = new Server($tree);
-        $server->on('updateProperties', [$this,'updatepropfail']);
+        $server->on('propPatch', function($path, PropPatch $propPatch) {
+            $propPatch->setResultCode('{DAV:}foo', 404);
+            $propPatch->handleRemaining(function() { return true; });
+        });
 
         $result = $server->updateProperties('foo', array(
             '{DAV:}foo' => 'bar',
@@ -65,13 +63,8 @@ class ServerUpdatePropertiesTest extends \PHPUnit_Framework_TestCase {
         ));
 
         $expected = array(
-            'href' => 'foo',
-            '404' => array(
-                '{DAV:}foo' => null,
-            ),
-            '424' => array(
-                '{DAV:}foo2' => null,
-            ),
+            '{DAV:}foo' => 404,
+            '{DAV:}foo2' => 424,
         );
         $this->assertEquals($expected, $result);
 
@@ -94,7 +87,16 @@ class ServerUpdatePropertiesTest extends \PHPUnit_Framework_TestCase {
             new SimpleCollection('foo'),
         );
         $server = new Server($tree);
-        $server->on('updateProperties', [$this,'updatepropsuccess']);
+        $server->on('propPatch', function($path, PropPatch $propPatch) {
+
+            $propPatch->handle(['{DAV:}foo', '{DAV:}foo2'], function() {
+                return [
+                    '{DAV:}foo' => 200,
+                    '{DAV:}foo2' => 201,
+                ];
+            });
+
+        });
 
         $result = $server->updateProperties('foo', array(
             '{DAV:}foo' => 'bar',
@@ -102,13 +104,8 @@ class ServerUpdatePropertiesTest extends \PHPUnit_Framework_TestCase {
         ));
 
         $expected = array(
-            'href' => 'foo',
-            '200' => array(
-                '{DAV:}foo' => null,
-            ),
-            '201' => array(
-                '{DAV:}foo2' => null,
-            ),
+            '{DAV:}foo' => 200,
+            '{DAV:}foo2' => 201,
         );
         $this->assertEquals($expected, $result);
 
diff --git a/tests/Sabre/DAV/TreeTest.php b/tests/Sabre/DAV/TreeTest.php
index 49470e1..6d2f4d1 100644
--- a/tests/Sabre/DAV/TreeTest.php
+++ b/tests/Sabre/DAV/TreeTest.php
@@ -2,9 +2,6 @@
 
 namespace Sabre\DAV;
 
-/**
- * @covers \Sabre\DAV\Tree
- */
 class TreeTest extends \PHPUnit_Framework_TestCase {
 
     function testNodeExists() {
diff --git a/tests/Sabre/DAVServerTest.php b/tests/Sabre/DAVServerTest.php
index 10a979c..9979b1d 100644
--- a/tests/Sabre/DAVServerTest.php
+++ b/tests/Sabre/DAVServerTest.php
@@ -7,6 +7,7 @@ require_once 'Sabre/HTTP/ResponseMock.php';
 require_once 'Sabre/DAV/Auth/Backend/Mock.php';
 require_once 'Sabre/DAV/Mock/File.php';
 require_once 'Sabre/DAV/Mock/Collection.php';
+require_once 'Sabre/DAV/Mock/PropertiesCollection.php';
 
 require_once 'Sabre/DAVACL/PrincipalBackend/Mock.php';
 

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