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

ModelAddedSpec   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
lcom 0
cbo 4
dl 0
loc 27
rs 10
c 1
b 0
f 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 8 1
A it_is_initializable() 0 5 1
A it_should_contain_payload_as_array() 0 4 1
A it_should_contain_model_id() 0 4 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