Completed
Pull Request — master (#125)
by Gorka
02:29
created

ProjectSpec   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
lcom 0
cbo 2
dl 0
loc 34
rs 10
c 1
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 5 1
A it_is_initializable() 0 4 1
A it_has_an_id() 0 5 1
A it_has_a_creation_date() 0 4 1
A it_has_a_name() 0 4 1
A it_has_a_slug() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Kreta package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Spec\Kreta\TaskManager\Domain\Model\Project;
14
15
use Kreta\SharedKernel\Domain\Model\Identity\Slug;
16
use Kreta\TaskManager\Domain\Model\Project\Project;
17
use Kreta\TaskManager\Domain\Model\Project\ProjectId;
18
use Kreta\TaskManager\Domain\Model\Project\ProjectName;
19
use PhpSpec\ObjectBehavior;
20
21
class ProjectSpec extends ObjectBehavior
22
{
23
    function let(ProjectId $projectId, ProjectName $projectName, Slug $projectSlug)
24
    {
25
        $projectId->id()->willReturn('project-id');
26
        $this->beConstructedWith($projectId, $projectName, $projectSlug);
27
    }
28
29
    function it_is_initializable()
30
    {
31
        $this->shouldHaveType(Project::class);
32
    }
33
34
    function it_has_an_id(ProjectId $projectId)
35
    {
36
        $this->id()->shouldReturn($projectId);
37
        $this->__toString()->shouldReturn('project-id');
38
    }
39
40
    function it_has_a_creation_date()
41
    {
42
        $this->createdOn()->shouldReturnAnInstanceOf(\DateTimeImmutable::class);
43
    }
44
45
    function it_has_a_name(ProjectName $projectName)
46
    {
47
        $this->name()->shouldReturn($projectName);
48
    }
49
50
    function it_has_a_slug(Slug $projectSlug)
51
    {
52
        $this->slug()->shouldReturn($projectSlug);
53
    }
54
}
55