Definition at line 10 of file ExpandPropertiesTest.php.
◆ getServer()
Sabre\DAVACL\ExpandPropertiesTest::getServer |
( |
| ) |
|
Definition at line 12 of file ExpandPropertiesTest.php.
References $tree.
Referenced by Sabre\DAVACL\ExpandPropertiesTest\testExpand(), Sabre\DAVACL\ExpandPropertiesTest\testExpandDeep(), Sabre\DAVACL\ExpandPropertiesTest\testExpandHrefList(), and Sabre\DAVACL\ExpandPropertiesTest\testSimple().
15 new DAV\Mock\PropertiesCollection(
'node1', [], [
16 '{http://sabredav.org/ns}simple' =>
'foo',
17 '{http://sabredav.org/ns}href' =>
new DAV\Xml\Property\Href(
'node2'),
18 '{DAV:}displayname' =>
'Node 1',
20 new DAV\Mock\PropertiesCollection(
'node2', [], [
21 '{http://sabredav.org/ns}simple' =>
'simple',
22 '{http://sabredav.org/ns}hreflist' =>
new DAV\Xml\Property\Href([
'node1',
'node3']),
23 '{DAV:}displayname' =>
'Node 2',
25 new DAV\Mock\PropertiesCollection(
'node3', [], [
26 '{http://sabredav.org/ns}simple' =>
'simple',
27 '{DAV:}displayname' =>
'Node 3',
31 $fakeServer =
new DAV\Server(
$tree);
32 $fakeServer->sapi =
new HTTP\SapiMock();
33 $fakeServer->debugExceptions =
true;
34 $fakeServer->httpResponse =
new HTTP\ResponseMock();
35 $plugin =
new Plugin();
36 $plugin->allowUnauthenticatedAccess =
false;
38 $plugin->setDefaultACL([
40 'principal' =>
'{DAV:}all',
41 'privilege' =>
'{DAV:}all',
44 $this->assertTrue($plugin instanceof Plugin);
46 $fakeServer->addPlugin($plugin);
47 $this->assertEquals($plugin, $fakeServer->getPlugin(
'acl'));
◆ testExpand()
Sabre\DAVACL\ExpandPropertiesTest::testExpand |
( |
| ) |
|
testSimple
Definition at line 117 of file ExpandPropertiesTest.php.
References $request, $result, $server, $xml, Sabre\HTTP\Sapi\createFromServerArray(), Sabre\DAVACL\ExpandPropertiesTest\getServer(), and Sabre\DAV\Version\VERSION.
119 $xml =
'<?xml version="1.0"?> 120 <d:expand-property xmlns:d="DAV:"> 121 <d:property name="href" namespace="http://sabredav.org/ns"> 122 <d:property name="displayname" /> 124 </d:expand-property>';
127 'REQUEST_METHOD' =>
'REPORT',
129 'REQUEST_URI' =>
'/node1',
140 $this->assertEquals(207,
$server->httpResponse->status,
'Incorrect response status received. Full response body: ' .
$server->httpResponse->body);
141 $this->assertEquals([
143 'Content-Type' => [
'application/xml; charset=utf-8'],
144 ],
$server->httpResponse->getHeaders());
149 '/d:multistatus/d:response' => 1,
150 '/d:multistatus/d:response/d:href' => 1,
151 '/d:multistatus/d:response/d:propstat' => 1,
152 '/d:multistatus/d:response/d:propstat/d:prop' => 1,
153 '/d:multistatus/d:response/d:propstat/d:prop/s:href' => 1,
154 '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:response' => 1,
155 '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:response/d:href' => 1,
156 '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:response/d:propstat' => 1,
157 '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:response/d:propstat/d:prop' => 1,
158 '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:response/d:propstat/d:prop/d:displayname' => 1,
161 $xml = simplexml_load_string(
$server->httpResponse->body);
162 $xml->registerXPathNamespace(
'd',
'DAV:');
163 $xml->registerXPathNamespace(
's',
'http://sabredav.org/ns');
164 foreach ($check as $v1 => $v2) {
166 $xpath = is_int($v1) ? $v2 : $v1;
171 if (!is_int($v1)) $count = $v2;
173 $this->assertEquals($count, count(
$result),
'we expected ' . $count .
' appearances of ' . $xpath .
' . We found ' . count(
$result) .
' Full response body: ' .
$server->httpResponse->getBodyAsString());
foreach($paths as $path) $request
const VERSION
Full version number.
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
◆ testExpandDeep()
Sabre\DAVACL\ExpandPropertiesTest::testExpandDeep |
( |
| ) |
|
testExpand
Definition at line 247 of file ExpandPropertiesTest.php.
References $request, $result, $server, $xml, Sabre\HTTP\Sapi\createFromServerArray(), Sabre\DAVACL\ExpandPropertiesTest\getServer(), and Sabre\DAV\Version\VERSION.
249 $xml =
'<?xml version="1.0"?> 250 <d:expand-property xmlns:d="DAV:"> 251 <d:property name="hreflist" namespace="http://sabredav.org/ns"> 252 <d:property name="href" namespace="http://sabredav.org/ns"> 253 <d:property name="displayname" /> 255 <d:property name="displayname" /> 257 </d:expand-property>';
260 'REQUEST_METHOD' =>
'REPORT',
262 'REQUEST_URI' =>
'/node2',
273 $this->assertEquals(207,
$server->httpResponse->status);
274 $this->assertEquals([
276 'Content-Type' => [
'application/xml; charset=utf-8'],
277 ],
$server->httpResponse->getHeaders());
282 '/d:multistatus/d:response' => 1,
283 '/d:multistatus/d:response/d:href' => 1,
284 '/d:multistatus/d:response/d:propstat' => 1,
285 '/d:multistatus/d:response/d:propstat/d:prop' => 1,
286 '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist' => 1,
287 '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response' => 2,
288 '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:href' => 2,
289 '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat' => 3,
290 '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop' => 3,
291 '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/d:displayname' => 2,
292 '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href' => 2,
293 '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href/d:response' => 1,
294 '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href/d:response/d:href' => 1,
295 '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href/d:response/d:propstat' => 1,
296 '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href/d:response/d:propstat/d:prop' => 1,
297 '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href/d:response/d:propstat/d:prop/d:displayname' => 1,
300 $xml = simplexml_load_string(
$server->httpResponse->body);
301 $xml->registerXPathNamespace(
'd',
'DAV:');
302 $xml->registerXPathNamespace(
's',
'http://sabredav.org/ns');
303 foreach ($check as $v1 => $v2) {
305 $xpath = is_int($v1) ? $v2 : $v1;
310 if (!is_int($v1)) $count = $v2;
312 $this->assertEquals($count, count(
$result),
'we expected ' . $count .
' appearances of ' . $xpath .
' . We found ' . count(
$result));
foreach($paths as $path) $request
const VERSION
Full version number.
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
◆ testExpandHrefList()
Sabre\DAVACL\ExpandPropertiesTest::testExpandHrefList |
( |
| ) |
|
testSimple
Definition at line 182 of file ExpandPropertiesTest.php.
References $request, $result, $server, $xml, Sabre\HTTP\Sapi\createFromServerArray(), Sabre\DAVACL\ExpandPropertiesTest\getServer(), and Sabre\DAV\Version\VERSION.
184 $xml =
'<?xml version="1.0"?> 185 <d:expand-property xmlns:d="DAV:"> 186 <d:property name="hreflist" namespace="http://sabredav.org/ns"> 187 <d:property name="displayname" /> 189 </d:expand-property>';
192 'REQUEST_METHOD' =>
'REPORT',
194 'REQUEST_URI' =>
'/node2',
205 $this->assertEquals(207,
$server->httpResponse->status);
206 $this->assertEquals([
208 'Content-Type' => [
'application/xml; charset=utf-8'],
209 ],
$server->httpResponse->getHeaders());
214 '/d:multistatus/d:response' => 1,
215 '/d:multistatus/d:response/d:href' => 1,
216 '/d:multistatus/d:response/d:propstat' => 1,
217 '/d:multistatus/d:response/d:propstat/d:prop' => 1,
218 '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist' => 1,
219 '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response' => 2,
220 '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:href' => 2,
221 '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat' => 2,
222 '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop' => 2,
223 '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/d:displayname' => 2,
226 $xml = simplexml_load_string(
$server->httpResponse->body);
227 $xml->registerXPathNamespace(
'd',
'DAV:');
228 $xml->registerXPathNamespace(
's',
'http://sabredav.org/ns');
229 foreach ($check as $v1 => $v2) {
231 $xpath = is_int($v1) ? $v2 : $v1;
236 if (!is_int($v1)) $count = $v2;
238 $this->assertEquals($count, count(
$result),
'we expected ' . $count .
' appearances of ' . $xpath .
' . We found ' . count(
$result));
foreach($paths as $path) $request
const VERSION
Full version number.
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
◆ testSimple()
Sabre\DAVACL\ExpandPropertiesTest::testSimple |
( |
| ) |
|
Definition at line 53 of file ExpandPropertiesTest.php.
References $request, $result, $server, $xml, Sabre\HTTP\Sapi\createFromServerArray(), Sabre\DAVACL\ExpandPropertiesTest\getServer(), and Sabre\DAV\Version\VERSION.
55 $xml =
'<?xml version="1.0"?> 56 <d:expand-property xmlns:d="DAV:"> 57 <d:property name="displayname" /> 58 <d:property name="foo" namespace="http://www.sabredav.org/NS/2010/nonexistant" /> 59 <d:property name="simple" namespace="http://sabredav.org/ns" /> 60 <d:property name="href" namespace="http://sabredav.org/ns" /> 61 </d:expand-property>';
64 'REQUEST_METHOD' =>
'REPORT',
66 'REQUEST_URI' =>
'/node1',
77 $this->assertEquals(207,
$server->httpResponse->status,
'Incorrect status code received. Full body: ' .
$server->httpResponse->body);
80 'Content-Type' => [
'application/xml; charset=utf-8'],
81 ],
$server->httpResponse->getHeaders());
86 '/d:multistatus/d:response' => 1,
87 '/d:multistatus/d:response/d:href' => 1,
88 '/d:multistatus/d:response/d:propstat' => 2,
89 '/d:multistatus/d:response/d:propstat/d:prop' => 2,
90 '/d:multistatus/d:response/d:propstat/d:prop/d:displayname' => 1,
91 '/d:multistatus/d:response/d:propstat/d:prop/s:simple' => 1,
92 '/d:multistatus/d:response/d:propstat/d:prop/s:href' => 1,
93 '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:href' => 1,
96 $xml = simplexml_load_string(
$server->httpResponse->body);
97 $xml->registerXPathNamespace(
'd',
'DAV:');
98 $xml->registerXPathNamespace(
's',
'http://sabredav.org/ns');
99 foreach ($check as $v1 => $v2) {
101 $xpath = is_int($v1) ? $v2 : $v1;
106 if (!is_int($v1)) $count = $v2;
108 $this->assertEquals($count, count(
$result),
'we expected ' . $count .
' appearances of ' . $xpath .
' . We found ' . count(
$result) .
'. Full response: ' .
$server->httpResponse->body);
foreach($paths as $path) $request
const VERSION
Full version number.
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
The documentation for this class was generated from the following file: