|
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\Organization; |
|
16
|
|
|
|
|
17
|
|
|
use Kreta\TaskManager\Domain\Model\Organization\Member; |
|
18
|
|
|
use Kreta\TaskManager\Domain\Model\Organization\MemberId; |
|
19
|
|
|
use Kreta\TaskManager\Domain\Model\Organization\Organization; |
|
20
|
|
|
use Kreta\TaskManager\Domain\Model\User\UserId; |
|
21
|
|
|
use Kreta\TaskManager\Tests\Double\Domain\Model\Organization\MemberStub; |
|
22
|
|
|
use PhpSpec\ObjectBehavior; |
|
23
|
|
|
|
|
24
|
|
|
class MemberSpec extends ObjectBehavior |
|
25
|
|
|
{ |
|
26
|
|
|
function let(MemberId $id, UserId $userId, Organization $organization) |
|
27
|
|
|
{ |
|
28
|
|
|
$this->beAnInstanceOf(MemberStub::class); |
|
29
|
|
|
$id->id()->willReturn('member-id'); |
|
30
|
|
|
$this->beConstructedWith($id, $userId, $organization); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
function it_can_be_created() |
|
34
|
|
|
{ |
|
35
|
|
|
$this->shouldHaveType(Member::class); |
|
36
|
|
|
$this->id()->shouldReturnAnInstanceOf(MemberId::class); |
|
37
|
|
|
$this->userId()->shouldReturnAnInstanceOf(UserId::class); |
|
38
|
|
|
$this->organization()->shouldReturnAnInstanceOf(Organization::class); |
|
39
|
|
|
$this->createdOn()->shouldReturnAnInstanceOf(\DateTimeImmutable::class); |
|
40
|
|
|
$this->updatedOn()->shouldReturnAnInstanceOf(\DateTimeImmutable::class); |
|
41
|
|
|
$this->__toString()->shouldReturn('member-id'); |
|
42
|
|
|
} |
|
43
|
|
|
} |
|
44
|
|
|
|