Completed
Push — sf_cache ( 18214b...3b3329 )
by André
19:05
created

ContentLanguageHandlerTest::testLoadByLanguageCode()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 20
nc 1
nop 0
dl 0
loc 28
rs 8.8571
c 0
b 0
f 0
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\Language as SPILanguage;
12
use eZ\Publish\SPI\Persistence\Content\Language\CreateStruct as SPILanguageCreateStruct;
13
use eZ\Publish\SPI\Persistence\Content\Language\Handler;
14
15
/**
16
 * Test case for Persistence\Cache\ContentLanguageHandler.
17
 */
18
class ContentLanguageHandlerTest extends AbstractCacheHandlerTest
19
{
20
    public function getHandlerMethodName(): string
21
    {
22
        return 'contentLanguageHandler';
23
    }
24
25
    public function getHandlerClassName(): string
26
    {
27
        return Handler::class;
28
    }
29
30
    public function providerForUnCachedMethods(): array
31
    {
32
        // string $method, array $arguments, array? $tags, string? $key
33
        return [
34
            ['create', [new SPILanguageCreateStruct()]],
35
            ['update', [new SPILanguage(['id' => 5])], ['language-5']],
36
            ['loadAll', []],
37
            ['delete', [5], ['language-5']],
38
        ];
39
    }
40
41
    public function providerForCachedLoadMethods(): array
42
    {
43
        $object = new SPILanguage(['id' => 5]);
44
45
        // string $method, array $arguments, string $key, mixed? $data
46
        return [
47
            ['load', [5], 'ez-language-5', $object],
48
            ['loadByLanguageCode', ['eng-GB'], 'ez-language-eng-GB-by-code', $object],
49
        ];
50
    }
51
}
52