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