1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the eZ Publish Kernel package. |
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\MVC\Symfony\Cache\Tests\Http\SignalSlot; |
10
|
|
|
|
11
|
|
|
use PHPUnit\Framework\TestCase; |
12
|
|
|
|
13
|
|
|
abstract class AbstractSlotTest extends TestCase implements SlotTest |
14
|
|
|
{ |
15
|
|
|
/** @var \eZ\Publish\Core\MVC\Symfony\Cache\Http\SignalSlot\AssignSectionSlot */ |
16
|
|
|
protected $slot; |
17
|
|
|
|
18
|
|
|
/** @var \eZ\Publish\Core\MVC\Symfony\Cache\GatewayCachePurger|\PHPUnit_Framework_MockObject_MockObject */ |
19
|
|
|
protected $cachePurgerMock; |
20
|
|
|
|
21
|
|
|
private $contentId = 42; |
22
|
|
|
|
23
|
|
|
private static $signal; |
24
|
|
|
|
25
|
|
|
public function setUp() |
26
|
|
|
{ |
27
|
|
|
$this->cachePurgerMock = $this->getMock('eZ\Publish\Core\MVC\Symfony\Cache\GatewayCachePurger'); |
28
|
|
|
$this->slot = $this->createSlot(); |
29
|
|
|
self::$signal = $this->createSignal(); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
protected function createSlot() |
33
|
|
|
{ |
34
|
|
|
$class = $this->getSlotClass(); |
35
|
|
|
|
36
|
|
|
return new $class($this->cachePurgerMock); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @return \eZ\Publish\Core\MVC\Symfony\Cache\GatewayCachePurger|\PHPUnit_Framework_MockObject_MockObject |
41
|
|
|
*/ |
42
|
|
|
protected function getCachePurger() |
43
|
|
|
{ |
44
|
|
|
return $this->cachePurgerMock; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @dataProvider getUnreceivedSignals |
49
|
|
|
*/ |
50
|
|
|
public function testDoesNotReceiveOtherSignals($signal) |
51
|
|
|
{ |
52
|
|
|
$this->cachePurgerMock->expects($this->never())->method('purgeForContent'); |
53
|
|
|
$this->cachePurgerMock->expects($this->never())->method('purgeAll'); |
54
|
|
|
|
55
|
|
|
$this->slot->receive($signal); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
protected function receive($signal) |
59
|
|
|
{ |
60
|
|
|
$this->slot->receive($signal); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public static function getReceivedSignals() |
64
|
|
|
{ |
65
|
|
|
return [[static::createSignal()]]; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* All existing SignalSlots. |
70
|
|
|
*/ |
71
|
|
|
public static function getUnreceivedSignals() |
72
|
|
|
{ |
73
|
|
|
static $arguments = []; |
74
|
|
|
|
75
|
|
|
if (empty($arguments)) { |
76
|
|
|
$signals = self::getAllSignals(); |
77
|
|
|
|
78
|
|
|
foreach ($signals as $signalClass) { |
79
|
|
|
if (in_array($signalClass, static::getReceivedSignalClasses())) { |
80
|
|
|
continue; |
81
|
|
|
} |
82
|
|
|
$arguments[] = [new $signalClass()]; |
83
|
|
|
} |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
return $arguments; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @return array |
91
|
|
|
*/ |
92
|
|
|
private static function getAllSignals() |
93
|
|
|
{ |
94
|
|
|
return array( |
95
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\URLAliasService\CreateUrlAliasSignal', |
96
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\URLAliasService\RemoveAliasesSignal', |
97
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\URLAliasService\CreateGlobalUrlAliasSignal', |
98
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentTypeService\CreateContentTypeSignal', |
99
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentTypeService\AddFieldDefinitionSignal', |
100
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentTypeService\CopyContentTypeSignal', |
101
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentTypeService\DeleteContentTypeSignal', |
102
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentTypeService\UpdateContentTypeGroupSignal', |
103
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentTypeService\DeleteContentTypeGroupSignal', |
104
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentTypeService\UnassignContentTypeGroupSignal', |
105
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentTypeService\PublishContentTypeDraftSignal', |
106
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentTypeService\AssignContentTypeGroupSignal', |
107
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentTypeService\UpdateFieldDefinitionSignal', |
108
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentTypeService\UpdateContentTypeDraftSignal', |
109
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentTypeService\RemoveFieldDefinitionSignal', |
110
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentTypeService\CreateContentTypeDraftSignal', |
111
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentTypeService\CreateContentTypeGroupSignal', |
112
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\LanguageService\EnableLanguageSignal', |
113
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\LanguageService\UpdateLanguageNameSignal', |
114
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\LanguageService\CreateLanguageSignal', |
115
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\LanguageService\DisableLanguageSignal', |
116
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\LanguageService\DeleteLanguageSignal', |
117
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\UserService\MoveUserGroupSignal', |
118
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\UserService\DeleteUserGroupSignal', |
119
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\UserService\CreateUserGroupSignal', |
120
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\UserService\UpdateUserGroupSignal', |
121
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\UserService\UnAssignUserFromUserGroupSignal', |
122
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\UserService\AssignUserToUserGroupSignal', |
123
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\UserService\DeleteUserSignal', |
124
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\UserService\CreateUserSignal', |
125
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\UserService\UpdateUserSignal', |
126
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\SectionService\DeleteSectionSignal', |
127
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\SectionService\CreateSectionSignal', |
128
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\SectionService\UpdateSectionSignal', |
129
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\SectionService\AssignSectionSignal', |
130
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\RoleService\AssignRoleToUserGroupSignal', |
131
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\RoleService\UpdatePolicySignal', |
132
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\RoleService\CreateRoleSignal', |
133
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\RoleService\RemovePolicySignal', |
134
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\RoleService\UnassignRoleFromUserSignal', |
135
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\RoleService\AddPolicySignal', |
136
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\RoleService\UnassignRoleFromUserGroupSignal', |
137
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\RoleService\UpdateRoleSignal', |
138
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\RoleService\AssignRoleToUserSignal', |
139
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\RoleService\DeleteRoleSignal', |
140
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\TrashService\TrashSignal', |
141
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\TrashService\EmptyTrashSignal', |
142
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\TrashService\RecoverSignal', |
143
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\TrashService\DeleteTrashItemSignal', |
144
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\DeleteObjectStateSignal', |
145
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\CreateObjectStateSignal', |
146
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\DeleteObjectStateGroupSignal', |
147
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\CreateObjectStateGroupSignal', |
148
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\UpdateObjectStateSignal', |
149
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\UpdateObjectStateGroupSignal', |
150
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\SetContentStateSignal', |
151
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\SetPriorityOfObjectStateSignal', |
152
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\URLWildcardService\TranslateSignal', |
153
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\URLWildcardService\RemoveSignal', |
154
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\URLWildcardService\CreateSignal', |
155
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentService\UpdateContentSignal', |
156
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentService\CreateContentDraftSignal', |
157
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentService\AddRelationSignal', |
158
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentService\CreateContentSignal', |
159
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentService\DeleteContentSignal', |
160
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentService\AddTranslationInfoSignal', |
161
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentService\CopyContentSignal', |
162
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentService\UpdateContentMetadataSignal', |
163
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentService\TranslateVersionSignal', |
164
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentService\PublishVersionSignal', |
165
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentService\DeleteRelationSignal', |
166
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\ContentService\DeleteVersionSignal', |
167
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\LocationService\UpdateLocationSignal', |
168
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\LocationService\HideLocationSignal', |
169
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\LocationService\SwapLocationSignal', |
170
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\LocationService\MoveSubtreeSignal', |
171
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\LocationService\UnhideLocationSignal', |
172
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\LocationService\CreateLocationSignal', |
173
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\LocationService\DeleteLocationSignal', |
174
|
|
|
'eZ\Publish\Core\SignalSlot\Signal\LocationService\CopySubtreeSignal', |
175
|
|
|
); |
176
|
|
|
} |
177
|
|
|
} |
178
|
|
|
|