Completed
Push — location_multi_load ( e5e305...41e541 )
by André
51:38 queued 33:21
created

UserPreferenceServiceTest::serviceProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 33

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 33
rs 9.392
c 0
b 0
f 0
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\Core\SignalSlot\Tests;
10
11
use eZ\Publish\API\Repository\UserPreferenceService as APIUserPreferenceService;
12
use eZ\Publish\API\Repository\Values\UserPreference\UserPreferenceSetStruct;
13
use eZ\Publish\API\Repository\Values\UserPreference\UserPreferenceList;
14
use eZ\Publish\Core\SignalSlot\UserPreferenceService;
15
use eZ\Publish\Core\SignalSlot\Signal\UserPreferenceService\UserPreferenceSetSignal;
16
use eZ\Publish\Core\SignalSlot\SignalDispatcher;
17
18
class UserPreferenceServiceTest extends ServiceTest
19
{
20
    public function serviceProvider()
21
    {
22
        $setStruct = new UserPreferenceSetStruct([
23
            'name' => 'timezone',
24
            'value' => 'America/New_York',
25
        ]);
26
27
        return [
28
            [
29
                'loadUserPreferences',
30
                [0, 25],
31
                new UserPreferenceList(),
32
                0,
33
            ],
34
            [
35
                'setUserPreference',
36
                [[$setStruct]],
37
                null,
38
                1,
39
                UserPreferenceSetSignal::class,
40
                [
41
                    'name' => $setStruct->name,
42
                    'value' => $setStruct->value,
43
                ],
44
            ],
45
            [
46
                'getUserPreferenceCount',
47
                [],
48
                10,
49
                0,
50
            ],
51
        ];
52
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57
    protected function getServiceMock()
58
    {
59
        return $this->createMock(APIUserPreferenceService::class);
60
    }
61
62
    /**
63
     * {@inheritdoc}
64
     */
65
    protected function getSignalSlotService($innerService, SignalDispatcher $dispatcher)
66
    {
67
        return new UserPreferenceService($innerService, $dispatcher);
68
    }
69
}
70