]> git.mxchange.org Git - friendica-addons.git/blobdiff - dav/SabreDAV/tests/Sabre/DAV/Auth/Backend/ApacheTest.php
Initial Release of the calendar plugin
[friendica-addons.git] / dav / SabreDAV / tests / Sabre / DAV / Auth / Backend / ApacheTest.php
diff --git a/dav/SabreDAV/tests/Sabre/DAV/Auth/Backend/ApacheTest.php b/dav/SabreDAV/tests/Sabre/DAV/Auth/Backend/ApacheTest.php
new file mode 100644 (file)
index 0000000..2eb52ab
--- /dev/null
@@ -0,0 +1,40 @@
+<?php
+
+class Sabre_DAV_Auth_Backend_ApacheTest extends PHPUnit_Framework_TestCase {
+
+    function testConstruct() {
+
+        $backend = new Sabre_DAV_Auth_Backend_Apache();
+
+    }
+
+    /**
+     * @expectedException Sabre_DAV_Exception
+     */
+    function testNoHeader() {
+
+        $server = new Sabre_DAV_Server();
+        $backend = new Sabre_DAV_Auth_Backend_Apache();
+        $backend->authenticate($server,'Realm');
+
+    }
+
+    function testRemoteUser() {
+
+        $backend = new Sabre_DAV_Auth_Backend_Apache();
+
+        $server = new Sabre_DAV_Server();
+        $request = new Sabre_HTTP_Request(array(
+            'REMOTE_USER' => 'username',
+        ));
+        $server->httpRequest = $request;
+
+        $this->assertTrue($backend->authenticate($server, 'Realm'));
+
+        $userInfo = 'username';
+
+        $this->assertEquals($userInfo, $backend->getCurrentUser());
+
+    }
+
+}