| @@ 24-60 (lines=37) @@ | ||
| 21 | use Kreta\TaskManager\Domain\Model\Organization\OrganizationName; |
|
| 22 | use PhpSpec\ObjectBehavior; |
|
| 23 | ||
| 24 | class OrganizationCreatedSpec extends ObjectBehavior |
|
| 25 | { |
|
| 26 | function let(OrganizationId $organizationId, OrganizationName $name, Slug $slug) |
|
| 27 | { |
|
| 28 | $this->beConstructedWith($organizationId, $name, $slug); |
|
| 29 | } |
|
| 30 | ||
| 31 | function it_is_initializable() |
|
| 32 | { |
|
| 33 | $this->shouldHaveType(OrganizationCreated::class); |
|
| 34 | } |
|
| 35 | ||
| 36 | function it_implements_domain_event() |
|
| 37 | { |
|
| 38 | $this->shouldImplement(DomainEvent::class); |
|
| 39 | } |
|
| 40 | ||
| 41 | function it_get_occurred_on() |
|
| 42 | { |
|
| 43 | $this->occurredOn()->shouldReturnAnInstanceOf(\DateTimeInterface::class); |
|
| 44 | } |
|
| 45 | ||
| 46 | function it_gets_organization_id(OrganizationId $organizationId) |
|
| 47 | { |
|
| 48 | $this->organizationId()->shouldReturn($organizationId); |
|
| 49 | } |
|
| 50 | ||
| 51 | function it_gets_organization_name(OrganizationName $name) |
|
| 52 | { |
|
| 53 | $this->organizationName()->shouldReturn($name); |
|
| 54 | } |
|
| 55 | ||
| 56 | function it_gets_organization_slug(Slug $slug) |
|
| 57 | { |
|
| 58 | $this->organizationSlug()->shouldReturn($slug); |
|
| 59 | } |
|
| 60 | } |
|
| 61 | ||
| @@ 24-44 (lines=21) @@ | ||
| 21 | use Kreta\TaskManager\Domain\Model\Organization\OrganizationName; |
|
| 22 | use PhpSpec\ObjectBehavior; |
|
| 23 | ||
| 24 | class OrganizationEditedSpec extends ObjectBehavior |
|
| 25 | { |
|
| 26 | function let(OrganizationId $id, OrganizationName $name, Slug $slug) |
|
| 27 | { |
|
| 28 | $this->beConstructedWith($id, $name, $slug); |
|
| 29 | } |
|
| 30 | ||
| 31 | function it_is_initializable() |
|
| 32 | { |
|
| 33 | $this->shouldHaveType(OrganizationEdited::class); |
|
| 34 | $this->shouldImplement(DomainEvent::class); |
|
| 35 | } |
|
| 36 | ||
| 37 | function it_creates_a_organization_edited_event(OrganizationId $id, OrganizationName $name, Slug $slug) |
|
| 38 | { |
|
| 39 | $this->id()->shouldReturn($id); |
|
| 40 | $this->name()->shouldReturn($name); |
|
| 41 | $this->slug()->shouldReturn($slug); |
|
| 42 | $this->occurredOn()->shouldReturnAnInstanceOf(\DateTimeInterface::class); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||
| @@ 24-44 (lines=21) @@ | ||
| 21 | use Kreta\TaskManager\Domain\Model\User\UserId; |
|
| 22 | use PhpSpec\ObjectBehavior; |
|
| 23 | ||
| 24 | class OrganizationMemberAddedSpec extends ObjectBehavior |
|
| 25 | { |
|
| 26 | function let(OrganizationMemberId $memberId, UserId $userId, OrganizationId $organizationId) |
|
| 27 | { |
|
| 28 | $this->beConstructedWith($memberId, $userId, $organizationId); |
|
| 29 | } |
|
| 30 | ||
| 31 | function it_is_initializable() |
|
| 32 | { |
|
| 33 | $this->shouldHaveType(OrganizationMemberAdded::class); |
|
| 34 | $this->shouldImplement(DomainEvent::class); |
|
| 35 | } |
|
| 36 | ||
| 37 | function it_can_be_created(OrganizationMemberId $memberId, UserId $userId, OrganizationId $organizationId) |
|
| 38 | { |
|
| 39 | $this->occurredOn()->shouldReturnAnInstanceOf(\DateTimeInterface::class); |
|
| 40 | $this->organizationId()->shouldReturn($organizationId); |
|
| 41 | $this->organizationMemberId()->shouldReturn($memberId); |
|
| 42 | $this->userId()->shouldReturn($userId); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||
| @@ 24-44 (lines=21) @@ | ||
| 21 | use Kreta\TaskManager\Domain\Model\User\UserId; |
|
| 22 | use PhpSpec\ObjectBehavior; |
|
| 23 | ||
| 24 | class OwnerAddedSpec extends ObjectBehavior |
|
| 25 | { |
|
| 26 | function let(OwnerId $ownerId, UserId $userId, OrganizationId $organizationId) |
|
| 27 | { |
|
| 28 | $this->beConstructedWith($ownerId, $userId, $organizationId); |
|
| 29 | } |
|
| 30 | ||
| 31 | function it_is_initializable() |
|
| 32 | { |
|
| 33 | $this->shouldHaveType(OwnerAdded::class); |
|
| 34 | $this->shouldImplement(DomainEvent::class); |
|
| 35 | } |
|
| 36 | ||
| 37 | function it_can_be_created(OwnerId $ownerId, UserId $userId, OrganizationId $organizationId) |
|
| 38 | { |
|
| 39 | $this->occurredOn()->shouldReturnAnInstanceOf(\DateTimeInterface::class); |
|
| 40 | $this->organizationId()->shouldReturn($organizationId); |
|
| 41 | $this->ownerId()->shouldReturn($ownerId); |
|
| 42 | $this->userId()->shouldReturn($userId); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||