Definition at line 5 of file PropPatchTest.php.
◆ setUp()
Sabre\DAV\PropPatchTest::setUp |
( |
| ) |
|
Definition at line 9 of file PropPatchTest.php.
9 {
10
11 $this->propPatch = new PropPatch([
12 '{DAV:}displayname' => 'foo',
13 ]);
14 $this->assertEquals(['{DAV:}displayname' => 'foo'], $this->propPatch->getMutations());
15
16 }
◆ testCommitNoHandler()
Sabre\DAV\PropPatchTest::testCommitNoHandler |
( |
| ) |
|
Definition at line 164 of file PropPatchTest.php.
164 {
165
166 $this->assertFalse($this->propPatch->commit());
167 $result = $this->propPatch->getResult();
168 $this->assertEquals([
'{DAV:}displayname' => 403],
$result);
169
170 }
References $result.
◆ testDependencyFail()
Sabre\DAV\PropPatchTest::testDependencyFail |
( |
| ) |
|
Definition at line 188 of file PropPatchTest.php.
188 {
189
191 '{DAV:}a' => 'foo',
192 '{DAV:}b' => 'bar',
193 ]);
194
195 $calledA = false;
196 $calledB = false;
197
198 $propPatch->handle(
'{DAV:}a',
function() use (&$calledA) {
199 $calledA = true;
200 return false;
201 });
202 $propPatch->handle(
'{DAV:}b',
function() use (&$calledB) {
203 $calledB = true;
204 return false;
205 });
206
208 $this->assertTrue($calledA);
209 $this->assertFalse($calledB);
210
212
213 $this->assertEquals([
214 '{DAV:}a' => 403,
215 '{DAV:}b' => 424,
217
218 }
References Sabre\DAV\PropPatchTest\$propPatch, and $result.
◆ testHandleMultiValueBroken()
Sabre\DAV\PropPatchTest::testHandleMultiValueBroken |
( |
| ) |
|
@expectedException \UnexpectedValueException
Definition at line 337 of file PropPatchTest.php.
337 {
338
340 '{DAV:}a' => 'foo',
341 '{DAV:}b' => 'bar',
342 '{DAV:}c' => null,
343 ]);
344
345 $propPatch->handle([
'{DAV:}a',
'{DAV:}b',
'{DAV:}c'],
function($properties) {
346 return 'hi';
347 });
349
350 }
References Sabre\DAV\PropPatchTest\$propPatch.
◆ testHandleMultiValueCustomResult()
Sabre\DAV\PropPatchTest::testHandleMultiValueCustomResult |
( |
| ) |
|
Definition at line 299 of file PropPatchTest.php.
299 {
300
302 '{DAV:}a' => 'foo',
303 '{DAV:}b' => 'bar',
304 '{DAV:}c' => null,
305 ]);
306
307 $calledA = false;
308
309 $propPatch->handle([
'{DAV:}a',
'{DAV:}b',
'{DAV:}c'],
function($properties) use (&$calledA) {
310 $calledA = true;
311 $this->assertEquals([
312 '{DAV:}a' => 'foo',
313 '{DAV:}b' => 'bar',
314 '{DAV:}c' => null,
315 ], $properties);
316
317 return [
318 '{DAV:}a' => 201,
319 '{DAV:}b' => 204,
320 ];
321 });
323 $this->assertTrue($calledA);
325
326 $this->assertEquals([
327 '{DAV:}a' => 201,
328 '{DAV:}b' => 204,
329 '{DAV:}c' => 500,
331
332 }
References Sabre\DAV\PropPatchTest\$propPatch, and $result.
◆ testHandleMultiValueFail()
Sabre\DAV\PropPatchTest::testHandleMultiValueFail |
( |
| ) |
|
Definition at line 268 of file PropPatchTest.php.
268 {
269
271 '{DAV:}a' => 'foo',
272 '{DAV:}b' => 'bar',
273 '{DAV:}c' => null,
274 ]);
275
276 $calledA = false;
277
278 $propPatch->handle([
'{DAV:}a',
'{DAV:}b',
'{DAV:}c'],
function($properties) use (&$calledA) {
279 $calledA = true;
280 $this->assertEquals([
281 '{DAV:}a' => 'foo',
282 '{DAV:}b' => 'bar',
283 '{DAV:}c' => null,
284 ], $properties);
285 return false;
286 });
288 $this->assertTrue($calledA);
290
291 $this->assertEquals([
292 '{DAV:}a' => 403,
293 '{DAV:}b' => 403,
294 '{DAV:}c' => 403,
296
297 }
References Sabre\DAV\PropPatchTest\$propPatch, and $result.
◆ testHandleMultiValueSuccess()
Sabre\DAV\PropPatchTest::testHandleMultiValueSuccess |
( |
| ) |
|
Definition at line 236 of file PropPatchTest.php.
236 {
237
239 '{DAV:}a' => 'foo',
240 '{DAV:}b' => 'bar',
241 '{DAV:}c' => null,
242 ]);
243
244 $calledA = false;
245
246 $propPatch->handle([
'{DAV:}a',
'{DAV:}b',
'{DAV:}c'],
function($properties) use (&$calledA) {
247 $calledA = true;
248 $this->assertEquals([
249 '{DAV:}a' => 'foo',
250 '{DAV:}b' => 'bar',
251 '{DAV:}c' => null,
252 ], $properties);
253 return true;
254 });
256 $this->assertTrue($calledA);
258
259 $this->assertEquals([
260 '{DAV:}a' => 200,
261 '{DAV:}b' => 200,
262 '{DAV:}c' => 204,
264
265 }
References Sabre\DAV\PropPatchTest\$propPatch, and $result.
◆ testHandleNothing()
Sabre\DAV\PropPatchTest::testHandleNothing |
( |
| ) |
|
Definition at line 92 of file PropPatchTest.php.
92 {
93
94 $hasRan = false;
95
96 $this->propPatch->handle('{DAV:}foobar', function($value) use (&$hasRan) {
97 $hasRan = true;
98 });
99
100 $this->assertFalse($hasRan);
101
102 }
◆ testHandleRemaining()
Sabre\DAV\PropPatchTest::testHandleRemaining |
( |
| ) |
|
@depends testHandleSingleSuccess
Definition at line 107 of file PropPatchTest.php.
107 {
108
109 $hasRan = false;
110
111 $this->propPatch->handleRemaining(function($mutations) use (&$hasRan) {
112 $hasRan = true;
113 $this->assertEquals(['{DAV:}displayname' => 'foo'], $mutations);
114 return true;
115 });
116
117 $this->assertTrue($this->propPatch->commit());
118 $result = $this->propPatch->getResult();
119 $this->assertEquals([
'{DAV:}displayname' => 200],
$result);
120
121 $this->assertTrue($hasRan);
122
123 }
References $result.
◆ testHandleRemainingNothingToDo()
Sabre\DAV\PropPatchTest::testHandleRemainingNothingToDo |
( |
| ) |
|
Definition at line 124 of file PropPatchTest.php.
124 {
125
126 $hasRan = false;
127
128 $this->propPatch->handle('{DAV:}displayname', function() {});
129 $this->propPatch->handleRemaining(function($mutations) use (&$hasRan) {
130 $hasRan = true;
131 });
132
133 $this->assertFalse($hasRan);
134
135 }
◆ testHandlerNotCalled()
Sabre\DAV\PropPatchTest::testHandlerNotCalled |
( |
| ) |
|
Definition at line 172 of file PropPatchTest.php.
172 {
173
174 $hasRan = false;
175
176 $this->propPatch->setResultCode('{DAV:}displayname', 402);
177 $this->propPatch->handle('{DAV:}displayname', function($value) use (&$hasRan) {
178 $hasRan = true;
179 });
180
181 $this->propPatch->commit();
182
183
184 $this->assertFalse($hasRan);
185
186 }
◆ testHandleSingleBrokenResult()
Sabre\DAV\PropPatchTest::testHandleSingleBrokenResult |
( |
| ) |
|
◆ testHandleSingleCustomResult()
Sabre\DAV\PropPatchTest::testHandleSingleCustomResult |
( |
| ) |
|
Definition at line 54 of file PropPatchTest.php.
54 {
55
56 $hasRan = false;
57
58 $this->propPatch->handle('{DAV:}displayname', function($value) use (&$hasRan) {
59 $hasRan = true;
60 $this->assertEquals('foo', $value);
61 return 201;
62 });
63
64 $this->assertTrue($this->propPatch->commit());
65 $result = $this->propPatch->getResult();
66 $this->assertEquals([
'{DAV:}displayname' => 201],
$result);
67
68 $this->assertTrue($hasRan);
69
70 }
References $result.
◆ testHandleSingleDeleteSuccess()
Sabre\DAV\PropPatchTest::testHandleSingleDeleteSuccess |
( |
| ) |
|
Definition at line 72 of file PropPatchTest.php.
72 {
73
74 $hasRan = false;
75
76 $this->propPatch = new PropPatch(['{DAV:}displayname' => null]);
77 $this->propPatch->handle('{DAV:}displayname', function($value) use (&$hasRan) {
78 $hasRan = true;
79 $this->assertNull($value);
80 return true;
81 });
82
83 $this->assertTrue($this->propPatch->commit());
84 $result = $this->propPatch->getResult();
85 $this->assertEquals([
'{DAV:}displayname' => 204],
$result);
86
87 $this->assertTrue($hasRan);
88
89 }
References $result.
◆ testHandleSingleFail()
Sabre\DAV\PropPatchTest::testHandleSingleFail |
( |
| ) |
|
Definition at line 36 of file PropPatchTest.php.
36 {
37
38 $hasRan = false;
39
40 $this->propPatch->handle('{DAV:}displayname', function($value) use (&$hasRan) {
41 $hasRan = true;
42 $this->assertEquals('foo', $value);
43 return false;
44 });
45
46 $this->assertFalse($this->propPatch->commit());
47 $result = $this->propPatch->getResult();
48 $this->assertEquals([
'{DAV:}displayname' => 403],
$result);
49
50 $this->assertTrue($hasRan);
51
52 }
References $result.
◆ testHandleSingleSuccess()
Sabre\DAV\PropPatchTest::testHandleSingleSuccess |
( |
| ) |
|
Definition at line 18 of file PropPatchTest.php.
18 {
19
20 $hasRan = false;
21
22 $this->propPatch->handle('{DAV:}displayname', function($value) use (&$hasRan) {
23 $hasRan = true;
24 $this->assertEquals('foo', $value);
25 return true;
26 });
27
28 $this->assertTrue($this->propPatch->commit());
29 $result = $this->propPatch->getResult();
30 $this->assertEquals([
'{DAV:}displayname' => 200],
$result);
31
32 $this->assertTrue($hasRan);
33
34 }
References $result.
◆ testSetRemainingResultCode()
Sabre\DAV\PropPatchTest::testSetRemainingResultCode |
( |
| ) |
|
Definition at line 155 of file PropPatchTest.php.
155 {
156
157 $this->propPatch->setRemainingResultCode(204);
158 $this->assertTrue($this->propPatch->commit());
159 $result = $this->propPatch->getResult();
160 $this->assertEquals([
'{DAV:}displayname' => 204],
$result);
161
162 }
References $result.
◆ testSetResultCode()
Sabre\DAV\PropPatchTest::testSetResultCode |
( |
| ) |
|
Definition at line 137 of file PropPatchTest.php.
137 {
138
139 $this->propPatch->setResultCode('{DAV:}displayname', 201);
140 $this->assertTrue($this->propPatch->commit());
141 $result = $this->propPatch->getResult();
142 $this->assertEquals([
'{DAV:}displayname' => 201],
$result);
143
144 }
References $result.
◆ testSetResultCodeFail()
Sabre\DAV\PropPatchTest::testSetResultCodeFail |
( |
| ) |
|
Definition at line 146 of file PropPatchTest.php.
146 {
147
148 $this->propPatch->setResultCode('{DAV:}displayname', 402);
149 $this->assertFalse($this->propPatch->commit());
150 $result = $this->propPatch->getResult();
151 $this->assertEquals([
'{DAV:}displayname' => 402],
$result);
152
153 }
References $result.
◆ $propPatch
Sabre\DAV\PropPatchTest::$propPatch |
|
protected |
The documentation for this class was generated from the following file: