Completed
Push — signal_search_issues ( 5556b2...f328ba )
by André
63:06 queued 07:22
created

RootTest   B

Complexity

Total Complexity 46

Size/Duplication

Total Lines 855
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 5

Importance

Changes 0
Metric Value
dl 0
loc 855
rs 8
c 0
b 0
f 0
wmc 46
lcom 2
cbo 5

46 Methods

Rating   Name   Duplication   Size   Complexity  
B testVisit() 0 88 1
A testResultContainsRootElement() 0 9 1
A testResultContainsRootAttributes() 0 14 1
A testResultContainsContentTag() 0 11 1
A testResultContainsContentTagAttributes() 0 15 1
A testResultContainsContentByRemoteIdTag() 0 11 1
A testResultContainsContentByRemoteIdTagAttributes() 0 15 1
A testResultContainsContentTypesTag() 0 11 1
A testResultContainsContentTypesTagAttributes() 0 15 1
A testResultContainsContentTypeByIdentifierTag() 0 11 1
A testResultContainsContentTypeByIdentifierTagAttributes() 0 15 1
A testResultContainsContentTypeGroupsTag() 0 11 1
A testResultContainsContentTypeGroupsTagAttributes() 0 15 1
A testResultContainsContentTypeGroupByIdentifierTag() 0 11 1
A testResultContainsContentTypeGroupByIdentifierTagAttributes() 0 15 1
A testResultContainsUsersTag() 0 11 1
A testResultContainsUsersTagAttributes() 0 15 1
A testResultContainsRolesTag() 0 11 1
A testResultContainsRolesTagAttributes() 0 15 1
A testResultContainsRootLocationTag() 0 11 1
A testResultContainsRootLocationTagAttributes() 0 15 1
A testResultContainsRootUserGroupTag() 0 11 1
A testResultContainsRootUserGroupTagAttributes() 0 15 1
A testResultContainsRootMediaFolderTag() 0 11 1
A testResultContainsRootMediaFolderTagAttributes() 0 15 1
A testResultContainsLocationByRemoteIdTag() 0 11 1
A testResultContainsLocationByRemoteIdTagAttributes() 0 15 1
A testResultContainsLocationByPathTag() 0 11 1
A testResultContainsLocationByPathTagAttributes() 0 15 1
A testResultContainsTrashTag() 0 11 1
A testResultContainsTrashTagAttributes() 0 15 1
A testResultContainsSectionsTag() 0 11 1
A testResultContainsSectionTagAttributes() 0 15 1
A testResultContainsViewsTag() 0 11 1
A testResultContainsViewsTagAttributes() 0 15 1
A testResultContainsObjectStateGroupsTag() 0 11 1
A testResultContainsObjectStateGroupsTagAttributes() 0 15 1
A testResultContainsObjectStatesTag() 0 11 1
A testResultContainsObjectStatesTagAttributes() 0 15 1
A testResultContainsGlobalUrlAliasesTag() 0 11 1
A testResultContainsGlobalUrlAliasesTagAttributes() 0 15 1
A testResultContainsUrlWildcardsTag() 0 11 1
A testResultContainsUrlWildcardsTagAttributes() 0 15 1
A testResultContainsCreateSessionTag() 0 11 1
A testResultContainsCreateSessionTagAttributes() 0 15 1
A internalGetVisitor() 0 4 1

How to fix   Complexity   

Complex Class

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
2
3
/**
4
 * File containing a test class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 *
9
 * @version //autogentag//
10
 */
