Completed
Push — ezp-30696 ( 9bb3ad...3bd812 )
by
unknown
49:02 queued 18:35
created

testResultContainsUrlWildcardsTagAttributes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 15
rs 9.7666
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * File containing the Functional\RootTest 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
namespace eZ\Bundle\EzPublishRestBundle\Tests\Functional;
10
11
use eZ\Bundle\EzPublishRestBundle\Tests\Functional\TestCase as RESTFunctionalTestCase;
12
use eZ\Publish\Core\REST\Common\Tests\AssertXmlTagTrait;
13
14
class RootTest extends RESTFunctionalTestCase
15
{
16
    use AssertXmlTagTrait;
17
18
    /**
19
     * Covers GET /.
20
     */
21
    public function testLoadRootResource()
22
    {
23
        $response = $this->sendHttpRequest(
24
            $this->createHttpRequest('GET', '/api/ezp/v2/')
25
        );
26
        self::assertHttpResponseCodeEquals($response, 200);
27
28
        return $response->getBody();
29
    }
30
31
    /**
32
     * @dataProvider getRandomUriSet
33
     * Covers GET /<wrongUri>
34
     */
35
    public function testCatchAll($uri)
0 ignored issues
show
Unused Code introduced by
The parameter $uri is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

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