]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/tests/Sabre/DAV/Mount/PluginTest.php
Merge branch 'master' of git://github.com/friendica/friendica-addons
[friendica-addons.git] / dav / SabreDAV / tests / Sabre / DAV / Mount / PluginTest.php
1 <?php
2
3 require_once 'Sabre/DAV/AbstractServer.php';
4
5 class Sabre_DAV_Mount_PluginTest extends Sabre_DAV_AbstractServer {
6
7     function setUp() {
8
9         parent::setUp();
10         $this->server->addPlugin(new Sabre_DAV_Mount_Plugin());
11
12     }
13
14     function testPassThrough() {
15
16         $serverVars = array(
17             'REQUEST_URI'    => '/',
18             'REQUEST_METHOD' => 'GET',
19         );
20
21         $request = new Sabre_HTTP_Request($serverVars);
22         $this->server->httpRequest = ($request);
23         $this->server->exec();
24
25         $this->assertEquals('HTTP/1.1 501 Not Implemented',$this->response->status,'We expected GET to not be implemented for Directories. Response body: ' . $this->response->body);
26
27     }
28
29     function testMountResponse() {
30
31         $serverVars = array(
32             'REQUEST_URI'    => '/?mount',
33             'REQUEST_METHOD' => 'GET',
34             'QUERY_STRING'   => 'mount',
35             'HTTP_HOST'      => 'example.org',
36         );
37
38         $request = new Sabre_HTTP_Request($serverVars);
39         $this->server->httpRequest = ($request);
40         $this->server->exec();
41
42         $this->assertEquals('HTTP/1.1 200 OK',$this->response->status);
43
44         $xml = simplexml_load_string($this->response->body);
45         $this->assertTrue($xml==true,'Response was not a valid xml document');
46
47         $xml->registerXPathNamespace('dm','http://purl.org/NET/webdav/mount');
48         $url = $xml->xpath('//dm:url');
49         $this->assertEquals('http://example.org/',(string)$url[0]);
50
51     }
52
53 }