Completed
Push — sf_cache ( b9ead9...8c890f )
by André
18:16
created

UrlAliasHandlerTest::testUnCachedMethods()   B

Complexity

Conditions 6
Paths 6

Size

Total Lines 34
Code Lines 26

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 26
nc 6
nop 2
dl 0
loc 34
rs 8.439
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A UrlAliasHandlerTest::providerForCachedLoadMethods() 0 12 1
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\UrlAlias;
12
use eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler;
13
14
/**
15
 * Test case for Persistence\Cache\UrlAliasHandler.
16
 */
17
class UrlAliasHandlerTest extends HandlerTest
18
{
19
    public function getHandlerMethodName() : string
20
    {
21
        return 'urlAliasHandler';
22
    }
23
24
    public function getHandlerClassName() : string
25
    {
26
        return Handler::class;
27
    }
28
29
    public function providerForUnCachedMethods() : array
30
    {
31
        // string $method, array $arguments, array? $tags, string? $key
32
        return [
33
            ['publishUrlAliasForLocation', [44, 2, 'name', 'eng-GB', true, false], ['urlAlias-location-44', 'urlAlias-notFound']],
34
            ['createCustomUrlAlias', [44, '1/2/44', true, null, false], ['urlAlias-location-44', 'urlAlias-notFound']],
35
            ['createGlobalUrlAlias', ['something', '1/2/44', true, null, false], ['urlAlias-global-', 'urlAlias-notFound']],
36
            ['createGlobalUrlAlias', ['something', '1/2/44', true, 'eng-GB', false], ['urlAlias-global-eng-GB', 'urlAlias-notFound']],
37
            ['listGlobalURLAliases', ['eng-GB', 10, 50]],
38
            ['removeURLAliases', [[new UrlAlias(['id' => 5, 'type' => UrlAlias::LOCATION, 'isCustom' => true, 'destination' => 21])]], ['urlAlias-5', 'urlAlias-location-21', 'urlAlias-custom-21']],
39
            ['locationMoved', [21, 45, 12], ['urlAlias-location-21']],
40
            ['locationCopied', [21, 33, 12], ['urlAlias-location-21', 'urlAlias-location-33']],
41
            ['locationDeleted', [21], ['urlAlias-location-21']],
42
            ['locationSwapped', [21, 2, 33, 45], ['urlAlias-location-21', 'urlAlias-location-33']],
43
44
        ];
45
    }
46
47
    public function providerForCachedLoadMethods() : array
48
    {
49
        $object = new UrlAlias(['id' => 5]);
50
51
        // string $method, array $arguments, string $key, mixed? $data
52
        return [
53
            ['listURLAliasesForLocation', [5], 'ez-urlAlias-location-list-5', [$object]],
54
            ['listURLAliasesForLocation', [5, true], 'ez-urlAlias-location-list-5-custom', [$object]],
55
            ['lookup', ['/Home'], 'ez-urlAlias-url-_Home', $object],
56
            ['loadUrlAlias', [5], 'ez-urlAlias-5', $object],
57
        ];
58
    }
59
}
60