1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace eZ\Publish\Core\Repository\SiteAccessAware\Tests; |
4
|
|
|
|
5
|
|
|
use eZ\Publish\API\Repository\ContentService as APIService; |
6
|
|
|
use eZ\Publish\API\Repository\Values\Content\ContentInfo; |
7
|
|
|
use eZ\Publish\API\Repository\Values\Content\ContentMetadataUpdateStruct; |
8
|
|
|
use eZ\Publish\API\Repository\Values\Content\LocationCreateStruct; |
9
|
|
|
use eZ\Publish\Core\Repository\Values\ContentType\ContentType; |
10
|
|
|
use eZ\Publish\Core\Repository\Values\User\User; |
11
|
|
|
use eZ\Publish\Core\Repository\SiteAccessAware\ContentService; |
12
|
|
|
use eZ\Publish\Core\Repository\Values\Content\ContentCreateStruct; |
13
|
|
|
use eZ\Publish\Core\Repository\Values\Content\ContentUpdateStruct; |
14
|
|
|
use eZ\Publish\Core\Repository\Values\Content\VersionInfo; |
15
|
|
|
|
16
|
|
|
class ContentServiceTest extends AbstractServiceTest |
17
|
|
|
{ |
18
|
|
|
public function getAPIServiceClassName() |
19
|
|
|
{ |
20
|
|
|
return APIService::class; |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
public function getSiteAccessAwareServiceClassName() |
24
|
|
|
{ |
25
|
|
|
return ContentService::class; |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
public function providerForPassTroughMethods() |
29
|
|
|
{ |
30
|
|
|
$contentInfo = new ContentInfo(); |
31
|
|
|
$versionInfo = new VersionInfo(); |
32
|
|
|
$contentCreateStruct = new ContentCreateStruct(); |
33
|
|
|
$contentUpdateStruct = new ContentUpdateStruct(); |
34
|
|
|
$contentMetaStruct = new ContentMetadataUpdateStruct(); |
35
|
|
|
$locationCreateStruct = new LocationCreateStruct(); |
36
|
|
|
$user = new User(); |
37
|
|
|
$contentType = new ContentType(); |
38
|
|
|
|
39
|
|
|
// string $method, array $arguments, bool $return = true |
40
|
|
|
return [ |
41
|
|
|
['loadContentInfo', [42]], |
42
|
|
|
|
43
|
|
|
['loadContentInfoByRemoteId', ['f348tj4gorgji4']], |
44
|
|
|
|
45
|
|
|
['loadVersionInfo', [$contentInfo]], |
46
|
|
|
['loadVersionInfo', [$contentInfo, 3]], |
47
|
|
|
|
48
|
|
|
['loadVersionInfoById', [42]], |
49
|
|
|
['loadVersionInfoById', [42, 3]], |
50
|
|
|
|
51
|
|
|
['createContent', [$contentCreateStruct]], |
52
|
|
|
['createContent', [$contentCreateStruct, [44]]], |
53
|
|
|
|
54
|
|
|
['updateContentMetadata', [$contentInfo, $contentMetaStruct]], |
55
|
|
|
|
56
|
|
|
['deleteContent', [$contentInfo]], |
57
|
|
|
|
58
|
|
|
['createContentDraft', [$contentInfo]], |
59
|
|
|
['createContentDraft', [$contentInfo, $versionInfo]], |
60
|
|
|
['createContentDraft', [$contentInfo, $versionInfo, $user]], |
61
|
|
|
|
62
|
|
|
['loadContentDrafts', []], |
63
|
|
|
['loadContentDrafts', [$user]], |
64
|
|
|
|
65
|
|
|
['updateContent', [$versionInfo, $contentUpdateStruct]], |
66
|
|
|
|
67
|
|
|
['publishVersion', [$versionInfo]], |
68
|
|
|
|
69
|
|
|
['deleteVersion', [$versionInfo]], |
70
|
|
|
|
71
|
|
|
['loadVersions', [$contentInfo]], |
72
|
|
|
|
73
|
|
|
['copyContent', [$contentInfo, $locationCreateStruct]], |
74
|
|
|
['copyContent', [$contentInfo, $locationCreateStruct, $versionInfo]], |
75
|
|
|
|
76
|
|
|
['loadRelations', [$versionInfo]], |
77
|
|
|
|
78
|
|
|
['loadReverseRelations', [$contentInfo]], |
79
|
|
|
|
80
|
|
|
['addRelation', [$versionInfo, $contentInfo]], |
81
|
|
|
|
82
|
|
|
['deleteRelation', [$versionInfo, $contentInfo]], |
83
|
|
|
|
84
|
|
|
['removeTranslation', [$contentInfo, 'eng-GB']], |
85
|
|
|
|
86
|
|
|
['deleteTranslation', [$contentInfo, 'eng-GB']], |
87
|
|
|
|
88
|
|
|
['deleteTranslationFromDraft', [$versionInfo, 'eng-GB']], |
89
|
|
|
|
90
|
|
|
['newContentCreateStruct', [$contentType, 'eng-GB']], |
91
|
|
|
['newContentMetadataUpdateStruct', []], |
92
|
|
|
['newContentUpdateStruct', []], |
93
|
|
|
]; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
public function providerForLanguagesLookupMethods() |
97
|
|
|
{ |
98
|
|
|
$contentInfo = new ContentInfo(); |
99
|
|
|
$versionInfo = new VersionInfo(); |
100
|
|
|
|
101
|
|
|
// string $method, array $arguments, bool $return, int $languageArgumentIndex |
102
|
|
|
return [ |
103
|
|
|
['loadContentByContentInfo', [$contentInfo], true, 1], |
104
|
|
|
['loadContentByContentInfo', [$contentInfo, self::LANG_ARG, 4, false], true, 1], |
105
|
|
|
|
106
|
|
|
['loadContentByVersionInfo', [$versionInfo], true, 1], |
107
|
|
|
['loadContentByVersionInfo', [$versionInfo, self::LANG_ARG, false], true, 1], |
108
|
|
|
|
109
|
|
|
['loadContent', [42], true, 1], |
110
|
|
|
['loadContent', [42, self::LANG_ARG, 4, false], true, 1], |
111
|
|
|
|
112
|
|
|
['loadContentByRemoteId', ['f348tj4gorgji4'], true, 1], |
113
|
|
|
['loadContentByRemoteId', ['f348tj4gorgji4', self::LANG_ARG, 4, false], true, 1], |
114
|
|
|
]; |
115
|
|
|
} |
116
|
|
|
} |
117
|
|
|
|