Completed
Push — master ( 336c64...8fa798 )
by Łukasz
25:31
created

BookmarkHandlerTest::providerForUnCachedMethods()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
rs 9.4285
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