Passed
Push — master ( 7b7e33...6ff579 )
by Tomasz
04:38
created

ModelAddedSpec::let()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 8
rs 9.4285
c 1
b 0
f 1
cc 1
eloc 5
nc 1
nop 1
1
<?php
2
3
namespace spec\Hexarchium\CoreDomain\Model\Domain\Events;
4
5
use Hexarchium\CoreDomain\Events\DomainEventInterface;
6
use Hexarchium\CoreDomain\Model\Domain\DomainId;
7
use Hexarchium\CoreDomain\Model\Domain\Entity\Model;
8
use Hexarchium\CoreDomain\Model\Domain\Events\ModelAdded;
9
use Hexarchium\CoreDomain\Model\Domain\Model\ModelId;
10
use PhpSpec\ObjectBehavior;
11
12
class ModelAddedSpec extends ObjectBehavior
13
{
14
    function let(Model $model)
15
    {
16
        $modelId = new ModelId(
17
            new DomainId('DomainId'), 'ModelId'
18
        );
19
        $model->getId()->willReturn($modelId);
20
        $this->beConstructedWith(new \DateTime(), $model);
21
    }
22
23
    function it_is_initializable()
24
    {
25
        $this->shouldHaveType(ModelAdded::class);
26
        $this->shouldBeAnInstanceOf(DomainEventInterface::class);
27
    }
28
29
    function it_should_contain_payload_as_array()
30
    {
31
        $this->getPayload()->shouldBeArray();
32
    }
33
34
    function it_should_contain_model_id()
35
    {
36
        $this->getPayload()->shouldHaveKeyWithValue('model.id', 'ModelId');
37
    }
38
}
39