ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
PluginTest.php
Go to the documentation of this file.
1<?php
2
3namespace Sabre\DAV\Mount;
4
5use Sabre\DAV;
6use Sabre\HTTP;
7
8require_once 'Sabre/DAV/AbstractServer.php';
9
11
12 function setUp() {
13
14 parent::setUp();
15 $this->server->addPlugin(new Plugin());
16
17 }
18
19 function testPassThrough() {
20
21 $serverVars = [
22 'REQUEST_URI' => '/',
23 'REQUEST_METHOD' => 'GET',
24 ];
25
27 $this->server->httpRequest = ($request);
28 $this->server->exec();
29
30 $this->assertEquals(501, $this->response->status, 'We expected GET to not be implemented for Directories. Response body: ' . $this->response->body);
31
32 }
33
34 function testMountResponse() {
35
36 $serverVars = [
37 'REQUEST_URI' => '/?mount',
38 'REQUEST_METHOD' => 'GET',
39 'QUERY_STRING' => 'mount',
40 'HTTP_HOST' => 'example.org',
41 ];
42
44 $this->server->httpRequest = ($request);
45 $this->server->exec();
46
47 $this->assertEquals(200, $this->response->status);
48
49 $xml = simplexml_load_string($this->response->body);
50 $this->assertInstanceOf('SimpleXMLElement', $xml, 'Response was not a valid xml document. The list of errors:' . print_r(libxml_get_errors(), true) . '. xml body: ' . $this->response->body . '. What type we got: ' . gettype($xml) . ' class, if object: ' . get_class($xml));
51
52 $xml->registerXPathNamespace('dm', 'http://purl.org/NET/webdav/mount');
53 $url = $xml->xpath('//dm:url');
54 $this->assertEquals('http://example.org/', (string)$url[0]);
55
56 }
57
58}
An exception for terminatinating execution or to throw for unit testing.
This plugin provides support for RFC4709: Mounting WebDAV servers.
Definition: Plugin.php:18
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
Definition: Sapi.php:107
$url