]> git.mxchange.org Git - friendica-addons.git/blobdiff - dav/SabreDAV/tests/Sabre/DAV/Auth/MockBackend.php
Initial Release of the calendar plugin
[friendica-addons.git] / dav / SabreDAV / tests / Sabre / DAV / Auth / MockBackend.php
diff --git a/dav/SabreDAV/tests/Sabre/DAV/Auth/MockBackend.php b/dav/SabreDAV/tests/Sabre/DAV/Auth/MockBackend.php
new file mode 100644 (file)
index 0000000..6cc6b3e
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+
+class Sabre_DAV_Auth_MockBackend implements Sabre_DAV_Auth_IBackend {
+
+    protected $currentUser;
+
+    /**
+     * @param Sabre_DAV_Server $server
+     * @param string $realm
+     * @throws Sabre_DAV_Exception_NotAuthenticated
+     */
+    function authenticate(Sabre_DAV_Server $server, $realm) {
+
+        if ($realm=='failme') throw new Sabre_DAV_Exception_NotAuthenticated('deliberate fail');
+
+        $this->currentUser = 'admin';
+
+    }
+
+    function setCurrentUser($user) {
+
+        $this->currentUser = $user;
+
+    }
+
+    function getCurrentUser() {
+
+        return $this->currentUser;
+
+    }
+
+}