]> git.mxchange.org Git - friendica-addons.git/blobdiff - dav/SabreDAV/tests/Sabre/DAVACL/PrincipalCollectionTest.php
Initial Release of the calendar plugin
[friendica-addons.git] / dav / SabreDAV / tests / Sabre / DAVACL / PrincipalCollectionTest.php
diff --git a/dav/SabreDAV/tests/Sabre/DAVACL/PrincipalCollectionTest.php b/dav/SabreDAV/tests/Sabre/DAVACL/PrincipalCollectionTest.php
new file mode 100644 (file)
index 0000000..f0a475e
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+
+require_once 'Sabre/DAVACL/MockPrincipalBackend.php';
+
+class Sabre_DAVACL_PrincipalCollectionTest extends PHPUnit_Framework_TestCase {
+
+    public function testBasic() {
+
+        $backend = new Sabre_DAVACL_MockPrincipalBackend();
+        $pc = new Sabre_DAVACL_PrincipalCollection($backend);
+        $this->assertTrue($pc instanceof Sabre_DAVACL_PrincipalCollection);
+
+        $this->assertEquals('principals',$pc->getName());
+
+    }
+
+    /**
+     * @depends testBasic
+     */
+    public function testGetChildren() {
+
+        $backend = new Sabre_DAVACL_MockPrincipalBackend();
+        $pc = new Sabre_DAVACL_PrincipalCollection($backend);
+
+        $children = $pc->getChildren();
+        $this->assertTrue(is_array($children));
+
+        foreach($children as $child) {
+            $this->assertTrue($child instanceof Sabre_DAVACL_IPrincipal);
+        }
+
+    }
+
+    /**
+     * @depends testBasic
+     * @expectedException Sabre_DAV_Exception_MethodNotAllowed
+     */
+    public function testGetChildrenDisable() {
+
+        $backend = new Sabre_DAVACL_MockPrincipalBackend();
+        $pc = new Sabre_DAVACL_PrincipalCollection($backend);
+        $pc->disableListing = true;
+
+        $children = $pc->getChildren();
+
+    }
+
+}