Completed
Push — master ( 2a0b01...28b040 )
by Tomasz
02:38
created

UseCaseAddedSpec   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 8 8 1
A it_is_initializable() 5 5 1
A it_should_contain_payload_as_array() 4 4 1
A it_should_contain_model_id() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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\UseCase;
8
use Hexarchium\CoreDomain\Model\Domain\Events\UseCaseAdded;
9
use Hexarchium\CoreDomain\Model\Domain\UseCase\UseCaseId;
10
use PhpSpec\ObjectBehavior;
11
12 View Code Duplication
class UseCaseAddedSpec extends ObjectBehavior
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
{
14
    function let(UseCase $model)
15
    {
16
        $modelId = new UseCaseId(
17
            new DomainId('DomainId'), 'UseCaseId'
18
        );
19
        $model->getId()->willReturn($modelId);
20
        $this->beConstructedWith(new \DateTime(), $model);
21
    }
22
23
    function it_is_initializable()
24
    {
25
        $this->shouldHaveType(UseCaseAdded::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('use_case.id', 'UseCaseId');
37
    }
38
}
39