[Pkg-owncloud-commits] [php-sabredav] 16/220: More tests wip

David Prévot taffit at moszumanska.debian.org
Thu May 12 01:21:02 UTC 2016


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

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

commit bdb9d818cc980fb602b4f8501151ef8f1ac8c5f4
Author: Evert Pot <me at evertpot.com>
Date:   Fri Aug 28 22:08:46 2015 +0200

    More tests wip
---
 tests/Sabre/DAV/Mock/ShareableNode.php | 62 ++++++++++++++++++++++++++++++++++
 tests/Sabre/DAV/Sharing/PluginTest.php | 33 ++++++++++++++++++
 tests/Sabre/DAVServerTest.php          |  7 ++--
 3 files changed, 100 insertions(+), 2 deletions(-)

diff --git a/tests/Sabre/DAV/Mock/ShareableNode.php b/tests/Sabre/DAV/Mock/ShareableNode.php
new file mode 100644
index 0000000..af77cc0
--- /dev/null
+++ b/tests/Sabre/DAV/Mock/ShareableNode.php
@@ -0,0 +1,62 @@
+<?php
+
+namespace Sabre\DAV\Mock;
+
+use Sabre\DAV\Sharing\IShareableNode;
+
+class ShareableNode extends \Sabre\DAV\Node implements IShareableNode {
+
+    protected $name;
+
+    function __construct($name) {
+
+        $this->name = $name;
+
+    }
+
+    function getName() {
+
+        return $this->name;
+
+    }
+
+    /**
+     * Updates the list of shares.
+     *
+     * The first array is a list of people that are to be added to the
+     * shared resource.
+     *
+     * Every element in the add array has the following properties:
+     *   * href - A url. Usually a mailto: address
+     *   * summary - A description of the share, can also be false
+     *   * readOnly - A boolean value
+     *
+     * In addition to that, the array might have any additional properties,
+     * specified in clark-notation, such as '{DAV:}displayname'.
+     *
+     * Every element in the remove array is just the url of the sharee that's
+     * to be removed.
+     *
+     * @param array $add
+     * @param array $remove
+     * @return void
+     */
+    function updateShares(array $add, array $remove) {
+
+    }
+
+    /**
+     * Returns the list of people whom this resource is shared with.
+     *
+     * Every element in this array should have the following properties:
+     *   * href - Often a mailto: address
+     *   * commonName - Optional, for example a first + last name
+     *   * status - See the Sabre\DAV\Sharing\Plugin::STATUS_ constants.
+     *   * readOnly - boolean
+     *
+     * @return array
+     */
+    function getShares();
+
+
+} 
diff --git a/tests/Sabre/DAV/Sharing/PluginTest.php b/tests/Sabre/DAV/Sharing/PluginTest.php
new file mode 100644
index 0000000..aa3c37a
--- /dev/null
+++ b/tests/Sabre/DAV/Sharing/PluginTest.php
@@ -0,0 +1,33 @@
+<?php
+
+namespace Sabre\DAV\Sharing;
+
+use Sabre\DAV\Mock;
+
+class PluginTest extends \Sabre\DAVServerTest {
+
+    protected $setupSharing = true;
+
+    function setUpTree() {
+
+        $this->tree[] = new Mock\ShareableNode();
+
+    }
+
+    function testProperties() {
+
+        $result = $this->server->getPropertiesForPath(
+            'shareable',
+            ['{DAV:}share-mode']
+        );
+
+        $expected = [];
+
+        $this->assertEquals(
+            $expected,
+            $result
+        );
+
+    }
+
+}
diff --git a/tests/Sabre/DAVServerTest.php b/tests/Sabre/DAVServerTest.php
index 865e77b..2e609ce 100644
--- a/tests/Sabre/DAVServerTest.php
+++ b/tests/Sabre/DAVServerTest.php
@@ -27,6 +27,7 @@ abstract class DAVServerTest extends \PHPUnit_Framework_TestCase {
     protected $setupCalDAVICSExport = false;
     protected $setupLocks = false;
     protected $setupFiles = false;
+    protected $setupSharing = false;
     protected $setupPropertyStorage = false;
 
     /**
@@ -120,10 +121,12 @@ abstract class DAVServerTest extends \PHPUnit_Framework_TestCase {
             $this->caldavPlugin = new CalDAV\Plugin();
             $this->server->addPlugin($this->caldavPlugin);
         }
-        if ($this->setupCalDAVSharing) {
+        if ($this->setupCalDAVSharing || $this->setupSharing) {
             $this->sharingPlugin = new DAV\Sharing\Plugin();
-            $this->caldavSharingPlugin = new CalDAV\SharingPlugin();
             $this->server->addPlugin($this->sharingPlugin);
+        }
+        if ($this->setupCalDAVSharing) {
+            $this->caldavSharingPlugin = new CalDAV\SharingPlugin();
             $this->server->addPlugin($this->caldavSharingPlugin);
         }
         if ($this->setupCalDAVScheduling) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-php/php-sabredav.git



More information about the Pkg-owncloud-commits mailing list