Completed
Push — master ( 7fe5eb...9bad48 )
by Beñat
08:54 queued 04:27
created

ViewUserNotificationsSpec   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 5
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A it_can_be_search() 0 18 1
1
<?php
2
3
/*
4
 * This file is part of the Kreta package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
declare(strict_types=1);
14
15
namespace Spec\Kreta\Notifier\Application\Inbox\Notification;
16
17
use Kreta\Notifier\Application\Inbox\Notification\ViewUserNotifications;
18
use Kreta\Notifier\Application\Inbox\Notification\ViewUserNotificationsQuery;
19
use Kreta\Notifier\Domain\ReadModel\Inbox\Notification\NotificationSpecificationFactory;
20
use Kreta\Notifier\Domain\ReadModel\Inbox\Notification\NotificationView;
21
use PhpSpec\ObjectBehavior;
22
use Prophecy\Argument;
23
24
class ViewUserNotificationsSpec extends ObjectBehavior
25
{
26
    function it_can_be_search(
27
        NotificationView $view,
28
        NotificationSpecificationFactory $specificationFactory,
29
        ViewUserNotificationsQuery $query
30
    ) {
31
        $this->beConstructedWith($view, $specificationFactory);
32
        $this->shouldHaveType(ViewUserNotifications::class);
33
34
        $query->userId()->shouldBeCalled()->willReturn('user-id');
35
        $query->limit()->shouldBeCalled()->willReturn(50);
36
        $query->offset()->shouldBeCalled()->willReturn(0);
37
        $query->status()->shouldBeCalled()->willReturn('read');
38
39
        $specificationFactory->createNotificationsOfUser('user-id', 0, 50, 'read')->shouldBeCalled();
40
        $view->search(Argument::any())->shouldBeCalled()->willReturn([]);
41
42
        $this->__invoke($query)->shouldBeArray();
43
    }
44
}
45