Completed
Push — master ( 3b3980...4ce207 )
by Gorka
9s
created

ParticipantSpec::it_is_initializable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
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\SharedKernel\Domain\Model\Identity\EmailAddress;
16
use Kreta\SharedKernel\Domain\Model\Identity\Username;
17
use Kreta\TaskManager\Domain\Model\Organization\OrganizationParticipantId;
18
use Kreta\TaskManager\Domain\Model\Organization\Participant;
19
use Kreta\TaskManager\Tests\Double\Domain\Model\ParticipantStub;
20
use PhpSpec\ObjectBehavior;
21
22
class ParticipantSpec extends ObjectBehavior
23
{
24
    function let(OrganizationParticipantId $id, EmailAddress $email, Username $username)
25
    {
26
        $id->id()->willReturn('organization-participant-id');
27
        $this->beAnInstanceOf(ParticipantStub::class);
28
        $this->beConstructedWith($id, $email, $username);
29
    }
30
31
    function it_is_initializable()
32
    {
33
        $this->shouldHaveType(Participant::class);
34
    }
35
36
    function it_gets_id()
37
    {
38
        $this->id()->shouldReturnAnInstanceOf(OrganizationParticipantId::class);
39
        $this->__toString()->shouldReturn('organization-participant-id');
40
    }
41
42
    function it_gets_email()
43
    {
44
        $this->email()->shouldReturnAnInstanceOf(EmailAddress::class);
45
    }
46
47
    function it_gets_username()
48
    {
49
        $this->username()->shouldReturnAnInstanceOf(Username::class);
50
    }
51
52
    function it_changes_email(EmailAddress $email, EmailAddress $email2)
53
    {
54
        $this->email()->shouldReturn($email);
55
        $this->changeEmail($email2);
56
        $this->email()->shouldReturn($email2);
57
    }
58
59
    function it_changes_username(Username $username, Username $username2)
60
    {
61
        $this->username()->shouldReturn($username);
62
        $this->changeUsername($username2);
63
        $this->username()->shouldReturn($username2);
64
    }
65
}
66