1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @copyright Copyright (C) eZ Systems AS. All rights reserved. |
5
|
|
|
* @license For full copyright and license information view LICENSE file distributed with this source code. |
6
|
|
|
*/ |
7
|
|
|
namespace eZ\Bundle\EzPublishRestBundle\Tests\Functional; |
8
|
|
|
|
9
|
|
|
use eZ\Bundle\EzPublishRestBundle\Tests\Functional\TestCase as RESTFunctionalTestCase; |
10
|
|
|
|
11
|
|
|
class RelationTest extends RESTFunctionalTestCase |
12
|
|
|
{ |
13
|
|
|
public function testRelation() |
14
|
|
|
{ |
15
|
|
|
$xml = <<< XML |
16
|
|
|
<?xml version="1.0" encoding="UTF-8"?> |
17
|
|
|
<ContentCreate> |
18
|
|
|
<ContentType href="/api/ezp/v2/content/types/2" /> |
19
|
|
|
<mainLanguageCode>eng-GB</mainLanguageCode> |
20
|
|
|
<LocationCreate> |
21
|
|
|
<ParentLocation href="/api/ezp/v2/content/locations/1/2" /> |
22
|
|
|
<priority>0</priority> |
23
|
|
|
<hidden>false</hidden> |
24
|
|
|
<sortField>PATH</sortField> |
25
|
|
|
<sortOrder>ASC</sortOrder> |
26
|
|
|
</LocationCreate> |
27
|
|
|
<Section href="/api/ezp/v2/content/sections/1" /> |
28
|
|
|
<alwaysAvailable>true</alwaysAvailable> |
29
|
|
|
<User href="/api/ezp/v2/user/users/14" /> |
30
|
|
|
<modificationDate>2012-09-30T12:30:00</modificationDate> |
31
|
|
|
<fields> |
32
|
|
|
<field> |
33
|
|
|
<fieldDefinitionIdentifier>title</fieldDefinitionIdentifier> |
34
|
|
|
<languageCode>eng-GB</languageCode> |
35
|
|
|
<fieldValue>testRelation</fieldValue> |
36
|
|
|
</field> |
37
|
|
|
<field> |
38
|
|
|
<fieldDefinitionIdentifier>intro</fieldDefinitionIdentifier> |
39
|
|
|
<languageCode>eng-GB</languageCode> |
40
|
|
|
<fieldValue> |
41
|
|
|
<value key="xml"><?xml version="1.0" encoding="UTF-8"?> |
42
|
|
|
<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" xmlns:ezcustom="http://ez.no/xmlns/ezpublish/docbook/custom" version="5.0-variant ezpublish-1.0"> |
43
|
|
|
<title ezxhtml:level="2">This is a title.</title> |
44
|
|
|
<para><link xlink:href="ezcontent://1" xml:id="id1" xlink:title="Content title" ezxhtml:class="linkClass5">Content name</link></para> |
45
|
|
|
<ezembed xlink:href="ezcontent://1" view="line" xml:id="embed-id-2" ezxhtml:class="embedClass2" ezxhtml:align="right"/> |
46
|
|
|
</section></value> |
47
|
|
|
</fieldValue> |
48
|
|
|
</field> |
49
|
|
|
<field> |
50
|
|
|
<fieldDefinitionIdentifier>image</fieldDefinitionIdentifier> |
51
|
|
|
<languageCode>eng-GB</languageCode> |
52
|
|
|
<fieldValue> |
53
|
|
|
<value key="destinationContentId">1</value> |
54
|
|
|
</fieldValue> |
55
|
|
|
</field> |
56
|
|
|
</fields> |
57
|
|
|
</ContentCreate> |
58
|
|
|
XML; |
59
|
|
|
$testContent = $this->createContent($xml); |
60
|
|
|
$relations = $testContent['CurrentVersion']['Version']['Relations']['Relation']; |
61
|
|
|
|
62
|
|
|
self::assertEquals('LINK', $relations[0]['RelationType']); |
63
|
|
|
self::assertEquals('EMBED', $relations[1]['RelationType']); |
64
|
|
|
self::assertEquals('ATTRIBUTE', $relations[2]['RelationType']); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|