Passed
Push — master ( be27ff...1fe5d2 )
by Tomasz
02:22
created

UseCaseSpec   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_initializable() 0 4 1
A it_should_handle_command() 0 11 1
1
<?php
2
3
namespace spec\Hexarchium\CoreDomain\UseCase\CreateModel;
4
5
use Hexarchium\CoreDomain\Model\Domain\DomainId;
6
use Hexarchium\CoreDomain\Model\Domain\Repository\DomainRepositoryInterface;
7
use Hexarchium\CoreDomain\UseCase\CreateModel\Command;
8
use Hexarchium\CoreDomain\UseCase\CreateModel\UseCase;
9
use PhpSpec\ObjectBehavior;
10
use Prophecy\Argument;
11
12
class UseCaseSpec extends ObjectBehavior
13
{
14
    function let(DomainRepositoryInterface $domainRepository)
15
    {
16
        $this->beConstructedWith($domainRepository);
17
    }
18
19
    function it_is_initializable()
20
    {
21
        $this->shouldHaveType(UseCase::class);
22
    }
23
24
    function it_should_handle_command(DomainRepositoryInterface $domainRepository, Command $command)
25
    {
26
        /** @var DomainId $domainId */
27
        $domainId = Argument::type(DomainId::class);
28
        $domainRepository->getById($domainId)->shouldBeCalled();
29
        $this->beConstructedWith($domainRepository);
30
31
        $command->getDomainId()->shouldBeCalled();
32
        $command->getModelId()->shouldBeCalled();
33
        $this->handle($command)->shouldReturn(null);
34
    }
35
}
36