Completed
Pull Request — master (#366)
by Beñat
06:07
created

StoredEventSpec::it_can_be_created()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 3
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\SharedKernel\Event;
16
17
use Kreta\SharedKernel\Domain\Model\DomainEvent;
18
use Kreta\SharedKernel\Event\StoredEvent;
19
use Kreta\SharedKernel\Event\StreamName;
20
use PhpSpec\ObjectBehavior;
21
22
class StoredEventSpec extends ObjectBehavior
23
{
24
    function it_can_be_created(StreamName $name, DomainEvent $event, \DateTimeImmutable $occurredOn)
25
    {
26
        $this->beConstructedWith(1, $name, $event);
27
        $this->shouldHaveType(StoredEvent::class);
28
        $this->shouldImplement(DomainEvent::class);
29
30
        $name->name()->shouldBeCalled()->willReturn('user-1234567890');
31
        $event->occurredOn()->shouldBeCalled()->willReturn($occurredOn);
32
33
        $this->order()->shouldReturn(1);
34
        $this->name()->shouldReturn('1@user-1234567890');
35
        $this->occurredOn()->shouldReturn($occurredOn);
36
        $this->event()->shouldReturn($event);
37
    }
38
}
39