|
| sendRequest ($body, $path='/', $headers=['Depth'=> '0']) |
|
Definition at line 10 of file ServerPropsTest.php.
◆ getRootNode()
Sabre\DAV\ServerPropsTest::getRootNode |
( |
| ) |
|
|
protected |
◆ sendRequest()
Sabre\DAV\ServerPropsTest::sendRequest |
( |
|
$body, |
|
|
|
$path = '/' , |
|
|
|
$headers = ['Depth' = , |
|
|
'0'] |
|
|
) |
| |
|
private |
◆ setUp()
Sabre\DAV\ServerPropsTest::setUp |
( |
| ) |
|
Definition at line 18 of file ServerPropsTest.php.
20 if (file_exists(SABRE_TEMPDIR .
'../.sabredav')) unlink(SABRE_TEMPDIR .
'../.sabredav');
22 file_put_contents(SABRE_TEMPDIR .
'/test2.txt',
'Test contents2');
23 mkdir(SABRE_TEMPDIR .
'/col');
24 file_put_contents(SABRE_TEMPDIR .
'col/test.txt',
'Test contents');
25 $this->server->addPlugin(
new Locks\Plugin(
new Locks\Backend\
File(SABRE_TEMPDIR .
'/.locksdb')));
◆ tearDown()
Sabre\DAV\ServerPropsTest::tearDown |
( |
| ) |
|
◆ testLockDiscovery()
Sabre\DAV\ServerPropsTest::testLockDiscovery |
( |
| ) |
|
Definition at line 131 of file ServerPropsTest.php.
References $data, $xml, and Sabre\DAV\ServerPropsTest\sendRequest().
133 $xml =
'<?xml version="1.0"?> 134 <d:propfind xmlns:d="DAV:"> 142 $body = preg_replace(
"/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/",
"xmlns\\1=\"urn:DAV\"", $this->response->body);
143 $xml = simplexml_load_string($body);
144 $xml->registerXPathNamespace(
'd',
'urn:DAV');
146 $data =
$xml->xpath(
'/d:multistatus/d:response/d:propstat/d:prop/d:lockdiscovery');
147 $this->assertEquals(1, count(
$data),
'We expected a \'d:lockdiscovery\' tag');
sendRequest($body, $path='/', $headers=['Depth'=> '0'])
◆ testParsePropPatchRequest()
Sabre\DAV\ServerPropsTest::testParsePropPatchRequest |
( |
| ) |
|
Definition at line 182 of file ServerPropsTest.php.
References $result.
184 $body =
'<?xml version="1.0"?> 185 <d:propertyupdate xmlns:d="DAV:" xmlns:s="http://sabredav.org/NS/test"> 186 <d:set><d:prop><s:someprop>somevalue</s:someprop></d:prop></d:set> 187 <d:remove><d:prop><s:someprop2 /></d:prop></d:remove> 188 <d:set><d:prop><s:someprop3>removeme</s:someprop3></d:prop></d:set> 189 <d:remove><d:prop><s:someprop3 /></d:prop></d:remove> 190 </d:propertyupdate>';
192 $result = $this->server->xml->parse($body);
193 $this->assertEquals([
194 '{http://sabredav.org/NS/test}someprop' =>
'somevalue',
195 '{http://sabredav.org/NS/test}someprop2' => null,
196 '{http://sabredav.org/NS/test}someprop3' => null,
◆ testPropFindEmptyBody()
Sabre\DAV\ServerPropsTest::testPropFindEmptyBody |
( |
| ) |
|
Definition at line 45 of file ServerPropsTest.php.
References $data, $xml, Sabre\DAV\ServerPropsTest\sendRequest(), and Sabre\DAV\Version\VERSION.
48 $this->assertEquals(207, $this->response->status);
52 'Content-Type' => [
'application/xml; charset=utf-8'],
53 'DAV' => [
'1, 3, extended-mkcol, 2'],
54 'Vary' => [
'Brief,Prefer'],
56 $this->response->getHeaders()
59 $body = preg_replace(
"/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/",
"xmlns\\1=\"urn:DAV\"", $this->response->body);
60 $xml = simplexml_load_string($body);
61 $xml->registerXPathNamespace(
'd',
'urn:DAV');
63 list(
$data) =
$xml->xpath(
'/d:multistatus/d:response/d:href');
64 $this->assertEquals(
'/', (
string)
$data,
'href element should have been /');
66 $data =
$xml->xpath(
'/d:multistatus/d:response/d:propstat/d:prop/d:resourcetype');
67 $this->assertEquals(1, count(
$data));
const VERSION
Full version number.
sendRequest($body, $path='/', $headers=['Depth'=> '0'])
◆ testPropFindEmptyBodyFile()
Sabre\DAV\ServerPropsTest::testPropFindEmptyBodyFile |
( |
| ) |
|
Definition at line 71 of file ServerPropsTest.php.
References $data, $xml, Sabre\DAV\ServerPropsTest\sendRequest(), and Sabre\DAV\Version\VERSION.
74 $this->assertEquals(207, $this->response->status);
78 'Content-Type' => [
'application/xml; charset=utf-8'],
79 'DAV' => [
'1, 3, extended-mkcol, 2'],
80 'Vary' => [
'Brief,Prefer'],
82 $this->response->getHeaders()
85 $body = preg_replace(
"/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/",
"xmlns\\1=\"urn:DAV\"", $this->response->body);
86 $xml = simplexml_load_string($body);
87 $xml->registerXPathNamespace(
'd',
'urn:DAV');
89 list(
$data) =
$xml->xpath(
'/d:multistatus/d:response/d:href');
90 $this->assertEquals(
'/test2.txt', (
string)
$data,
'href element should have been /test2.txt');
92 $data =
$xml->xpath(
'/d:multistatus/d:response/d:propstat/d:prop/d:getcontentlength');
93 $this->assertEquals(1, count(
$data));
const VERSION
Full version number.
sendRequest($body, $path='/', $headers=['Depth'=> '0'])
◆ testSupportedLocks()
Sabre\DAV\ServerPropsTest::testSupportedLocks |
( |
| ) |
|
Definition at line 97 of file ServerPropsTest.php.
References $data, $xml, and Sabre\DAV\ServerPropsTest\sendRequest().
99 $xml =
'<?xml version="1.0"?> 100 <d:propfind xmlns:d="DAV:"> 108 $body = preg_replace(
"/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/",
"xmlns\\1=\"urn:DAV\"", $this->response->body);
109 $xml = simplexml_load_string($body);
110 $xml->registerXPathNamespace(
'd',
'urn:DAV');
112 $data =
$xml->xpath(
'/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry');
113 $this->assertEquals(2, count(
$data),
'We expected two \'d:lockentry\' tags');
115 $data =
$xml->xpath(
'/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry/d:lockscope');
116 $this->assertEquals(2, count(
$data),
'We expected two \'d:lockscope\' tags');
118 $data =
$xml->xpath(
'/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry/d:locktype');
119 $this->assertEquals(2, count(
$data),
'We expected two \'d:locktype\' tags');
121 $data =
$xml->xpath(
'/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry/d:lockscope/d:shared');
122 $this->assertEquals(1, count(
$data),
'We expected a \'d:shared\' tag');
124 $data =
$xml->xpath(
'/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry/d:lockscope/d:exclusive');
125 $this->assertEquals(1, count(
$data),
'We expected a \'d:exclusive\' tag');
127 $data =
$xml->xpath(
'/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry/d:locktype/d:write');
128 $this->assertEquals(2, count(
$data),
'We expected two \'d:write\' tags');
sendRequest($body, $path='/', $headers=['Depth'=> '0'])
◆ testUnknownProperty()
Sabre\DAV\ServerPropsTest::testUnknownProperty |
( |
| ) |
|
Definition at line 151 of file ServerPropsTest.php.
References $test, $xml, and Sabre\DAV\ServerPropsTest\sendRequest().
153 $xml =
'<?xml version="1.0"?> 154 <d:propfind xmlns:d="DAV:"> 161 $body = preg_replace(
"/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/",
"xmlns\\1=\"urn:DAV\"", $this->response->body);
162 $xml = simplexml_load_string($body);
163 $xml->registerXPathNamespace(
'd',
'urn:DAV');
166 '/d:multistatus/d:response',
167 '/d:multistatus/d:response/d:propstat',
168 '/d:multistatus/d:response/d:propstat/d:status',
169 '/d:multistatus/d:response/d:propstat/d:prop',
170 '/d:multistatus/d:response/d:propstat/d:prop/d:macaroni',
172 foreach ($pathTests as
$test) {
173 $this->assertTrue(count(
$xml->xpath($test)) ==
true,
'We expected the ' . $test .
' element to appear in the response, we got: ' . $body);
176 $val =
$xml->xpath(
'/d:multistatus/d:response/d:propstat/d:status');
177 $this->assertEquals(1, count($val), $body);
178 $this->assertEquals(
'HTTP/1.1 404 Not Found', (
string)$val[0]);
sendRequest($body, $path='/', $headers=['Depth'=> '0'])
The documentation for this class was generated from the following file: