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
|
|
|
namespace eZ\Publish\Core\REST\Server\Tests\Output\ValueObjectVisitor; |
10
|
|
|
|
11
|
|
|
use eZ\Publish\API\Repository\Values\ContentType\ContentType; |
12
|
|
|
use eZ\Publish\Core\REST\Common\Tests\Output\ValueObjectVisitorBaseTest; |
13
|
|
|
use eZ\Publish\Core\REST\Server\Values\RestContent; |
14
|
|
|
use eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor; |
15
|
|
|
use eZ\Publish\Core\Repository\Values; |
16
|
|
|
use eZ\Publish\API\Repository\Values\Content\ContentInfo; |
17
|
|
|
use eZ\Publish\Core\REST\Server\Values\Version; |
18
|
|
|
|
19
|
|
|
class RestContentTest extends ValueObjectVisitorBaseTest |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @return \DOMDocument |
23
|
|
|
*/ |
24
|
|
|
public function testVisitWithoutEmbeddedVersion() |
25
|
|
|
{ |
26
|
|
|
$visitor = $this->getVisitor(); |
27
|
|
|
$generator = $this->getGenerator(); |
28
|
|
|
|
29
|
|
|
$generator->startDocument(null); |
30
|
|
|
|
31
|
|
|
$restContent = $this->getBasicRestContent(); |
32
|
|
|
|
33
|
|
|
$this->getVisitorMock()->expects($this->never()) |
34
|
|
|
->method('visitValueObject'); |
35
|
|
|
|
36
|
|
|
$this->addRouteExpectation( |
37
|
|
|
'ezpublish_rest_loadContent', |
38
|
|
|
['contentId' => $restContent->contentInfo->id], |
39
|
|
|
"/content/objects/{$restContent->contentInfo->id}" |
40
|
|
|
); |
41
|
|
|
$this->addRouteExpectation( |
42
|
|
|
'ezpublish_rest_loadContentType', |
43
|
|
|
['contentTypeId' => $restContent->contentInfo->contentTypeId], |
44
|
|
|
"/content/types/{$restContent->contentInfo->contentTypeId}" |
45
|
|
|
); |
46
|
|
|
$this->addRouteExpectation( |
47
|
|
|
'ezpublish_rest_loadContentVersions', |
48
|
|
|
['contentId' => $restContent->contentInfo->id], |
49
|
|
|
"/content/objects/{$restContent->contentInfo->id}/versions" |
50
|
|
|
); |
51
|
|
|
$this->addRouteExpectation( |
52
|
|
|
'ezpublish_rest_redirectCurrentVersion', |
53
|
|
|
['contentId' => $restContent->contentInfo->id], |
54
|
|
|
"/content/objects/{$restContent->contentInfo->id}/currentversion" |
55
|
|
|
); |
56
|
|
|
$this->addRouteExpectation( |
57
|
|
|
'ezpublish_rest_loadSection', |
58
|
|
|
['sectionId' => $restContent->contentInfo->sectionId], |
59
|
|
|
"/content/sections/{$restContent->contentInfo->sectionId}" |
60
|
|
|
); |
61
|
|
|
$this->addRouteExpectation( |
62
|
|
|
'ezpublish_rest_loadLocation', |
63
|
|
|
['locationPath' => $locationPath = trim($restContent->mainLocation->pathString, '/')], |
64
|
|
|
"/content/locations/{$locationPath}" |
65
|
|
|
); |
66
|
|
|
$this->addRouteExpectation( |
67
|
|
|
'ezpublish_rest_loadLocationsForContent', |
68
|
|
|
['contentId' => $restContent->contentInfo->id], |
69
|
|
|
"/content/objects/{$restContent->contentInfo->id}/locations" |
70
|
|
|
); |
71
|
|
|
$this->addRouteExpectation( |
72
|
|
|
'ezpublish_rest_loadUser', |
73
|
|
|
['userId' => $restContent->contentInfo->ownerId], |
74
|
|
|
"/user/users/{$restContent->contentInfo->ownerId}" |
75
|
|
|
); |
76
|
|
|
$this->addRouteExpectation( |
77
|
|
|
'ezpublish_rest_getObjectStatesForContent', |
78
|
|
|
['contentId' => $restContent->contentInfo->id], |
79
|
|
|
"/content/objects/{$restContent->contentInfo->id}/objectstates" |
80
|
|
|
); |
81
|
|
|
|
82
|
|
|
$visitor->visit( |
83
|
|
|
$this->getVisitorMock(), |
|
|
|
|
84
|
|
|
$generator, |
85
|
|
|
$restContent |
86
|
|
|
); |
87
|
|
|
|
88
|
|
|
$result = $generator->endDocument(null); |
89
|
|
|
|
90
|
|
|
$this->assertNotNull($result); |
91
|
|
|
|
92
|
|
|
$dom = new \DOMDocument(); |
93
|
|
|
$dom->loadXml($result); |
94
|
|
|
|
95
|
|
|
return $dom; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
protected function getBasicRestContent() |
99
|
|
|
{ |
100
|
|
|
return new RestContent( |
101
|
|
|
new ContentInfo( |
102
|
|
|
[ |
103
|
|
|
'id' => 'content23', |
104
|
|
|
'name' => 'Sindelfingen', |
105
|
|
|
'sectionId' => 'section23', |
106
|
|
|
'currentVersionNo' => 5, |
107
|
|
|
'published' => true, |
108
|
|
|
'ownerId' => 'user23', |
109
|
|
|
'modificationDate' => new \DateTime('2012-09-05 15:27 Europe/Berlin'), |
110
|
|
|
'publishedDate' => null, |
111
|
|
|
'alwaysAvailable' => true, |
112
|
|
|
'status' => ContentInfo::STATUS_PUBLISHED, |
113
|
|
|
'remoteId' => 'abc123', |
114
|
|
|
'mainLanguageCode' => 'eng-US', |
115
|
|
|
'mainLocationId' => 'location23', |
116
|
|
|
'contentTypeId' => 'contentType23', |
117
|
|
|
'isHidden' => true, |
118
|
|
|
] |
119
|
|
|
), |
120
|
|
|
new Values\Content\Location( |
121
|
|
|
[ |
122
|
|
|
'pathString' => '/1/2/23', |
123
|
|
|
] |
124
|
|
|
), |
125
|
|
|
null |
126
|
|
|
); |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* @param \DOMDocument $dom |
131
|
|
|
* |
132
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
133
|
|
|
*/ |
134
|
|
|
public function testContentHrefCorrect(\DOMDocument $dom) |
135
|
|
|
{ |
136
|
|
|
$this->assertXPath($dom, '/Content[@href="/content/objects/content23"]'); |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @param \DOMDocument $dom |
141
|
|
|
* |
142
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
143
|
|
|
*/ |
144
|
|
|
public function testContentIdCorrect(\DOMDocument $dom) |
145
|
|
|
{ |
146
|
|
|
$this->assertXPath($dom, '/Content[@id="content23"]'); |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* @param \DOMDocument $dom |
151
|
|
|
* |
152
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
153
|
|
|
*/ |
154
|
|
|
public function testContentMediaTypeWithoutVersionCorrect(\DOMDocument $dom) |
155
|
|
|
{ |
156
|
|
|
$this->assertXPath($dom, '/Content[@media-type="application/vnd.ez.api.ContentInfo+xml"]'); |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* @param \DOMDocument $dom |
161
|
|
|
* |
162
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
163
|
|
|
*/ |
164
|
|
|
public function testContentRemoteIdCorrect(\DOMDocument $dom) |
165
|
|
|
{ |
166
|
|
|
$this->assertXPath($dom, '/Content[@remoteId="abc123"]'); |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* @param \DOMDocument $dom |
171
|
|
|
* |
172
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
173
|
|
|
*/ |
174
|
|
|
public function testContentTypeHrefCorrect(\DOMDocument $dom) |
175
|
|
|
{ |
176
|
|
|
$this->assertXPath($dom, '/Content/ContentType[@href="/content/types/contentType23"]'); |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* @param \DOMDocument $dom |
181
|
|
|
* |
182
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
183
|
|
|
*/ |
184
|
|
|
public function testContentTypeMediaTypeCorrect(\DOMDocument $dom) |
185
|
|
|
{ |
186
|
|
|
$this->assertXPath($dom, '/Content/ContentType[@media-type="application/vnd.ez.api.ContentType+xml"]'); |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* @param \DOMDocument $dom |
191
|
|
|
* |
192
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
193
|
|
|
*/ |
194
|
|
|
public function testNameCorrect(\DOMDocument $dom) |
195
|
|
|
{ |
196
|
|
|
$this->assertXPath($dom, '/Content/Name[text()="Sindelfingen"]'); |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* @param \DOMDocument $dom |
201
|
|
|
* |
202
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
203
|
|
|
*/ |
204
|
|
|
public function testVersionsHrefCorrect(\DOMDocument $dom) |
205
|
|
|
{ |
206
|
|
|
$this->assertXPath($dom, '/Content/Versions[@href="/content/objects/content23/versions"]'); |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* @param \DOMDocument $dom |
211
|
|
|
* |
212
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
213
|
|
|
*/ |
214
|
|
|
public function testVersionsMediaTypeCorrect(\DOMDocument $dom) |
215
|
|
|
{ |
216
|
|
|
$this->assertXPath($dom, '/Content/Versions[@media-type="application/vnd.ez.api.VersionList+xml"]'); |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* @param \DOMDocument $dom |
221
|
|
|
* |
222
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
223
|
|
|
*/ |
224
|
|
|
public function testCurrentVersionHrefCorrect(\DOMDocument $dom) |
225
|
|
|
{ |
226
|
|
|
$this->assertXPath($dom, '/Content/CurrentVersion[@href="/content/objects/content23/currentversion"]'); |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
/** |
230
|
|
|
* @param \DOMDocument $dom |
231
|
|
|
* |
232
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
233
|
|
|
*/ |
234
|
|
|
public function testCurrentVersionMediaTypeCorrect(\DOMDocument $dom) |
235
|
|
|
{ |
236
|
|
|
$this->assertXPath($dom, '/Content/CurrentVersion[@media-type="application/vnd.ez.api.Version+xml"]'); |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
/** |
240
|
|
|
* @param \DOMDocument $dom |
241
|
|
|
* |
242
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
243
|
|
|
*/ |
244
|
|
|
public function testSectionHrefCorrect(\DOMDocument $dom) |
245
|
|
|
{ |
246
|
|
|
$this->assertXPath($dom, '/Content/Section[@href="/content/sections/section23"]'); |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
/** |
250
|
|
|
* @param \DOMDocument $dom |
251
|
|
|
* |
252
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
253
|
|
|
*/ |
254
|
|
|
public function testSectionMediaTypeCorrect(\DOMDocument $dom) |
255
|
|
|
{ |
256
|
|
|
$this->assertXPath($dom, '/Content/Section[@media-type="application/vnd.ez.api.Section+xml"]'); |
257
|
|
|
} |
258
|
|
|
|
259
|
|
|
/** |
260
|
|
|
* @param \DOMDocument $dom |
261
|
|
|
* |
262
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
263
|
|
|
*/ |
264
|
|
|
public function testMainLocationHrefCorrect(\DOMDocument $dom) |
265
|
|
|
{ |
266
|
|
|
$this->assertXPath($dom, '/Content/MainLocation[@href="/content/locations/1/2/23"]'); |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
/** |
270
|
|
|
* @param \DOMDocument $dom |
271
|
|
|
* |
272
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
273
|
|
|
*/ |
274
|
|
|
public function testMainLocationMediaTypeCorrect(\DOMDocument $dom) |
275
|
|
|
{ |
276
|
|
|
$this->assertXPath($dom, '/Content/MainLocation[@media-type="application/vnd.ez.api.Location+xml"]'); |
277
|
|
|
} |
278
|
|
|
|
279
|
|
|
/** |
280
|
|
|
* @param \DOMDocument $dom |
281
|
|
|
* |
282
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
283
|
|
|
*/ |
284
|
|
|
public function testLocationsHrefCorrect(\DOMDocument $dom) |
285
|
|
|
{ |
286
|
|
|
$this->assertXPath($dom, '/Content/Locations[@href="/content/objects/content23/locations"]'); |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
/** |
290
|
|
|
* @param \DOMDocument $dom |
291
|
|
|
* |
292
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
293
|
|
|
*/ |
294
|
|
|
public function testLocationsMediaTypeCorrect(\DOMDocument $dom) |
295
|
|
|
{ |
296
|
|
|
$this->assertXPath($dom, '/Content/Locations[@media-type="application/vnd.ez.api.LocationList+xml"]'); |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
/** |
300
|
|
|
* @param \DOMDocument $dom |
301
|
|
|
* |
302
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
303
|
|
|
*/ |
304
|
|
|
public function testOwnerHrefCorrect(\DOMDocument $dom) |
305
|
|
|
{ |
306
|
|
|
$this->assertXPath($dom, '/Content/Owner[@href="/user/users/user23"]'); |
307
|
|
|
} |
308
|
|
|
|
309
|
|
|
/** |
310
|
|
|
* @param \DOMDocument $dom |
311
|
|
|
* |
312
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
313
|
|
|
*/ |
314
|
|
|
public function testOwnerMediaTypeCorrect(\DOMDocument $dom) |
315
|
|
|
{ |
316
|
|
|
$this->assertXPath($dom, '/Content/Owner[@media-type="application/vnd.ez.api.User+xml"]'); |
317
|
|
|
} |
318
|
|
|
|
319
|
|
|
/** |
320
|
|
|
* @param \DOMDocument $dom |
321
|
|
|
* |
322
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
323
|
|
|
*/ |
324
|
|
|
public function testLastModificationDateCorrect(\DOMDocument $dom) |
325
|
|
|
{ |
326
|
|
|
$this->assertXPath($dom, '/Content/lastModificationDate[text()="2012-09-05T15:27:00+02:00"]'); |
327
|
|
|
} |
328
|
|
|
|
329
|
|
|
/** |
330
|
|
|
* @param \DOMDocument $dom |
331
|
|
|
* |
332
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
333
|
|
|
*/ |
334
|
|
|
public function testMainLanguageCodeCorrect(\DOMDocument $dom) |
335
|
|
|
{ |
336
|
|
|
$this->assertXPath($dom, '/Content/mainLanguageCode[text()="eng-US"]'); |
337
|
|
|
} |
338
|
|
|
|
339
|
|
|
/** |
340
|
|
|
* @param \DOMDocument $dom |
341
|
|
|
* |
342
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
343
|
|
|
*/ |
344
|
|
|
public function testCurrentVersionNoCorrect(\DOMDocument $dom) |
345
|
|
|
{ |
346
|
|
|
$this->assertXPath($dom, '/Content/currentVersionNo[text()="5"]'); |
347
|
|
|
} |
348
|
|
|
|
349
|
|
|
/** |
350
|
|
|
* @param \DOMDocument $dom |
351
|
|
|
* |
352
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
353
|
|
|
*/ |
354
|
|
|
public function testAlwaysAvailableCorrect(\DOMDocument $dom) |
355
|
|
|
{ |
356
|
|
|
$this->assertXPath($dom, '/Content/alwaysAvailable[text()="true"]'); |
357
|
|
|
} |
358
|
|
|
|
359
|
|
|
/** |
360
|
|
|
* @param \DOMDocument $dom |
361
|
|
|
* |
362
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
363
|
|
|
*/ |
364
|
|
|
public function testIsHiddenCorrect(\DOMDocument $dom) |
365
|
|
|
{ |
366
|
|
|
$this->assertXPath($dom, '/Content/isHidden[text()="true"]'); |
367
|
|
|
} |
368
|
|
|
|
369
|
|
|
/** |
370
|
|
|
* @param \DOMDocument $dom |
371
|
|
|
* |
372
|
|
|
* @depends testVisitWithoutEmbeddedVersion |
373
|
|
|
*/ |
374
|
|
|
public function testStatusCorrect(\DOMDocument $dom) |
375
|
|
|
{ |
376
|
|
|
$this->assertXPath($dom, '/Content/status[text()="PUBLISHED"]'); |
377
|
|
|
} |
378
|
|
|
|
379
|
|
|
/** |
380
|
|
|
* @return \DOMDocument |
381
|
|
|
*/ |
382
|
|
|
public function testVisitWithEmbeddedVersion() |
383
|
|
|
{ |
384
|
|
|
$visitor = $this->getVisitor(); |
385
|
|
|
$generator = $this->getGenerator(); |
386
|
|
|
|
387
|
|
|
$generator->startDocument(null); |
388
|
|
|
|
389
|
|
|
$restContent = $this->getBasicRestContent(); |
390
|
|
|
$restContent->currentVersion = new Values\Content\Content( |
391
|
|
|
[ |
392
|
|
|
'versionInfo' => new Values\Content\VersionInfo(['versionNo' => 5]), |
393
|
|
|
'internalFields' => [], |
394
|
|
|
] |
395
|
|
|
); |
396
|
|
|
$restContent->relations = []; |
397
|
|
|
$restContent->contentType = $this->getMockForAbstractClass( |
|
|
|
|
398
|
|
|
ContentType::class |
399
|
|
|
); |
400
|
|
|
|
401
|
|
|
$this->getVisitorMock()->expects($this->once()) |
402
|
|
|
->method('visitValueObject') |
403
|
|
|
->with($this->isInstanceOf(Version::class)); |
404
|
|
|
|
405
|
|
|
$this->addRouteExpectation( |
406
|
|
|
'ezpublish_rest_loadContent', |
407
|
|
|
['contentId' => $restContent->contentInfo->id], |
408
|
|
|
"/content/objects/{$restContent->contentInfo->id}" |
409
|
|
|
); |
410
|
|
|
$this->addRouteExpectation( |
411
|
|
|
'ezpublish_rest_loadContentType', |
412
|
|
|
['contentTypeId' => $restContent->contentInfo->contentTypeId], |
413
|
|
|
"/content/types/{$restContent->contentInfo->contentTypeId}" |
414
|
|
|
); |
415
|
|
|
$this->addRouteExpectation( |
416
|
|
|
'ezpublish_rest_loadContentVersions', |
417
|
|
|
['contentId' => $restContent->contentInfo->id], |
418
|
|
|
"/content/objects/{$restContent->contentInfo->id}/versions" |
419
|
|
|
); |
420
|
|
|
$this->addRouteExpectation( |
421
|
|
|
'ezpublish_rest_redirectCurrentVersion', |
422
|
|
|
['contentId' => $restContent->contentInfo->id], |
423
|
|
|
"/content/objects/{$restContent->contentInfo->id}/currentversion" |
424
|
|
|
); |
425
|
|
|
|
426
|
|
|
$this->addRouteExpectation( |
427
|
|
|
'ezpublish_rest_loadSection', |
428
|
|
|
['sectionId' => $restContent->contentInfo->sectionId], |
429
|
|
|
"/content/sections/{$restContent->contentInfo->sectionId}" |
430
|
|
|
); |
431
|
|
|
$this->addRouteExpectation( |
432
|
|
|
'ezpublish_rest_loadLocation', |
433
|
|
|
['locationPath' => $locationPath = trim($restContent->mainLocation->pathString, '/')], |
434
|
|
|
"/content/locations/{$locationPath}" |
435
|
|
|
); |
436
|
|
|
$this->addRouteExpectation( |
437
|
|
|
'ezpublish_rest_loadLocationsForContent', |
438
|
|
|
['contentId' => $restContent->contentInfo->id], |
439
|
|
|
"/content/objects/{$restContent->contentInfo->id}/locations" |
440
|
|
|
); |
441
|
|
|
$this->addRouteExpectation( |
442
|
|
|
'ezpublish_rest_loadUser', |
443
|
|
|
['userId' => $restContent->contentInfo->ownerId], |
444
|
|
|
"/user/users/{$restContent->contentInfo->ownerId}" |
445
|
|
|
); |
446
|
|
|
|
447
|
|
|
$visitor->visit( |
448
|
|
|
$this->getVisitorMock(), |
|
|
|
|
449
|
|
|
$generator, |
450
|
|
|
$restContent |
451
|
|
|
); |
452
|
|
|
|
453
|
|
|
$result = $generator->endDocument(null); |
454
|
|
|
|
455
|
|
|
$this->assertNotNull($result); |
456
|
|
|
|
457
|
|
|
$dom = new \DOMDocument(); |
458
|
|
|
$dom->loadXml($result); |
459
|
|
|
|
460
|
|
|
return $dom; |
461
|
|
|
} |
462
|
|
|
|
463
|
|
|
/** |
464
|
|
|
* @param \DOMDocument $dom |
465
|
|
|
* |
466
|
|
|
* @depends testVisitWithEmbeddedVersion |
467
|
|
|
*/ |
468
|
|
|
public function testContentMediaTypeWithVersionCorrect(\DOMDocument $dom) |
469
|
|
|
{ |
470
|
|
|
$this->assertXPath($dom, '/Content[@media-type="application/vnd.ez.api.Content+xml"]'); |
471
|
|
|
} |
472
|
|
|
|
473
|
|
|
/** |
474
|
|
|
* @param \DOMDocument $dom |
475
|
|
|
* |
476
|
|
|
* @depends testVisitWithEmbeddedVersion |
477
|
|
|
*/ |
478
|
|
|
public function testEmbeddedCurrentVersionHrefCorrect(\DOMDocument $dom) |
479
|
|
|
{ |
480
|
|
|
$this->assertXPath($dom, '/Content/CurrentVersion[@href="/content/objects/content23/currentversion"]'); |
481
|
|
|
} |
482
|
|
|
|
483
|
|
|
/** |
484
|
|
|
* @param \DOMDocument $dom |
485
|
|
|
* |
486
|
|
|
* @depends testVisitWithEmbeddedVersion |
487
|
|
|
*/ |
488
|
|
|
public function testEmbeddedCurrentVersionMediaTypeCorrect(\DOMDocument $dom) |
489
|
|
|
{ |
490
|
|
|
$this->assertXPath($dom, '/Content/CurrentVersion[@media-type="application/vnd.ez.api.Version+xml"]'); |
491
|
|
|
} |
492
|
|
|
|
493
|
|
|
/** |
494
|
|
|
* Get the Content visitor. |
495
|
|
|
* |
496
|
|
|
* @return \eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RestContent |
497
|
|
|
*/ |
498
|
|
|
protected function internalGetVisitor() |
499
|
|
|
{ |
500
|
|
|
return new ValueObjectVisitor\RestContent(); |
501
|
|
|
} |
502
|
|
|
} |
503
|
|
|
|
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.