|
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\Location; |
|
12
|
|
|
use eZ\Publish\SPI\Persistence\Content\Location\Handler; |
|
13
|
|
|
use eZ\Publish\SPI\Persistence\Content\Location\CreateStruct; |
|
14
|
|
|
use eZ\Publish\SPI\Persistence\Content\Location\UpdateStruct; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Test case for Persistence\Cache\LocationHandler. |
|
18
|
|
|
*/ |
|
19
|
|
|
class LocationHandlerTest extends AbstractCacheHandlerTest |
|
20
|
|
|
{ |
|
21
|
|
|
public function getHandlerMethodName() : string |
|
22
|
|
|
{ |
|
23
|
|
|
return 'locationHandler'; |
|
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
|
|
|
['copySubtree', [12, 45]], |
|
36
|
|
|
['move', [12, 45], ['location-path-12']], |
|
37
|
|
|
['markSubtreeModified', [12]], |
|
38
|
|
|
['hide', [12], ['location-path-12']], |
|
39
|
|
|
['unHide', [12], ['location-path-12']], |
|
40
|
|
|
['swap', [12, 45], ['location-12', 'location-45']], |
|
41
|
|
|
['update', [new UpdateStruct(), 12], ['location-12']], |
|
42
|
|
|
['create', [new CreateStruct(['contentId' => 4, 'mainLocationId' => true])], ['content-4', 'role-assignment-group-list-4']], |
|
43
|
|
|
['create', [new CreateStruct(['contentId' => 4, 'mainLocationId' => false])], ['content-4', 'role-assignment-group-list-4']], |
|
44
|
|
|
['removeSubtree', [12], ['location-path-12']], |
|
45
|
|
|
['setSectionForSubtree', [12, 2], ['location-path-12']], |
|
46
|
|
|
['changeMainLocation', [4, 12], ['content-4']], |
|
47
|
|
|
]; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function providerForCachedLoadMethods() : array |
|
51
|
|
|
{ |
|
52
|
|
|
$location = new Location(['id' => 12]); |
|
53
|
|
|
|
|
54
|
|
|
// string $method, array $arguments, string $key, mixed? $data |
|
55
|
|
|
return [ |
|
56
|
|
|
['load', [12], 'ez-location-12', $location], |
|
57
|
|
|
['loadSubtreeIds', [12], 'ez-location-subtree-12', [33, 44]], |
|
58
|
|
|
['loadLocationsByContent', [4, 12], 'ez-content-locations-4-root-12', [$location]], |
|
59
|
|
|
['loadLocationsByContent', [4], 'ez-content-locations-4', [$location]], |
|
60
|
|
|
['loadParentLocationsForDraftContent', [4], 'ez-content-locations-4-parentForDraft', [$location]], |
|
61
|
|
|
['loadByRemoteId', ['34fe5y4'], 'ez-location-34fe5y4-by-remoteid', $location], |
|
62
|
|
|
]; |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|