11
namespace eZ\Publish\Core\REST\Server\Tests\Output\ValueObjectVisitor;
12
13
use eZ\Publish\Core\REST\Common\Tests\Output\ValueObjectVisitorBaseTest;
14
use eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor;
15
use eZ\Publish\Core\REST\Common\Values\Root;
16
17
class RootTest extends ValueObjectVisitorBaseTest
18
{
19
    /**
20
     * Test the Role visitor.
21
     *
22
     * @return string
23
     */
24
    public function testVisit()
25
    {
26
        $visitor = $this->getVisitor();
27
        $generator = $this->getGenerator();
28
29
        $generator->startDocument(null);
30
31
        $role = new Root();
32
33
        $this->addRouteExpectation(
34
            'ezpublish_rest_createContent',
35
            array(),
36
            '/content/objects'
37
        );
38
        $this->addTemplatedRouteExpectation(
39
            'ezpublish_rest_redirectContent',
40
            array('remoteId' => '{remoteId}'),
41
            '/content/objects'
42
        );
43
        $this->addRouteExpectation('ezpublish_rest_listContentTypes', array(), '/content/types');
44
        $this->addTemplatedRouteExpectation(
45
            'ezpublish_rest_listContentTypes',
46
            array('identifier' => '{identifier}'),
47
            '/content/types?{&identifier}'
48
        );
49
        $this->addRouteExpectation('ezpublish_rest_createContentTypeGroup', array(), '/content/typegroups');
50
        $this->addTemplatedRouteExpectation(
51
            'ezpublish_rest_loadContentTypeGroupList',
52
            array('identifier' => '{identifier}'),
53
            '/content/typegroups?{&identifier}'
54
        );
55
        $this->addRouteExpectation('ezpublish_rest_loadUsers', array(), '/user/users');
56
        $this->addTemplatedRouteExpectation('ezpublish_rest_loadUsers', array('roleId' => '{roleId}'), '/user/users{?roleId}');
57
        $this->addTemplatedRouteExpectation('ezpublish_rest_loadUsers', array('remoteId' => '{remoteId}'), '/user/users{?remoteId}');
58
        $this->addTemplatedRouteExpectation('ezpublish_rest_loadUsers', array('email' => '{email}'), '/user/users{?email}');
59
        $this->addTemplatedRouteExpectation('ezpublish_rest_loadUsers', array('login' => '{login}'), '/user/users{?login}');
60
61
        $this->addRouteExpectation('ezpublish_rest_listRoles', array(), '/user/roles');
62
        $this->addRouteExpectation(
63
            'ezpublish_rest_loadLocation',
64
            array('locationPath' => '1/2'),
65
            '/content/locations/1/2'
66
        );
67
        $this->addRouteExpectation(
68
            'ezpublish_rest_loadUserGroup',
69
            array('groupPath' => '1/5'),
70
            '/user/groups/1/5'
71
        );
72
        $this->addRouteExpectation(
73
            'ezpublish_rest_loadLocation',
74
            array('locationPath' => '1/43'),
75
            '/content/locations/1/43'
76
        );
77
        $this->addTemplatedRouteExpectation(
78
            'ezpublish_rest_redirectLocation',
79
            array('remoteId' => '{remoteId}'),
80
            '/content/locations?{&remoteId}'
81
        );
82
        $this->addTemplatedRouteExpectation(
83
            'ezpublish_rest_redirectLocation',
84
            array('locationPath' => '{locationPath}'),
85
            '/content/locations?{&locationPath}'
86
        );
87
        $this->addRouteExpectation('ezpublish_rest_loadTrashItems', array(), '/content/trash');
88
        $this->addRouteExpectation('ezpublish_rest_listSections', array(), '/content/sections');
89
        $this->addRouteExpectation('ezpublish_rest_views_create', array(), '/views');
90
        $this->addRouteExpectation('ezpublish_rest_loadObjectStateGroups', array(), '/content/objectstategroups');
91
        $this->addTemplatedRouteExpectation(
92
            'ezpublish_rest_loadObjectStates',
93
            array('objectStateGroupId' => '{objectStateGroupId}'),
94
            '/content/objectstategroups/{objectStateGroupId}/objectstates'
95
        );
96
        $this->addRouteExpectation('ezpublish_rest_listGlobalURLAliases', array(), '/content/urlaliases');
97
        $this->addRouteExpectation('ezpublish_rest_listURLWildcards', array(), '/content/urlwildcards');
98
        $this->addRouteExpectation('ezpublish_rest_createSession', array(), '/user/sessions');
99
100
        $visitor->visit(
101
            $this->getVisitorMock(),
0 ignored issues
show
Bug introduced by
It seems like $this->getVisitorMock() targeting eZ\Publish\Core\REST\Com...eTest::getVisitorMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, eZ\Publish\Core\REST\Com...eObjectVisitor::visit() does only seem to accept object<eZ\Publish\Core\R...\Common\Output\Visitor>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
102
            $generator,
103
            $role
104
        );
105
106
        $result = $generator->endDocument(null);
107
108
        $this->assertNotNull($result);
109
110
        return $result;
111
    }
112
113
    /**
114
     * @depends testVisit
115
     */
116
    public function testResultContainsRootElement($result)
117
    {
118
        $this->assertXMLTag(
119
            array('tag' => 'Root'),
120
            $result,
121
            'Invalid <Root> element.',
122
            false
123
        );
124
    }
125
126
    /**
127
     * Test if result contains Role element attributes.
128
     *
129
     * @param string $result
130
     *
131
     * @depends testVisit
132
     */
133
    public function testResultContainsRootAttributes($result)
134
    {
135
        $this->assertXMLTag(
136
            array(
137
                'tag' => 'Root',
138
                'attributes' => array(
139
                    'media-type' => 'application/vnd.ez.api.Root+xml',
140
                ),
141
            ),
142
            $result,
143
            'Invalid <Root> attributes.',
144
            false
145
        );
146
    }
147
148
    /**
149
     * @depends testVisit
150
     */
151
    public function testResultContainsContentTag($result)
152
    {
153
        $this->assertXMLTag(
154
            array(
155
                'tag' => 'content',
156
            ),
157
            $result,
158
            'Invalid <content> element.',
159
            false
160
        );
161
    }
162
163
    /**
164
     * @depends testVisit
165
     */
166
    public function testResultContainsContentTagAttributes($result)
167
    {
168
        $this->assertXMLTag(
169
            array(
170
                'tag' => 'content',
171
                'attributes' => array(
172
                    'media-type' => '',
173
                    'href' => '/content/objects',
174
                ),
175
            ),
176
            $result,
177
            'Invalid <content> element.',
178
            false
179
        );
180
    }
181
182
    /**
183
     * @depends testVisit
184
     */
185
    public function testResultContainsContentByRemoteIdTag($result)
186
    {
187
        $this->assertXMLTag(
188
            array(
189
                'tag' => 'contentByRemoteId',
190
            ),
191
            $result,
192
            'Missing <contentByRemoteId> element.',
193
            false
194
        );
195
    }
196
197
    /**
198
     * @depends testVisit
199
     */
200
    public function testResultContainsContentByRemoteIdTagAttributes($result)
201
    {
202
        $this->assertXMLTag(
203
            array(
204
                'tag' => 'contentByRemoteId',
205
                'attributes' => array(
206
                    'media-type' => '',
207
                    'href' => '/content/objects',
208
                ),
209
            ),
210
            $result,
211
            'Invalid <contentByRemoteId> tag attributes.',
212
            false
213
        );
214
    }
215
216
    /**
217
     * @depends testVisit
218
     */
219
    public function testResultContainsContentTypesTag($result)
220
    {
221
        $this->assertXMLTag(
222
            array(
223
                'tag' => 'contentTypes',
224
            ),
225
            $result,
226
            'Invalid <contentTypes> element.',
227
            false
228
        );
229
    }
230
231
    /**
232
     * @depends testVisit
233
     */
234
    public function testResultContainsContentTypesTagAttributes($result)
235
    {
236
        $this->assertXMLTag(
237
            array(
238
                'tag' => 'contentTypes',
239
                'attributes' => array(
240
                    'media-type' => 'application/vnd.ez.api.ContentTypeInfoList+xml',
241
                    'href' => '/content/types',
242
                ),
243
            ),
244
            $result,
245
            'Invalid <content> element.',
246
            false
247
        );
248
    }
249
250
    /**
251
     * @depends testVisit
252
     */
253
    public function testResultContainsContentTypeByIdentifierTag($result)
254
    {
255
        $this->assertXMLTag(
256
            array(
257
                'tag' => 'contentTypeByIdentifier',
258
            ),
259
            $result,
260
            'Invalid <contentTypeByIdentifier> element.',
261
            false
262
        );
263
    }
264
265
    /**
266
     * @depends testVisit
267
     */
268
    public function testResultContainsContentTypeByIdentifierTagAttributes($result)
269
    {
270
        $this->assertXMLTag(
271
            array(
272
                'tag' => 'contentTypeByIdentifier',
273
                'attributes' => array(
274
                    'media-type' => '',
275
                    'href' => '/content/types?{&identifier}',
276
                ),
277
            ),
278
            $result,
279
            'Invalid <contentTypeByIdentifier> tag attributes.',
280
            false
281
        );
282
    }
283
284
    /**
285
     * @depends testVisit
286
     */
287
    public function testResultContainsContentTypeGroupsTag($result)
288
    {
289
        $this->assertXMLTag(
290
            array(
291
                'tag' => 'contentTypeGroups',
292
            ),
293
            $result,
294
            'Missing <contentTypeGroups> element.',
295
            false
296
        );
297
    }
298
299
    /**
300
     * @depends testVisit
301
     */
302
    public function testResultContainsContentTypeGroupsTagAttributes($result)
303
    {
304
        $this->assertXMLTag(
305
            array(
306
                'tag' => 'contentTypeGroups',
307
                'attributes' => array(
308
                    'media-type' => 'application/vnd.ez.api.ContentTypeGroupList+xml',
309
                    'href' => '/content/typegroups',
310
                ),
311
            ),
312
            $result,
313
            'Invalid <contentTypeGroups> tag attributes.',
314
            false
315
        );
316
    }
317
318
    /**
319
     * @depends testVisit
320
     */
321
    public function testResultContainsContentTypeGroupByIdentifierTag($result)
322
    {
323
        $this->assertXMLTag(
324
            array(
325
                'tag' => 'contentTypeGroupByIdentifier',
326
            ),
327
            $result,
328
            'Missing <ContentTypeGroupByIdentifier> element.',
329
            false
330
        );
331
    }
332
333
    /**
334
     * @depends testVisit
335
     */
336
    public function testResultContainsContentTypeGroupByIdentifierTagAttributes($result)
337
    {
338
        $this->assertXMLTag(
339
            array(
340
                'tag' => 'contentTypeGroupByIdentifier',
341
                'attributes' => array(
342
                    'media-type' => '',
343
                    'href' => '/content/typegroups?{&identifier}',
344
                ),
345
            ),
346
            $result,
347
            'Invalid <contentTypeGroupByIdentifier> tag attributes.',
348
            false
349
        );
350
    }
351
352
    /**
353
     * @depends testVisit
354
     */
355
    public function testResultContainsUsersTag($result)
356
    {
357
        $this->assertXMLTag(
358
            array(
359
                'tag' => 'users',
360
            ),
361
            $result,
362
            'Invalid <users> tag.',
363
            false
364
        );
365
    }
366
367
    /**
368
     * @depends testVisit
369
     */
370
    public function testResultContainsUsersTagAttributes($result)
371
    {
372
        $this->assertXMLTag(
373
            array(
374
                'tag' => 'users',
375
                'attributes' => array(
376
                    'media-type' => 'application/vnd.ez.api.UserRefList+xml',
377
                    'href' => '/user/users',
378
                ),
379
            ),
380
            $result,
381
            'Invalid <users> tag attributes.',
382
            false
383
        );
384
    }
385
386
    /**
387
     * @depends testVisit
388
     */
389
    public function testResultContainsRolesTag($result)
390
    {
391
        $this->assertXMLTag(
392
            array(
393
                'tag' => 'roles',
394
            ),
395
            $result,
396
            'Invalid <contentTypes> tag.',
397
            false
398
        );
399
    }
400
401
    /**
402
     * @depends testVisit
403
     */
404
    public function testResultContainsRolesTagAttributes($result)
405
    {
406
        $this->assertXMLTag(
407
            array(
408
                'tag' => 'roles',
409
                'attributes' => array(
410
                    'media-type' => 'application/vnd.ez.api.RoleList+xml',
411
                    'href' => '/user/roles',
412
                ),
413
            ),
414
            $result,
415
            'Invalid <roles> tag attributes.',
416
            false
417
        );
418
    }
419
420
    /**
421
     * @depends testVisit
422
     */
423
    public function testResultContainsRootLocationTag($result)
424
    {
425
        $this->assertXMLTag(
426
            array(
427
                'tag' => 'rootLocation',
428
            ),
429
            $result,
430
            'Invalid <rootLocation> tag.',
431
            false
432
        );
433
    }
434
435
    /**
436
     * @depends testVisit
437
     */
438
    public function testResultContainsRootLocationTagAttributes($result)
439
    {
440
        $this->assertXMLTag(
441
            array(
442
                'tag' => 'rootLocation',
443
                'attributes' => array(
444
                    'media-type' => 'application/vnd.ez.api.Location+xml',
445
                    'href' => '/content/locations/1/2',
446
                ),
447
            ),
448
            $result,
449
            'Invalid <rootLocation> tag attributes.',
450
            false
451
        );
452
    }
453
454
    /**
455
     * @depends testVisit
456
     */
457
    public function testResultContainsRootUserGroupTag($result)
458
    {
459
        $this->assertXMLTag(
460
            array(
461
                'tag' => 'rootUserGroup',
462
            ),
463
            $result,
464
            'Invalid <rootUserGroup> tag.',
465
            false
466
        );
467
    }
468
469
    /**
470
     * @depends testVisit
471
     */
472
    public function testResultContainsRootUserGroupTagAttributes($result)
473
    {
474
        $this->assertXMLTag(
475
            array(
476
                'tag' => 'rootUserGroup',
477
                'attributes' => array(
478
                    'media-type' => 'application/vnd.ez.api.UserGroup+xml',
479
                    'href' => '/user/groups/1/5',
480
                ),
481
            ),
482
            $result,
483
            'Invalid <rootUserGroup> tag attributes.',
484
            false
485
        );
486
    }
487
488
    /**
489
     * @depends testVisit
490
     */
491
    public function testResultContainsRootMediaFolderTag($result)
492
    {
493
        $this->assertXMLTag(
494
            array(
495
                'tag' => 'rootMediaFolder',
496
            ),
497
            $result,
498
            'Invalid <rootMediaFolder> tag.',
499
            false
500
        );
501
    }
502
503
    /**
504
     * @depends testVisit
505
     */
506
    public function testResultContainsRootMediaFolderTagAttributes($result)
507
    {
508
        $this->assertXMLTag(
509
            array(
510
                'tag' => 'rootMediaFolder',
511
                'attributes' => array(
512
                    'media-type' => 'application/vnd.ez.api.Location+xml',
513
                    'href' => '/content/locations/1/43',
514
                ),
515
            ),
516
            $result,
517
            'Invalid <rootMediaFolder> tag attributes.',
518
            false
519
        );
520
    }
521
522
    /**
523
     * @depends testVisit
524
     */
525
    public function testResultContainsLocationByRemoteIdTag($result)
526
    {
527
        $this->assertXMLTag(
528
            array(
529
                'tag' => 'locationByRemoteId',
530
            ),
531
            $result,
532
            'Missing <locationByRemoteId> tag.',
533
            false
534
        );
535
    }
536
537
    /**
538
     * @depends testVisit
539
     */
540
    public function testResultContainsLocationByRemoteIdTagAttributes($result)
541
    {
542
        $this->assertXMLTag(
543
            array(
544
                'tag' => 'locationByRemoteId',
545
                'attributes' => array(
546
                    'media-type' => '',
547
                    'href' => '/content/locations?{&remoteId}',
548
                ),
549
            ),
550
            $result,
551
            'Invalid <locationByRemoteId> tag attributes.',
552
            false
553
        );
554
    }
555
556
    /**
557
     * @depends testVisit
558
     */
559
    public function testResultContainsLocationByPathTag($result)
560
    {
561
        $this->assertXMLTag(
562
            array(
563
                'tag' => 'locationByPath',
564
            ),
565
            $result,
566
            'Missing <locationByPath> tag.',
567
            false
568
        );
569
    }
570
571
    /**
572
     * @depends testVisit
573
     */
574
    public function testResultContainsLocationByPathTagAttributes($result)
575
    {
576
        $this->assertXMLTag(
577
            array(
578
                'tag' => 'locationByPath',
579
                'attributes' => array(
580
                    'media-type' => '',
581
                    'href' => '/content/locations?{&locationPath}',
582
                ),
583
            ),
584
            $result,
585
            'Invalid <locationByPath> tag attributes.',
586
            false
587
        );
588
    }
589
590
    /**
591
     * @depends testVisit
592
     */
593
    public function testResultContainsTrashTag($result)
594
    {
595
        $this->assertXMLTag(
596
            array(
597
                'tag' => 'trash',
598
            ),
599
            $result,
600
            'Invalid <trash> tag.',
601
            false
602
        );
603
    }
604
605
    /**
606
     * @depends testVisit
607
     */
608
    public function testResultContainsTrashTagAttributes($result)
609
    {
610
        $this->assertXMLTag(
611
            array(
612
                'tag' => 'trash',
613
                'attributes' => array(
614
                    'media-type' => 'application/vnd.ez.api.Trash+xml',
615
                    'href' => '/content/trash',
616
                ),
617
            ),
618
            $result,
619
            'Invalid <trash> tag attributes.',
620
            false
621
        );
622
    }
623
624
    /**
625
     * @depends testVisit
626
     */
627
    public function testResultContainsSectionsTag($result)
628
    {
629
        $this->assertXMLTag(
630
            array(
631
                'tag' => 'sections',
632
            ),
633
            $result,
634
            'Invalid <sections> tag.',
635
            false
636
        );
637
    }
638
639
    /**
640
     * @depends testVisit
641
     */
642
    public function testResultContainsSectionTagAttributes($result)
643
    {
644
        $this->assertXMLTag(
645
            array(
646
                'tag' => 'sections',
647
                'attributes' => array(
648
                    'media-type' => 'application/vnd.ez.api.SectionList+xml',
649
                    'href' => '/content/sections',
650
                ),
651
            ),
652
            $result,
653
            'Invalid <sections> tag attributes.',
654
            false
655
        );
656
    }
657
658
    /**
659
     * @depends testVisit
660
     */
661
    public function testResultContainsViewsTag($result)
662
    {
663
        $this->assertXMLTag(
664
            array(
665
                'tag' => 'views',
666
            ),
667
            $result,
668
            'Invalid <views> tag.',
669
            false
670
        );
671
    }
672
673
    /**
674
     * @depends testVisit
675
     */
676
    public function testResultContainsViewsTagAttributes($result)
677
    {
678
        $this->assertXMLTag(
679
            array(
680
                'tag' => 'views',
681
                'attributes' => array(
682
                    'media-type' => 'application/vnd.ez.api.RefList+xml',
683
                    'href' => '/views',
684
                ),
685
            ),
686
            $result,
687
            'Invalid <views> tag attributes.',
688
            false
689
        );
690
    }
691
692
    /**
693
     * @depends testVisit
694
     */
695
    public function testResultContainsObjectStateGroupsTag($result)
696
    {
697
        $this->assertXMLTag(
698
            array(
699
                'tag' => 'objectStateGroups',
700
            ),
701
            $result,
702
            'Missing <objectStateGroups> tag.',
703
            false
704
        );
705
    }
706
707
    /**
708
     * @depends testVisit
709
     */
710
    public function testResultContainsObjectStateGroupsTagAttributes($result)
711
    {
712
        $this->assertXMLTag(
713
            array(
714
                'tag' => 'objectStateGroups',
715
                'attributes' => array(
716
                    'media-type' => 'application/vnd.ez.api.ObjectStateGroupList+xml',
717
                    'href' => '/content/objectstategroups',
718
                ),
719
            ),
720
            $result,
721
            'Invalid <objectStateGroups> tag attributes.',
722
            false
723
        );
724
    }
725
726
    /**
727
     * @depends testVisit
728
     */
729
    public function testResultContainsObjectStatesTag($result)
730
    {
731
        $this->assertXMLTag(
732
            array(
733
                'tag' => 'objectStates',
734
            ),
735
            $result,
736
            'Missing <objectStates> tag.',
737
            false
738
        );
739
    }
740
741
    /**
742
     * @depends testVisit
743
     */
744
    public function testResultContainsObjectStatesTagAttributes($result)
745
    {
746
        $this->assertXMLTag(
747
            array(
748
                'tag' => 'objectStates',
749
                'attributes' => array(
750
                    'media-type' => 'application/vnd.ez.api.ObjectStateList+xml',
751
                    'href' => '/content/objectstategroups/{objectStateGroupId}/objectstates',
752
                ),
753
            ),
754
            $result,
755
            'Invalid <objectStates> tag attributes.',
756
            false
757
        );
758
    }
759
760
    /**
761
     * @depends testVisit
762
     */
763
    public function testResultContainsGlobalUrlAliasesTag($result)
764
    {
765
        $this->assertXMLTag(
766
            array(
767
                'tag' => 'globalUrlAliases',
768
            ),
769
            $result,
770
            'Missing <globalUrlAliases> tag.',
771
            false
772
        );
773
    }
774
775
    /**
776
     * @depends testVisit
777
     */
778
    public function testResultContainsGlobalUrlAliasesTagAttributes($result)
779
    {
780
        $this->assertXMLTag(
781
            array(
782
                'tag' => 'globalUrlAliases',
783
                'attributes' => array(
784
                    'media-type' => 'application/vnd.ez.api.UrlAliasRefList+xml',
785
                    'href' => '/content/urlaliases',
786
                ),
787
            ),
788
            $result,
789
            'Invalid <globalUrlAliases> tag attributes.',
790
            false
791
        );
792
    }
793
794
    /**
795
     * @depends testVisit
796
     */
797
    public function testResultContainsUrlWildcardsTag($result)
798
    {
799
        $this->assertXMLTag(
800
            array(
801
                'tag' => 'urlWildcards',
802
            ),
803
            $result,
804
            'Missing <urlWildcards> tag.',
805
            false
806
        );
807
    }
808
809
    /**
810
     * @depends testVisit
811
     */
812
    public function testResultContainsUrlWildcardsTagAttributes($result)
813
    {
814
        $this->assertXMLTag(
815
            array(
816
                'tag' => 'urlWildcards',
817
                'attributes' => array(
818
                    'media-type' => 'application/vnd.ez.api.UrlWildcardList+xml',
819
                    'href' => '/content/urlwildcards',
820
                ),
821
            ),
822
            $result,
823
            'Invalid <globalUrlAliases> tag attributes.',
824
            false
825
        );
826
    }
827
828
    /**
829
     * @depends testVisit
830
     */
831
    public function testResultContainsCreateSessionTag($result)
832
    {
833
        $this->assertXMLTag(
834
            array(
835
                'tag' => 'createSession',
836
            ),
837
            $result,
838
            'Missing <createSession> tag.',
839
            false
840
        );
841
    }
842
843
    /**
844
     * @depends testVisit
845
     */
846
    public function testResultContainsCreateSessionTagAttributes($result)
847
    {
848
        $this->assertXMLTag(
849
            array(
850
                'tag' => 'createSession',
851
                'attributes' => array(
852
                    'media-type' => 'application/vnd.ez.api.UserSession+xml',
853
                    'href' => '/user/sessions',
854
                ),
855
            ),
856
            $result,
857
            'Invalid <createSession> tag attributes.',
858
            false
859
        );
860
    }
861
862
    /**
863
     * Get the Role visitor.
864
     *
865
     * @return \eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\Root
866
     */
867
    protected function internalGetVisitor()
868
    {
869
        return new ValueObjectVisitor\Root();
870
    }
871
}
872