Complex classes like RootTest often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use RootTest, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
16 | class RootTest extends RESTFunctionalTestCase |
||
17 | { |
||
18 | use AssertXmlTagTrait; |
||
19 | |||
20 | /** |
||
21 | * @covers GET / |
||
22 | */ |
||
23 | public function testLoadRootResource() |
||
24 | { |
||
25 | $response = $this->sendHttpRequest( |
||
26 | $this->createHttpRequest('GET', '/api/ezp/v2/') |
||
27 | ); |
||
28 | self::assertHttpResponseCodeEquals($response, 200); |
||
29 | |||
30 | return $response->getContent(); |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @dataProvider getRandomUriSet |
||
35 | * @covers GET /<wrongUri> |
||
36 | */ |
||
37 | public function testCatchAll($uri) |
||
48 | |||
49 | /** |
||
50 | * @depends testLoadRootResource |
||
51 | */ |
||
52 | public function testResultContainsRootElement($result) |
||
53 | { |
||
54 | $this->assertXMLTag( |
||
55 | array('tag' => 'Root'), |
||
56 | $result, |
||
57 | 'Invalid <Root> element.', |
||
58 | false |
||
59 | ); |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * Test if result contains Role element attributes. |
||
64 | * |
||
65 | * @param string $result |
||
66 | * |
||
67 | * @depends testLoadRootResource |
||
68 | */ |
||
69 | public function testResultContainsRootAttributes($result) |
||
70 | { |
||
71 | $this->assertXMLTag( |
||
72 | array( |
||
73 | 'tag' => 'Root', |
||
74 | 'attributes' => array( |
||
75 | 'media-type' => 'application/vnd.ez.api.Root+xml', |
||
76 | ), |
||
77 | ), |
||
78 | $result, |
||
79 | 'Invalid <Root> attributes.', |
||
80 | false |
||
81 | ); |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * @depends testLoadRootResource |
||
86 | */ |
||
87 | public function testResultContainsContentTag($result) |
||
88 | { |
||
89 | $this->assertXMLTag( |
||
90 | array( |
||
91 | 'tag' => 'content', |
||
92 | ), |
||
93 | $result, |
||
94 | 'Invalid <content> element.', |
||
95 | false |
||
96 | ); |
||
97 | } |
||
98 | |||
99 | /** |
||
100 | * @depends testLoadRootResource |
||
101 | */ |
||
102 | public function testResultContainsContentTagAttributes($result) |
||
103 | { |
||
104 | $this->assertXMLTag( |
||
105 | array( |
||
106 | 'tag' => 'content', |
||
107 | 'attributes' => array( |
||
108 | 'media-type' => '', |
||
109 | 'href' => '/api/ezp/v2/content/objects', |
||
110 | ), |
||
111 | ), |
||
112 | $result, |
||
113 | 'Invalid <content> element.', |
||
114 | false |
||
115 | ); |
||
116 | } |
||
117 | |||
118 | /** |
||
119 | * @depends testLoadRootResource |
||
120 | */ |
||
121 | public function testResultContainsContentByRemoteIdTag($result) |
||
122 | { |
||
123 | $this->assertXMLTag( |
||
124 | array( |
||
125 | 'tag' => 'contentByRemoteId', |
||
126 | ), |
||
127 | $result, |
||
128 | 'Missing <contentByRemoteId> element.', |
||
129 | false |
||
130 | ); |
||
131 | } |
||
132 | |||
133 | /** |
||
134 | * @depends testLoadRootResource |
||
135 | */ |
||
136 | public function testResultContainsContentByRemoteIdTagAttributes($result) |
||
137 | { |
||
138 | $this->assertXMLTag( |
||
139 | array( |
||
140 | 'tag' => 'contentByRemoteId', |
||
141 | 'attributes' => array( |
||
142 | 'media-type' => '', |
||
143 | 'href' => '/api/ezp/v2/content/objects{?remoteId}', |
||
144 | ), |
||
145 | ), |
||
146 | $result, |
||
147 | 'Invalid <contentByRemoteId> tag attributes.', |
||
148 | false |
||
149 | ); |
||
150 | } |
||
151 | |||
152 | /** |
||
153 | * @depends testLoadRootResource |
||
154 | */ |
||
155 | public function testResultContainsContentTypesTag($result) |
||
156 | { |
||
157 | $this->assertXMLTag( |
||
158 | array( |
||
159 | 'tag' => 'contentTypes', |
||
160 | ), |
||
161 | $result, |
||
162 | 'Invalid <contentTypes> element.', |
||
163 | false |
||
164 | ); |
||
165 | } |
||
166 | |||
167 | /** |
||
168 | * @depends testLoadRootResource |
||
169 | */ |
||
170 | public function testResultContainsContentTypesTagAttributes($result) |
||
171 | { |
||
172 | $this->assertXMLTag( |
||
173 | array( |
||
174 | 'tag' => 'contentTypes', |
||
175 | 'attributes' => array( |
||
176 | 'media-type' => 'application/vnd.ez.api.ContentTypeInfoList+xml', |
||
177 | 'href' => '/api/ezp/v2/content/types', |
||
178 | ), |
||
179 | ), |
||
180 | $result, |
||
181 | 'Invalid <content> element.', |
||
182 | false |
||
183 | ); |
||
184 | } |
||
185 | |||
186 | /** |
||
187 | * @depends testLoadRootResource |
||
188 | */ |
||
189 | public function testResultContainsContentTypeByIdentifierTag($result) |
||
190 | { |
||
191 | $this->assertXMLTag( |
||
192 | array( |
||
193 | 'tag' => 'contentTypeByIdentifier', |
||
194 | ), |
||
195 | $result, |
||
196 | 'Invalid <contentTypeByIdentifier> element.', |
||
197 | false |
||
198 | ); |
||
199 | } |
||
200 | |||
201 | /** |
||
202 | * @depends testLoadRootResource |
||
203 | */ |
||
204 | public function testResultContainsContentTypeByIdentifierTagAttributes($result) |
||
205 | { |
||
206 | $this->assertXMLTag( |
||
207 | array( |
||
208 | 'tag' => 'contentTypeByIdentifier', |
||
209 | 'attributes' => array( |
||
210 | 'media-type' => '', |
||
211 | 'href' => '/api/ezp/v2/content/types{?identifier}', |
||
212 | ), |
||
213 | ), |
||
214 | $result, |
||
215 | 'Invalid <contentTypeByIdentifier> tag attributes.', |
||
216 | false |
||
217 | ); |
||
218 | } |
||
219 | |||
220 | /** |
||
221 | * @depends testLoadRootResource |
||
222 | */ |
||
223 | public function testResultContainsContentTypeGroupsTag($result) |
||
224 | { |
||
225 | $this->assertXMLTag( |
||
226 | array( |
||
227 | 'tag' => 'contentTypeGroups', |
||
228 | ), |
||
229 | $result, |
||
230 | 'Missing <contentTypeGroups> element.', |
||
231 | false |
||
232 | ); |
||
233 | } |
||
234 | |||
235 | /** |
||
236 | * @depends testLoadRootResource |
||
237 | */ |
||
238 | public function testResultContainsContentTypeGroupsTagAttributes($result) |
||
239 | { |
||
240 | $this->assertXMLTag( |
||
241 | array( |
||
242 | 'tag' => 'contentTypeGroups', |
||
243 | 'attributes' => array( |
||
244 | 'media-type' => 'application/vnd.ez.api.ContentTypeGroupList+xml', |
||
245 | 'href' => '/api/ezp/v2/content/typegroups', |
||
246 | ), |
||
247 | ), |
||
248 | $result, |
||
249 | 'Invalid <contentTypeGroups> tag attributes.', |
||
250 | false |
||
251 | ); |
||
252 | } |
||
253 | |||
254 | /** |
||
255 | * @depends testLoadRootResource |
||
256 | */ |
||
257 | public function testResultContainsContentTypeGroupByIdentifierTag($result) |
||
258 | { |
||
259 | $this->assertXMLTag( |
||
260 | array( |
||
261 | 'tag' => 'contentTypeGroupByIdentifier', |
||
262 | ), |
||
263 | $result, |
||
264 | 'Missing <ContentTypeGroupByIdentifier> element.', |
||
265 | false |
||
266 | ); |
||
267 | } |
||
268 | |||
269 | /** |
||
270 | * @depends testLoadRootResource |
||
271 | */ |
||
272 | public function testResultContainsContentTypeGroupByIdentifierTagAttributes($result) |
||
273 | { |
||
274 | $this->assertXMLTag( |
||
275 | array( |
||
276 | 'tag' => 'contentTypeGroupByIdentifier', |
||
277 | 'attributes' => array( |
||
278 | 'media-type' => '', |
||
279 | 'href' => '/api/ezp/v2/content/typegroups{?identifier}', |
||
280 | ), |
||
281 | ), |
||
282 | $result, |
||
283 | 'Invalid <contentTypeGroupByIdentifier> tag attributes.', |
||
284 | false |
||
285 | ); |
||
286 | } |
||
287 | |||
288 | /** |
||
289 | * @depends testLoadRootResource |
||
290 | */ |
||
291 | public function testResultContainsUsersTag($result) |
||
292 | { |
||
293 | $this->assertXMLTag( |
||
294 | array( |
||
295 | 'tag' => 'users', |
||
296 | ), |
||
297 | $result, |
||
298 | 'Invalid <users> tag.', |
||
299 | false |
||
300 | ); |
||
301 | } |
||
302 | |||
303 | /** |
||
304 | * @depends testLoadRootResource |
||
305 | */ |
||
306 | public function testResultContainsUsersTagAttributes($result) |
||
307 | { |
||
308 | $this->assertXMLTag( |
||
309 | array( |
||
310 | 'tag' => 'users', |
||
311 | 'attributes' => array( |
||
312 | 'media-type' => 'application/vnd.ez.api.UserRefList+xml', |
||
313 | 'href' => '/api/ezp/v2/user/users', |
||
314 | ), |
||
315 | ), |
||
316 | $result, |
||
317 | 'Invalid <users> tag attributes.', |
||
318 | false |
||
319 | ); |
||
320 | } |
||
321 | |||
322 | /** |
||
323 | * @depends testLoadRootResource |
||
324 | */ |
||
325 | public function testResultContainsUsersByRoleIdentifierTag($result) |
||
326 | { |
||
327 | $this->assertXMLTag( |
||
328 | array( |
||
329 | 'tag' => 'usersByRoleId', |
||
330 | ), |
||
331 | $result, |
||
332 | 'Missing <usersByRoleId> element.', |
||
333 | false |
||
334 | ); |
||
335 | } |
||
336 | |||
337 | /** |
||
338 | * @depends testLoadRootResource |
||
339 | */ |
||
340 | public function testResultContainsUsersByRoleIdentifierTagAttributes($result) |
||
341 | { |
||
342 | $this->assertXMLTag( |
||
343 | array( |
||
344 | 'tag' => 'usersByRoleId', |
||
345 | 'attributes' => array( |
||
346 | 'media-type' => 'application/vnd.ez.api.UserRefList+xml', |
||
347 | 'href' => '/api/ezp/v2/user/users{?roleId}', |
||
348 | ), |
||
349 | ), |
||
350 | $result, |
||
351 | 'Invalid <usersByRoleId> tag attributes.', |
||
352 | false |
||
353 | ); |
||
354 | } |
||
355 | |||
356 | /** |
||
357 | * @depends testLoadRootResource |
||
358 | */ |
||
359 | public function testResultContainsUsersByRemoteIdentifierTag($result) |
||
360 | { |
||
361 | $this->assertXMLTag( |
||
362 | array( |
||
363 | 'tag' => 'usersByRemoteId', |
||
364 | ), |
||
365 | $result, |
||
366 | 'Missing <usersByRemoteId> element.', |
||
367 | false |
||
368 | ); |
||
369 | } |
||
370 | |||
371 | /** |
||
372 | * @depends testLoadRootResource |
||
373 | */ |
||
374 | public function testResultContainsUsersByRemoteIdentifierTagAttributes($result) |
||
375 | { |
||
376 | $this->assertXMLTag( |
||
377 | array( |
||
378 | 'tag' => 'usersByRemoteId', |
||
379 | 'attributes' => array( |
||
380 | 'media-type' => 'application/vnd.ez.api.UserRefList+xml', |
||
381 | 'href' => '/api/ezp/v2/user/users{?remoteId}', |
||
382 | ), |
||
383 | ), |
||
384 | $result, |
||
385 | 'Invalid <usersByRemoteId> tag attributes.', |
||
386 | false |
||
387 | ); |
||
388 | } |
||
389 | |||
390 | /** |
||
391 | * @depends testLoadRootResource |
||
392 | */ |
||
393 | public function testResultContainsUsersByEmailTag($result) |
||
394 | { |
||
395 | $this->assertXMLTag( |
||
396 | array( |
||
397 | 'tag' => 'usersByEmail', |
||
398 | ), |
||
399 | $result, |
||
400 | 'Missing <usersByEmail> element.', |
||
401 | false |
||
402 | ); |
||
403 | } |
||
404 | |||
405 | /** |
||
406 | * @depends testLoadRootResource |
||
407 | */ |
||
408 | public function testResultContainsUsersByEmailTagAttributes($result) |
||
409 | { |
||
410 | $this->assertXMLTag( |
||
411 | array( |
||
412 | 'tag' => 'usersByEmail', |
||
413 | 'attributes' => array( |
||
414 | 'media-type' => 'application/vnd.ez.api.UserRefList+xml', |
||
415 | 'href' => '/api/ezp/v2/user/users{?email}', |
||
416 | ), |
||
417 | ), |
||
418 | $result, |
||
419 | 'Invalid <usersByEmail> tag attributes.', |
||
420 | false |
||
421 | ); |
||
422 | } |
||
423 | |||
424 | /** |
||
425 | * @depends testLoadRootResource |
||
426 | */ |
||
427 | public function testResultContainsUsersByLoginTag($result) |
||
428 | { |
||
429 | $this->assertXMLTag( |
||
430 | array( |
||
431 | 'tag' => 'usersByLogin', |
||
432 | ), |
||
433 | $result, |
||
434 | 'Missing <usersByLogin> element.', |
||
435 | false |
||
436 | ); |
||
437 | } |
||
438 | |||
439 | /** |
||
440 | * @depends testLoadRootResource |
||
441 | */ |
||
442 | public function testResultContainsUsersByLoginTagAttributes($result) |
||
443 | { |
||
444 | $this->assertXMLTag( |
||
445 | array( |
||
446 | 'tag' => 'usersByLogin', |
||
447 | 'attributes' => array( |
||
448 | 'media-type' => 'application/vnd.ez.api.UserRefList+xml', |
||
449 | 'href' => '/api/ezp/v2/user/users{?login}', |
||
450 | ), |
||
451 | ), |
||
452 | $result, |
||
453 | 'Invalid <usersByLogin> tag attributes.', |
||
454 | false |
||
455 | ); |
||
456 | } |
||
457 | |||
458 | /** |
||
459 | * @depends testLoadRootResource |
||
460 | */ |
||
461 | public function testResultContainsRolesTag($result) |
||
462 | { |
||
463 | $this->assertXMLTag( |
||
464 | array( |
||
465 | 'tag' => 'roles', |
||
466 | ), |
||
467 | $result, |
||
468 | 'Invalid <contentTypes> tag.', |
||
469 | false |
||
470 | ); |
||
471 | } |
||
472 | |||
473 | /** |
||
474 | * @depends testLoadRootResource |
||
475 | */ |
||
476 | public function testResultContainsRolesTagAttributes($result) |
||
477 | { |
||
478 | $this->assertXMLTag( |
||
479 | array( |
||
480 | 'tag' => 'roles', |
||
481 | 'attributes' => array( |
||
482 | 'media-type' => 'application/vnd.ez.api.RoleList+xml', |
||
483 | 'href' => '/api/ezp/v2/user/roles', |
||
484 | ), |
||
485 | ), |
||
486 | $result, |
||
487 | 'Invalid <roles> tag attributes.', |
||
488 | false |
||
489 | ); |
||
490 | } |
||
491 | |||
492 | /** |
||
493 | * @depends testLoadRootResource |
||
494 | */ |
||
495 | public function testResultContainsRootLocationTag($result) |
||
496 | { |
||
497 | $this->assertXMLTag( |
||
498 | array( |
||
499 | 'tag' => 'rootLocation', |
||
500 | ), |
||
501 | $result, |
||
502 | 'Invalid <rootLocation> tag.', |
||
503 | false |
||
504 | ); |
||
505 | } |
||
506 | |||
507 | /** |
||
508 | * @depends testLoadRootResource |
||
509 | */ |
||
510 | public function testResultContainsRootLocationTagAttributes($result) |
||
511 | { |
||
512 | $this->assertXMLTag( |
||
513 | array( |
||
514 | 'tag' => 'rootLocation', |
||
515 | 'attributes' => array( |
||
516 | 'media-type' => 'application/vnd.ez.api.Location+xml', |
||
517 | 'href' => '/api/ezp/v2/content/locations/1/2', |
||
518 | ), |
||
519 | ), |
||
520 | $result, |
||
521 | 'Invalid <rootLocation> tag attributes.', |
||
522 | false |
||
523 | ); |
||
524 | } |
||
525 | |||
526 | /** |
||
527 | * @depends testLoadRootResource |
||
528 | */ |
||
529 | public function testResultContainsRootUserGroupTag($result) |
||
530 | { |
||
531 | $this->assertXMLTag( |
||
532 | array( |
||
533 | 'tag' => 'rootUserGroup', |
||
534 | ), |
||
535 | $result, |
||
536 | 'Invalid <rootUserGroup> tag.', |
||
537 | false |
||
538 | ); |
||
539 | } |
||
540 | |||
541 | /** |
||
542 | * @depends testLoadRootResource |
||
543 | */ |
||
544 | public function testResultContainsRootUserGroupTagAttributes($result) |
||
545 | { |
||
546 | $this->assertXMLTag( |
||
547 | array( |
||
548 | 'tag' => 'rootUserGroup', |
||
549 | 'attributes' => array( |
||
550 | 'media-type' => 'application/vnd.ez.api.UserGroup+xml', |
||
551 | 'href' => '/api/ezp/v2/user/groups/1/5', |
||
552 | ), |
||
553 | ), |
||
554 | $result, |
||
555 | 'Invalid <rootUserGroup> tag attributes.', |
||
556 | false |
||
557 | ); |
||
558 | } |
||
559 | |||
560 | /** |
||
561 | * @depends testLoadRootResource |
||
562 | */ |
||
563 | public function testResultContainsRootMediaFolderTag($result) |
||
564 | { |
||
565 | $this->assertXMLTag( |
||
566 | array( |
||
567 | 'tag' => 'rootMediaFolder', |
||
568 | ), |
||
569 | $result, |
||
570 | 'Invalid <rootMediaFolder> tag.', |
||
571 | false |
||
572 | ); |
||
573 | } |
||
574 | |||
575 | /** |
||
576 | * @depends testLoadRootResource |
||
577 | */ |
||
578 | public function testResultContainsRootMediaFolderTagAttributes($result) |
||
579 | { |
||
580 | $this->assertXMLTag( |
||
581 | array( |
||
582 | 'tag' => 'rootMediaFolder', |
||
583 | 'attributes' => array( |
||
584 | 'media-type' => 'application/vnd.ez.api.Location+xml', |
||
585 | 'href' => '/api/ezp/v2/content/locations/1/43', |
||
586 | ), |
||
587 | ), |
||
588 | $result, |
||
589 | 'Invalid <rootMediaFolder> tag attributes.', |
||
590 | false |
||
591 | ); |
||
592 | } |
||
593 | |||
594 | /** |
||
595 | * @depends testLoadRootResource |
||
596 | */ |
||
597 | public function testResultContainsLocationByRemoteIdTag($result) |
||
598 | { |
||
599 | $this->assertXMLTag( |
||
600 | array( |
||
601 | 'tag' => 'locationByRemoteId', |
||
602 | ), |
||
603 | $result, |
||
604 | 'Missing <locationByRemoteId> tag.', |
||
605 | false |
||
606 | ); |
||
607 | } |
||
608 | |||
609 | /** |
||
610 | * @depends testLoadRootResource |
||
611 | */ |
||
612 | public function testResultContainsLocationByRemoteIdTagAttributes($result) |
||
613 | { |
||
614 | $this->assertXMLTag( |
||
615 | array( |
||
616 | 'tag' => 'locationByRemoteId', |
||
617 | 'attributes' => array( |
||
618 | 'media-type' => '', |
||
619 | 'href' => '/api/ezp/v2/content/locations{?remoteId}', |
||
620 | ), |
||
621 | ), |
||
622 | $result, |
||
623 | 'Invalid <locationByRemoteId> tag attributes.', |
||
624 | false |
||
625 | ); |
||
626 | } |
||
627 | |||
628 | /** |
||
629 | * @depends testLoadRootResource |
||
630 | */ |
||
631 | public function testResultContainsLocationByPathTag($result) |
||
632 | { |
||
633 | $this->assertXMLTag( |
||
634 | array( |
||
635 | 'tag' => 'locationByPath', |
||
636 | ), |
||
637 | $result, |
||
638 | 'Missing <locationByPath> tag.', |
||
639 | false |
||
640 | ); |
||
641 | } |
||
642 | |||
643 | /** |
||
644 | * @depends testLoadRootResource |
||
645 | */ |
||
646 | public function testResultContainsLocationByPathTagAttributes($result) |
||
647 | { |
||
648 | $this->assertXMLTag( |
||
649 | array( |
||
650 | 'tag' => 'locationByPath', |
||
651 | 'attributes' => array( |
||
652 | 'media-type' => '', |
||
653 | 'href' => '/api/ezp/v2/content/locations{?locationPath}', |
||
654 | ), |
||
655 | ), |
||
656 | $result, |
||
657 | 'Invalid <locationByPath> tag attributes.', |
||
658 | false |
||
659 | ); |
||
660 | } |
||
661 | |||
662 | /** |
||
663 | * @depends testLoadRootResource |
||
664 | */ |
||
665 | public function testResultContainsTrashTag($result) |
||
666 | { |
||
667 | $this->assertXMLTag( |
||
668 | array( |
||
669 | 'tag' => 'trash', |
||
670 | ), |
||
671 | $result, |
||
672 | 'Invalid <trash> tag.', |
||
673 | false |
||
674 | ); |
||
675 | } |
||
676 | |||
677 | /** |
||
678 | * @depends testLoadRootResource |
||
679 | */ |
||
680 | public function testResultContainsTrashTagAttributes($result) |
||
681 | { |
||
682 | $this->assertXMLTag( |
||
683 | array( |
||
684 | 'tag' => 'trash', |
||
685 | 'attributes' => array( |
||
686 | 'media-type' => 'application/vnd.ez.api.Trash+xml', |
||
687 | 'href' => '/api/ezp/v2/content/trash', |
||
688 | ), |
||
689 | ), |
||
690 | $result, |
||
691 | 'Invalid <trash> tag attributes.', |
||
692 | false |
||
693 | ); |
||
694 | } |
||
695 | |||
696 | /** |
||
697 | * @depends testLoadRootResource |
||
698 | */ |
||
699 | public function testResultContainsSectionsTag($result) |
||
700 | { |
||
701 | $this->assertXMLTag( |
||
702 | array( |
||
703 | 'tag' => 'sections', |
||
704 | ), |
||
705 | $result, |
||
706 | 'Invalid <sections> tag.', |
||
707 | false |
||
708 | ); |
||
709 | } |
||
710 | |||
711 | /** |
||
712 | * @depends testLoadRootResource |
||
713 | */ |
||
714 | public function testResultContainsSectionTagAttributes($result) |
||
715 | { |
||
716 | $this->assertXMLTag( |
||
717 | array( |
||
718 | 'tag' => 'sections', |
||
719 | 'attributes' => array( |
||
720 | 'media-type' => 'application/vnd.ez.api.SectionList+xml', |
||
721 | 'href' => '/api/ezp/v2/content/sections', |
||
722 | ), |
||
723 | ), |
||
724 | $result, |
||
725 | 'Invalid <sections> tag attributes.', |
||
726 | false |
||
727 | ); |
||
728 | } |
||
729 | |||
730 | /** |
||
731 | * @depends testLoadRootResource |
||
732 | */ |
||
733 | public function testResultContainsViewsTag($result) |
||
734 | { |
||
735 | $this->assertXMLTag( |
||
736 | array( |
||
737 | 'tag' => 'views', |
||
738 | ), |
||
739 | $result, |
||
740 | 'Invalid <views> tag.', |
||
741 | false |
||
742 | ); |
||
743 | } |
||
744 | |||
745 | /** |
||
746 | * @depends testLoadRootResource |
||
747 | */ |
||
748 | public function testResultContainsViewsTagAttributes($result) |
||
749 | { |
||
750 | $this->assertXMLTag( |
||
751 | array( |
||
752 | 'tag' => 'views', |
||
753 | 'attributes' => array( |
||
754 | 'media-type' => 'application/vnd.ez.api.RefList+xml', |
||
755 | 'href' => '/api/ezp/v2/views', |
||
756 | ), |
||
757 | ), |
||
758 | $result, |
||
759 | 'Invalid <views> tag attributes.', |
||
760 | false |
||
761 | ); |
||
762 | } |
||
763 | |||
764 | /** |
||
765 | * @depends testLoadRootResource |
||
766 | */ |
||
767 | public function testResultContainsObjectStateGroupsTag($result) |
||
768 | { |
||
769 | $this->assertXMLTag( |
||
770 | array( |
||
771 | 'tag' => 'objectStateGroups', |
||
772 | ), |
||
773 | $result, |
||
774 | 'Missing <objectStateGroups> tag.', |
||
775 | false |
||
776 | ); |
||
777 | } |
||
778 | |||
779 | /** |
||
780 | * @depends testLoadRootResource |
||
781 | */ |
||
782 | public function testResultContainsObjectStateGroupsTagAttributes($result) |
||
783 | { |
||
784 | $this->assertXMLTag( |
||
785 | array( |
||
786 | 'tag' => 'objectStateGroups', |
||
787 | 'attributes' => array( |
||
788 | 'media-type' => 'application/vnd.ez.api.ObjectStateGroupList+xml', |
||
789 | 'href' => '/api/ezp/v2/content/objectstategroups', |
||
790 | ), |
||
791 | ), |
||
792 | $result, |
||
793 | 'Invalid <objectStateGroups> tag attributes.', |
||
794 | false |
||
795 | ); |
||
796 | } |
||
797 | |||
798 | /** |
||
799 | * @depends testLoadRootResource |
||
800 | */ |
||
801 | public function testResultContainsObjectStatesTag($result) |
||
802 | { |
||
803 | $this->assertXMLTag( |
||
804 | array( |
||
805 | 'tag' => 'objectStates', |
||
806 | ), |
||
807 | $result, |
||
808 | 'Missing <objectStates> tag.', |
||
809 | false |
||
810 | ); |
||
811 | } |
||
812 | |||
813 | /** |
||
814 | * @depends testLoadRootResource |
||
815 | */ |
||
816 | public function testResultContainsObjectStatesTagAttributes($result) |
||
817 | { |
||
818 | $this->assertXMLTag( |
||
819 | array( |
||
820 | 'tag' => 'objectStates', |
||
821 | 'attributes' => array( |
||
822 | 'media-type' => 'application/vnd.ez.api.ObjectStateList+xml', |
||
823 | 'href' => '/api/ezp/v2/content/objectstategroups/{objectStateGroupId}/objectstates', |
||
824 | ), |
||
825 | ), |
||
826 | $result, |
||
827 | 'Invalid <objectStates> tag attributes.', |
||
828 | false |
||
829 | ); |
||
830 | } |
||
831 | |||
832 | /** |
||
833 | * @depends testLoadRootResource |
||
834 | */ |
||
835 | public function testResultContainsGlobalUrlAliasesTag($result) |
||
836 | { |
||
837 | $this->assertXMLTag( |
||
838 | array( |
||
839 | 'tag' => 'globalUrlAliases', |
||
840 | ), |
||
841 | $result, |
||
842 | 'Missing <globalUrlAliases> tag.', |
||
843 | false |
||
844 | ); |
||
845 | } |
||
846 | |||
847 | /** |
||
848 | * @depends testLoadRootResource |
||
849 | */ |
||
850 | public function testResultContainsGlobalUrlAliasesTagAttributes($result) |
||
851 | { |
||
852 | $this->assertXMLTag( |
||
853 | array( |
||
854 | 'tag' => 'globalUrlAliases', |
||
855 | 'attributes' => array( |
||
856 | 'media-type' => 'application/vnd.ez.api.UrlAliasRefList+xml', |
||
857 | 'href' => '/api/ezp/v2/content/urlaliases', |
||
858 | ), |
||
859 | ), |
||
860 | $result, |
||
861 | 'Invalid <globalUrlAliases> tag attributes.', |
||
862 | false |
||
863 | ); |
||
864 | } |
||
865 | |||
866 | /** |
||
867 | * @depends testLoadRootResource |
||
868 | */ |
||
869 | public function testResultContainsUrlWildcardsTag($result) |
||
870 | { |
||
871 | $this->assertXMLTag( |
||
872 | array( |
||
873 | 'tag' => 'urlWildcards', |
||
874 | ), |
||
875 | $result, |
||
876 | 'Missing <urlWildcards> tag.', |
||
877 | false |
||
878 | ); |
||
879 | } |
||
880 | |||
881 | /** |
||
882 | * @depends testLoadRootResource |
||
883 | */ |
||
884 | public function testResultContainsUrlWildcardsTagAttributes($result) |
||
885 | { |
||
886 | $this->assertXMLTag( |
||
887 | array( |
||
888 | 'tag' => 'urlWildcards', |
||
889 | 'attributes' => array( |
||
890 | 'media-type' => 'application/vnd.ez.api.UrlWildcardList+xml', |
||
891 | 'href' => '/api/ezp/v2/content/urlwildcards', |
||
892 | ), |
||
893 | ), |
||
894 | $result, |
||
895 | 'Invalid <globalUrlAliases> tag attributes.', |
||
896 | false |
||
897 | ); |
||
898 | } |
||
899 | |||
900 | /** |
||
901 | * @depends testLoadRootResource |
||
902 | */ |
||
903 | public function testResultContainsCreateSessionTag($result) |
||
904 | { |
||
905 | $this->assertXMLTag( |
||
906 | array( |
||
907 | 'tag' => 'createSession', |
||
908 | ), |
||
909 | $result, |
||
910 | 'Missing <createSession> tag.', |
||
911 | false |
||
912 | ); |
||
913 | } |
||
914 | |||
915 | /** |
||
916 | * @depends testLoadRootResource |
||
917 | */ |
||
918 | public function testResultContainsCreateSessionTagAttributes($result) |
||
919 | { |
||
920 | $this->assertXMLTag( |
||
921 | array( |
||
922 | 'tag' => 'createSession', |
||
923 | 'attributes' => array( |
||
924 | 'media-type' => 'application/vnd.ez.api.UserSession+xml', |
||
925 | 'href' => '/api/ezp/v2/user/sessions', |
||
926 | ), |
||
927 | ), |
||
928 | $result, |
||
929 | 'Invalid <createSession> tag attributes.', |
||
930 | false |
||
931 | ); |
||
932 | } |
||
933 | |||
934 | /** |
||
935 | * @depends testLoadRootResource |
||
936 | */ |
||
937 | public function testResultContainsRefreshSessionTag($result) |
||
938 | { |
||
939 | $this->assertXMLTag( |
||
940 | array( |
||
941 | 'tag' => 'refreshSession', |
||
942 | ), |
||
943 | $result, |
||
944 | 'Missing <refreshSession> tag.', |
||
945 | false |
||
946 | ); |
||
947 | } |
||
948 | |||
949 | /** |
||
950 | * @depends testLoadRootResource |
||
951 | */ |
||
952 | public function testResultContainsRefreshSessionTagAttributes($result) |
||
953 | { |
||
954 | $this->assertXMLTag( |
||
955 | array( |
||
956 | 'tag' => 'refreshSession', |
||
957 | 'attributes' => array( |
||
958 | 'media-type' => 'application/vnd.ez.api.UserSession+xml', |
||
959 | 'href' => '/api/ezp/v2/user/sessions/{sessionId}/refresh', |
||
960 | ), |
||
961 | ), |
||
962 | $result, |
||
963 | 'Invalid <refreshSession> tag attributes.', |
||
964 | false |
||
965 | ); |
||
966 | } |
||
967 | |||
968 | public function getRandomUriSet() |
||
976 | } |
||
977 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.