Completed
Push — master ( 4e0ac6...0fdc9b )
by Łukasz
25:36
created

providerForLanguagesLookupMethods()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
1
<?php
2
3
namespace eZ\Publish\Core\Repository\SiteAccessAware\Tests;
4
5
use eZ\Publish\API\Repository\ObjectStateService as APIService;
6
use eZ\Publish\API\Repository\Values\Content\ContentInfo;
7
use eZ\Publish\API\Repository\Values\ObjectState\ObjectStateCreateStruct;
8
use eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroupCreateStruct;
9
use eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroupUpdateStruct;
10
use eZ\Publish\API\Repository\Values\ObjectState\ObjectStateUpdateStruct;
11
use eZ\Publish\Core\Repository\SiteAccessAware\ObjectStateService;
12
use eZ\Publish\Core\Repository\Values\ObjectState\ObjectState;
13
use eZ\Publish\Core\Repository\Values\ObjectState\ObjectStateGroup;
14
15
class ObjectStateServiceTest extends AbstractServiceTest
16
{
17
    public function getAPIServiceClassName()
18
    {
19
        return APIService::class;
20
    }
21
22
    public function getSiteAccessAwareServiceClassName()
23
    {
24
        return ObjectStateService::class;
25
    }
26
27
    public function providerForPassTroughMethods()
28
    {
29
        $objectStateGroupCreateStruct = new ObjectStateGroupCreateStruct();
30
        $objectStateGroupUpdateStruct = new ObjectStateGroupUpdateStruct();
31
        $objectStateGroup = new ObjectStateGroup();
32
33
        $objectStateCreateStruct = new ObjectStateCreateStruct();
34
        $objectStateUpdateStruct = new ObjectStateUpdateStruct();
35
        $objectState = new ObjectState();
36
37
        $contentInfo = new ContentInfo();
38
39
        // string $method, array $arguments, bool $return = true
40
        return [
41
            ['createObjectStateGroup', [$objectStateGroupCreateStruct]],
42
            ['updateObjectStateGroup', [$objectStateGroup, $objectStateGroupUpdateStruct]],
43
            ['deleteObjectStateGroup', [$objectStateGroup]],
44
45
            ['createObjectState', [$objectStateGroup, $objectStateCreateStruct]],
46
            ['updateObjectState', [$objectState, $objectStateUpdateStruct]],
47
            ['setPriorityOfObjectState', [$objectState, 4]],
48
            ['deleteObjectState', [$objectState]],
49
50
            ['setContentState', [$contentInfo, $objectStateGroup, $objectState]],
51
            ['getContentState', [$contentInfo, $objectStateGroup]],
52
            ['getContentCount', [$objectState]],
53
54
            ['newObjectStateGroupCreateStruct', ['locker']],
55
            ['newObjectStateGroupUpdateStruct', []],
56
            ['newObjectStateCreateStruct', ['locked']],
57
            ['newObjectStateUpdateStruct', []],
58
        ];
59
    }
60
61
    public function providerForLanguagesLookupMethods()
62
    {
63
        $objectStateGroup = new ObjectStateGroup();
64
65
        // string $method, array $arguments, bool $return, int $languageArgumentIndex
66
        return [
67
            ['loadObjectStateGroup', [11, self::LANG_ARG], true, 1],
68
            ['loadObjectStateGroups', [50, 50, self::LANG_ARG], true, 2],
69
            ['loadObjectStates', [$objectStateGroup, self::LANG_ARG], true, 1],
70
            ['loadObjectState', [3, self::LANG_ARG], true, 1],
71
        ];
72
    }
73
}
74