Completed
Push — master ( 460dcb...effb4b )
by Gorka
06:40
created

ProjectAlreadyExistsSpec::let()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 5
Ratio 100 %

Importance

Changes 0
Metric Value
dl 5
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 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
declare(strict_types=1);
14
15
namespace Spec\Kreta\TaskManager\Domain\Model\Project;
16
17
use Kreta\SharedKernel\Domain\Model\Exception;
18
use Kreta\SharedKernel\Domain\Model\Identity\Slug;
19
use Kreta\TaskManager\Domain\Model\Project\ProjectAlreadyExists;
20
use Kreta\TaskManager\Domain\Model\Project\ProjectId;
21
use PhpSpec\ObjectBehavior;
22
23
class ProjectAlreadyExistsSpec extends ObjectBehavior
24
{
25
    function it_is_initializable()
26
    {
27
        $this->shouldHaveType(ProjectAlreadyExists::class);
28
        $this->shouldHaveType(Exception::class);
29
    }
30
31
    function it_can_be_created_from_id(ProjectId $projectId)
32
    {
33
        $projectId->id()->willReturn('project-id');
34
        $this->beConstructedFromId($projectId);
35
        $this->getMessage()->shouldReturn('Project with "project-id" id already exists');
36
    }
37
38
    function it_can_be_created_from_slugs(Slug $slug, Slug $organizationSlug)
39
    {
40
        $slug->slug()->willReturn('slug');
41
        $organizationSlug->slug()->willReturn('organization-slug');
42
        $this->beConstructedFromSlugs($slug, $organizationSlug);
43
        $this->getMessage()->shouldReturn(
44
            'Project with "slug" slug and "organization-slug" organization\'s slug already exists'
45
        );
46
    }
47
}
48