Completed
Push — master ( c1cd82...4c112d )
by Gorka
03:17
created

MemberIdSpec::it_generates()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A MemberIdSpec::it_renders_to_string() 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\Organization;
14
15
use Kreta\TaskManager\Domain\Model\Organization\MemberId;
16
use Kreta\TaskManager\Domain\Model\Organization\OrganizationId;
17
use Kreta\TaskManager\Domain\Model\User\UserId;
18
use PhpSpec\ObjectBehavior;
19
20
class MemberIdSpec extends ObjectBehavior
21
{
22
    function let(UserId $userId, OrganizationId $organizationId)
23
    {
24
        $userId->id()->willReturn('user-id');
25
        $organizationId->id()->willReturn('organization-id');
26
        $this->beConstructedGenerate($userId, $organizationId);
27
    }
28
29
    function it_is_initializable()
30
    {
31
        $this->shouldHaveType(MemberId::class);
32
    }
33
34
    function it_renders_to_string()
35
    {
36
        $this->__toString()->shouldReturn('UserId: user-id, OrganizationId: organization-id');
37
    }
38
39
    function it_compares_two_ids_that_are_not_equal(MemberId $memberId, UserId $userId2, OrganizationId $organizationId)
40
    {
41
        $memberId->organizationId()->shouldBeCalled()->willReturn($organizationId);
42
        $memberId->userId()->shouldBeCalled()->willReturn($userId2);
43
        $this->equals($memberId)->shouldReturn(false);
44
    }
45
46
    function it_compares_two_ids_that_do_not_have_same_organization_id(MemberId $memberId, OrganizationId $organizationId2)
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 123 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
47
    {
48
        $memberId->organizationId()->shouldBeCalled()->willReturn($organizationId2);
49
        $this->equals($memberId)->shouldReturn(false);
50
    }
51
52
    function it_compares_two_ids_that_are_equals(MemberId $memberId, UserId $userId, OrganizationId $organizationId)
53
    {
54
        $memberId->organizationId()->shouldBeCalled()->willReturn($organizationId);
55
        $memberId->userId()->shouldBeCalled()->willReturn($userId);
56
        $this->equals($memberId)->shouldReturn(true);
57
    }
58
}
59