|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* File contains 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\Persistence\Cache\Tests; |
|
10
|
|
|
|
|
11
|
|
|
use eZ\Publish\SPI\Persistence\Content\ObjectState as SPIObjectState; |
|
12
|
|
|
use eZ\Publish\SPI\Persistence\Content\ObjectState\Handler; |
|
13
|
|
|
use eZ\Publish\SPI\Persistence\Content\ObjectState\Group as SPIObjectStateGroup; |
|
14
|
|
|
use eZ\Publish\SPI\Persistence\Content\ObjectState\InputStruct as SPIInputStruct; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Test case for Persistence\Cache\ObjectStateHandler. |
|
18
|
|
|
*/ |
|
19
|
|
|
class ObjectStateHandlerTest extends AbstractCacheHandlerTest |
|
20
|
|
|
{ |
|
21
|
|
|
public function getHandlerMethodName() : string |
|
22
|
|
|
{ |
|
23
|
|
|
return 'objectStateHandler'; |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public function getHandlerClassName() : string |
|
27
|
|
|
{ |
|
28
|
|
|
return Handler::class; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function providerForUnCachedMethods() : array |
|
32
|
|
|
{ |
|
33
|
|
|
// string $method, array $arguments, array? $tags, string? $key |
|
34
|
|
|
return [ |
|
35
|
|
|
['createGroup', [new SPIInputStruct()], [], 'ez-state-group-all'], |
|
36
|
|
|
['updateGroup', [5, new SPIInputStruct()], ['state-group-5']], |
|
37
|
|
|
['deleteGroup', [5], ['state-group-5']], |
|
38
|
|
|
['create', [5, new SPIInputStruct()], [], 'ez-state-list-by-group-5'], |
|
39
|
|
|
['update', [7, new SPIInputStruct()], ['state-7']], |
|
40
|
|
|
['setPriority', [7, 99], ['state-7']], |
|
41
|
|
|
['delete', [7], ['state-7']], |
|
42
|
|
|
['setContentState', [4, 5, 7], [], 'ez-state-by-group-5-on-content-4'], |
|
43
|
|
|
]; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function providerForCachedLoadMethods() : array |
|
47
|
|
|
{ |
|
48
|
|
|
$group = new SPIObjectStateGroup(['id' => 5]); |
|
49
|
|
|
$state = new SPIObjectState(['id' => 7]); |
|
50
|
|
|
|
|
51
|
|
|
// string $method, array $arguments, string $key, mixed? $data |
|
52
|
|
|
return [ |
|
53
|
|
|
['loadGroup', [5], 'ez-state-group-5', $group], |
|
54
|
|
|
['loadGroupByIdentifier', ['lock'], 'ez-state-group-lock-by-identifier', $group], |
|
55
|
|
|
['loadAllGroups', [], 'ez-state-group-all', [$group]], |
|
56
|
|
|
['loadObjectStates', [5], 'ez-state-list-5-by-group', [$state]], |
|
57
|
|
|
['load', [7], 'ez-state-7', $state], |
|
58
|
|
|
['loadByIdentifier', ['lock', 5], 'ez-state-identifier-lock-by-group-5', $state], |
|
59
|
|
|
['getContentState', [4, 5], 'ez-state-by-group-5-on-content-4', $state], |
|
60
|
|
|
]; |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|