ModelAddedSpec   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 25
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 6 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\Entity\Model;
7
use Hexarchium\CoreDomain\Model\Domain\Events\ModelAdded;
8
use Hexarchium\CoreDomain\Model\Domain\Model\ModelId;
9
use PhpSpec\ObjectBehavior;
10
11
class ModelAddedSpec extends ObjectBehavior
12
{
13
    function let(Model $model)
14
    {
15
        $modelId = new ModelId('ModelId');
16
        $model->getId()->willReturn($modelId);
17
        $this->beConstructedWith(new \DateTime(), $model);
18
    }
19
20
    function it_is_initializable()
21
    {
22
        $this->shouldHaveType(ModelAdded::class);
23
        $this->shouldBeAnInstanceOf(DomainEventInterface::class);
24
    }
25
26
    function it_should_contain_payload_as_array()
27
    {
28
        $this->getPayload()->shouldBeArray();
29
    }
30
31
    function it_should_contain_model_id()
32
    {
33
        $this->getPayload()->shouldHaveKeyWithValue('model.id', 'ModelId');
34
    }
35
}
36