1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @copyright Copyright (C) eZ Systems AS. All rights reserved. |
5
|
|
|
* @license For full copyright and license information view LICENSE file distributed with this source code. |
6
|
|
|
*/ |
7
|
|
|
declare(strict_types=1); |
8
|
|
|
|
9
|
|
|
namespace eZ\Publish\Tests\Core\Persistence\Cache; |
10
|
|
|
|
11
|
|
|
use eZ\Publish\Core\Persistence\Cache\Tests\AbstractCacheHandlerTest; |
12
|
|
|
use eZ\Publish\SPI\Persistence\Bookmark\Bookmark; |
13
|
|
|
use eZ\Publish\SPI\Persistence\Bookmark\CreateStruct; |
14
|
|
|
use eZ\Publish\SPI\Persistence\Bookmark\Handler as SPIBookmarkHandler; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Test case for Persistence\Cache\BookmarkHandler. |
18
|
|
|
*/ |
19
|
|
|
class BookmarkHandlerTest extends AbstractCacheHandlerTest |
20
|
|
|
{ |
21
|
|
|
public function getHandlerMethodName(): string |
22
|
|
|
{ |
23
|
|
|
return 'bookmarkHandler'; |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function getHandlerClassName(): string |
27
|
|
|
{ |
28
|
|
|
return SPIBookmarkHandler::class; |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function providerForUnCachedMethods(): array |
32
|
|
|
{ |
33
|
|
|
// string $method, array $arguments, array? $tags, string? $key, mixed? $returnValue |
34
|
|
|
return [ |
35
|
|
|
['create', [new CreateStruct()], null, null, new Bookmark()], |
36
|
|
|
['delete', [1], ['bookmark-1']], |
37
|
|
|
['loadUserBookmarks', [3, 2, 1], null, null, []], |
38
|
|
|
['countUserBookmarks', [3], null, null, 1], |
39
|
|
|
]; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function providerForCachedLoadMethods(): array |
43
|
|
|
{ |
44
|
|
|
$bookmark = new Bookmark([ |
45
|
|
|
'id' => 1, |
46
|
|
|
'locationId' => 2, |
47
|
|
|
'userId' => 3, |
48
|
|
|
]); |
49
|
|
|
|
50
|
|
|
// string $method, array $arguments, string $key, mixed? $data |
51
|
|
|
return [ |
52
|
|
|
['loadByUserIdAndLocationId', [3, [2]], 'ez-bookmark-3-2', [2 => $bookmark], true], |
53
|
|
|
]; |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|