@@ -10,6 +10,18 @@ class ViewTest extends TestCase
10
10
{
11
11
use ResourceAssertionsTrait;
12
12
13
+ private const VIEW_ENDPOINT_ACCEPT_TYPE = 'View+json ' ;
14
+ private const VIEW_ENDPOINT_URL = '/api/ibexa/v2/views ' ;
15
+
16
+ private const FORMAT_XML = 'xml ' ;
17
+ private const FORMAT_JSON = 'json ' ;
18
+
19
+ private const OPERATOR_EQUALITY = 'eq ' ;
20
+ private const OPERATOR_IN = 'in ' ;
21
+
22
+ private const CRITERION_LOCATION_DEPTH = 'LocationDepth ' ;
23
+ private const CRITERION_IS_MAIN_LOCATION = 'IsMainLocation ' ;
24
+
13
25
/**
14
26
* Covers POST /views.
15
27
*/
@@ -38,9 +50,9 @@ public function testViewRequestWithOrStatement(): void
38
50
XML ;
39
51
$ request = $ this ->createHttpRequest (
40
52
'POST ' ,
41
- ' /api/ibexa/v2/views ' ,
53
+ self :: VIEW_ENDPOINT_URL ,
42
54
'ViewInput+xml ' ,
43
- ' View+json ' ,
55
+ self :: VIEW_ENDPOINT_ACCEPT_TYPE ,
44
56
$ body
45
57
);
46
58
$ response = $ this ->sendHttpRequest ($ request );
@@ -58,9 +70,9 @@ public function testCriterions(string $body, string $type): void
58
70
{
59
71
$ request = $ this ->createHttpRequest (
60
72
'POST ' ,
61
- ' /api/ibexa/v2/views ' ,
73
+ self :: VIEW_ENDPOINT_URL ,
62
74
"ViewInput+ $ type " ,
63
- ' View+json ' ,
75
+ self :: VIEW_ENDPOINT_ACCEPT_TYPE ,
64
76
$ body
65
77
);
66
78
$ response = $ this ->sendHttpRequest ($ request );
@@ -82,34 +94,34 @@ public function provideForViewTest(): iterable
82
94
strtoupper ($ format ),
83
95
);
84
96
85
- yield $ template (' LocationDepth ' , ' eq ' , ' xml ' ) => [
97
+ yield $ template (self :: CRITERION_LOCATION_DEPTH , self :: OPERATOR_EQUALITY , self :: FORMAT_XML ) => [
86
98
file_get_contents (__DIR__ . '/_input/search/LocationDepth.eq.xml ' ),
87
- ' xml ' ,
99
+ self :: FORMAT_XML ,
88
100
];
89
101
90
- yield $ template (' LocationDepth ' , ' eq ' , ' json ' ) => [
102
+ yield $ template (self :: CRITERION_LOCATION_DEPTH , self :: OPERATOR_EQUALITY , self :: FORMAT_JSON ) => [
91
103
file_get_contents (__DIR__ . '/_input/search/LocationDepth.eq.json ' ),
92
- ' json ' ,
104
+ self :: FORMAT_JSON ,
93
105
];
94
106
95
- yield $ template (' LocationDepth ' , ' in ' , ' xml ' ) => [
107
+ yield $ template (self :: CRITERION_LOCATION_DEPTH , self :: OPERATOR_IN , self :: FORMAT_XML ) => [
96
108
file_get_contents (__DIR__ . '/_input/search/LocationDepth.in.xml ' ),
97
- ' xml ' ,
109
+ self :: FORMAT_XML ,
98
110
];
99
111
100
- yield $ template (' LocationDepth ' , ' in ' , ' json ' ) => [
112
+ yield $ template (self :: CRITERION_LOCATION_DEPTH , self :: OPERATOR_IN , self :: FORMAT_JSON ) => [
101
113
file_get_contents (__DIR__ . '/_input/search/LocationDepth.in.json ' ),
102
- ' json ' ,
114
+ self :: FORMAT_JSON ,
103
115
];
104
116
105
- yield $ template (' IsMainLocation ' , ' eq ' , ' xml ' ) => [
117
+ yield $ template (self :: CRITERION_IS_MAIN_LOCATION , self :: OPERATOR_EQUALITY , self :: FORMAT_XML ) => [
106
118
file_get_contents (__DIR__ . '/_input/search/IsMainLocation.xml ' ),
107
- ' xml ' ,
119
+ self :: FORMAT_XML ,
108
120
];
109
121
110
- yield $ template (' IsMainLocation ' , ' eq ' , ' json ' ) => [
122
+ yield $ template (self :: CRITERION_IS_MAIN_LOCATION , self :: OPERATOR_EQUALITY , self :: FORMAT_JSON ) => [
111
123
file_get_contents (__DIR__ . '/_input/search/IsMainLocation.json ' ),
112
- ' json ' ,
124
+ self :: FORMAT_JSON ,
113
125
];
114
126
}
115
127
@@ -144,9 +156,9 @@ public function testViewRequestWithAndStatement(): void
144
156
XML ;
145
157
$ request = $ this ->createHttpRequest (
146
158
'POST ' ,
147
- ' /api/ibexa/v2/views ' ,
159
+ self :: VIEW_ENDPOINT_URL ,
148
160
'ViewInput+xml ' ,
149
- ' View+json ' ,
161
+ self :: VIEW_ENDPOINT_ACCEPT_TYPE ,
150
162
$ body
151
163
);
152
164
$ response = $ this ->sendHttpRequest ($ request );
0 commit comments