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

LocationHandlerTest::testSwap()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 96
Code Lines 76

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 76
nc 1
nop 0
dl 0
loc 96
rs 8.3859
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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 HandlerTest
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
            ['create', ['Standard', 'standard']],
36
        ];
37
    }
38
39 View Code Duplication
    public function providerForCachedLoadMethods() : array
40
    {
41
        $object = new SPISection(['id' => 5]);
42
43
        // string $method, array $arguments, string $key, mixed? $data
44
        return [
45
            ['load', [12], 'ez-location-12', $object],
46
            ['loadSubtreeIds', ['standard'], 'ez-section-standard-by-identifier', $object],
47
        ];
48
    }
49
}
50