|
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
|
|
|
|