TaskManager/tests/Spec/Kreta/TaskManager/Domain/Model/Organization/OrganizationMemberIsAlreadyAnOwnerExceptionSpec.php 1 location
|
@@ 20-38 (lines=19) @@
|
| 17 |
|
use Kreta\TaskManager\Domain\Model\User\UserId; |
| 18 |
|
use PhpSpec\ObjectBehavior; |
| 19 |
|
|
| 20 |
|
class OrganizationMemberIsAlreadyAnOwnerExceptionSpec extends ObjectBehavior |
| 21 |
|
{ |
| 22 |
|
function let(UserId $userId) |
| 23 |
|
{ |
| 24 |
|
$userId->id()->willReturn('user-id'); |
| 25 |
|
$this->beConstructedWith($userId); |
| 26 |
|
} |
| 27 |
|
|
| 28 |
|
function it_is_initializable() |
| 29 |
|
{ |
| 30 |
|
$this->shouldHaveType(OrganizationMemberIsAlreadyAnOwnerException::class); |
| 31 |
|
$this->shouldHaveType(Exception::class); |
| 32 |
|
} |
| 33 |
|
|
| 34 |
|
function it_should_return_message() |
| 35 |
|
{ |
| 36 |
|
$this->getMessage()->shouldReturn('The given user-id user is already an owner'); |
| 37 |
|
} |
| 38 |
|
} |
| 39 |
|
|
TaskManager/tests/Spec/Kreta/TaskManager/Domain/Model/Project/ProjectAlreadyExistsSpec.php 1 location
|
@@ 20-38 (lines=19) @@
|
| 17 |
|
use Kreta\TaskManager\Domain\Model\Project\ProjectId; |
| 18 |
|
use PhpSpec\ObjectBehavior; |
| 19 |
|
|
| 20 |
|
class ProjectAlreadyExistsSpec extends ObjectBehavior |
| 21 |
|
{ |
| 22 |
|
function let(ProjectId $projectId) |
| 23 |
|
{ |
| 24 |
|
$projectId->id()->willReturn('project-id'); |
| 25 |
|
$this->beConstructedWith($projectId); |
| 26 |
|
} |
| 27 |
|
|
| 28 |
|
function it_is_initializable() |
| 29 |
|
{ |
| 30 |
|
$this->shouldHaveType(ProjectAlreadyExists::class); |
| 31 |
|
$this->shouldHaveType(Exception::class); |
| 32 |
|
} |
| 33 |
|
|
| 34 |
|
function it_should_return_message() |
| 35 |
|
{ |
| 36 |
|
$this->getMessage()->shouldReturn('Project with id "project-id" already exists'); |
| 37 |
|
} |
| 38 |
|
} |
| 39 |
|
|
TaskManager/tests/Spec/Kreta/TaskManager/Domain/Model/User/UserSpec.php 1 location
|
@@ 20-35 (lines=16) @@
|
| 17 |
|
use Kreta\TaskManager\Domain\Model\User\UserId; |
| 18 |
|
use PhpSpec\ObjectBehavior; |
| 19 |
|
|
| 20 |
|
class UserSpec extends ObjectBehavior |
| 21 |
|
{ |
| 22 |
|
function let(UserId $id) |
| 23 |
|
{ |
| 24 |
|
$id->id()->willReturn('user-id'); |
| 25 |
|
$this->beConstructedWith($id); |
| 26 |
|
} |
| 27 |
|
|
| 28 |
|
function it_can_be_created() |
| 29 |
|
{ |
| 30 |
|
$this->shouldHaveType(User::class); |
| 31 |
|
$this->shouldHaveType(AggregateRoot::class); |
| 32 |
|
$this->id()->shouldReturnAnInstanceOf(UserId::class); |
| 33 |
|
$this->__toString()->shouldReturn('user-id'); |
| 34 |
|
} |
| 35 |
|
} |
| 36 |
|
|
TaskManager/tests/Spec/Kreta/TaskManager/Domain/Model/Organization/OrganizationMemberDoesNotExistExceptionSpec.php 1 location
|
@@ 20-38 (lines=19) @@
|
| 17 |
|
use Kreta\TaskManager\Domain\Model\User\UserId; |
| 18 |
|
use PhpSpec\ObjectBehavior; |
| 19 |
|
|
| 20 |
|
class OrganizationMemberDoesNotExistExceptionSpec extends ObjectBehavior |
| 21 |
|
{ |
| 22 |
|
function let(UserId $userId) |
| 23 |
|
{ |
| 24 |
|
$this->beConstructedWith($userId); |
| 25 |
|
$userId->id()->shouldBeCalled()->willReturn('user-id'); |
| 26 |
|
} |
| 27 |
|
|
| 28 |
|
function it_is_initializable() |
| 29 |
|
{ |
| 30 |
|
$this->shouldHaveType(OrganizationMemberDoesNotExistException::class); |
| 31 |
|
$this->shouldHaveType(Exception::class); |
| 32 |
|
} |
| 33 |
|
|
| 34 |
|
function it_should_return_message() |
| 35 |
|
{ |
| 36 |
|
$this->getMessage()->shouldReturn('The given user-id user is not an organization member'); |
| 37 |
|
} |
| 38 |
|
} |
| 39 |
|
|
TaskManager/tests/Spec/Kreta/TaskManager/Domain/Model/Organization/OwnerDoesNotExistExceptionSpec.php 1 location
|
@@ 20-38 (lines=19) @@
|
| 17 |
|
use Kreta\TaskManager\Domain\Model\User\UserId; |
| 18 |
|
use PhpSpec\ObjectBehavior; |
| 19 |
|
|
| 20 |
|
class OwnerDoesNotExistExceptionSpec extends ObjectBehavior |
| 21 |
|
{ |
| 22 |
|
function let(UserId $userId) |
| 23 |
|
{ |
| 24 |
|
$this->beConstructedWith($userId); |
| 25 |
|
$userId->id()->shouldBeCalled()->willReturn('user-id'); |
| 26 |
|
} |
| 27 |
|
|
| 28 |
|
function it_is_initializable() |
| 29 |
|
{ |
| 30 |
|
$this->shouldHaveType(OwnerDoesNotExistException::class); |
| 31 |
|
$this->shouldHaveType(Exception::class); |
| 32 |
|
} |
| 33 |
|
|
| 34 |
|
function it_should_return_message() |
| 35 |
|
{ |
| 36 |
|
$this->getMessage()->shouldReturn('The given user-id user is not an owner'); |
| 37 |
|
} |
| 38 |
|
} |
| 39 |
|
|
TaskManager/tests/Spec/Kreta/TaskManager/Domain/Model/User/UserAlreadyExistsExceptionSpec.php 1 location
|
@@ 20-38 (lines=19) @@
|
| 17 |
|
use Kreta\TaskManager\Domain\Model\User\UserId; |
| 18 |
|
use PhpSpec\ObjectBehavior; |
| 19 |
|
|
| 20 |
|
class UserAlreadyExistsExceptionSpec extends ObjectBehavior |
| 21 |
|
{ |
| 22 |
|
function let(UserId $userId) |
| 23 |
|
{ |
| 24 |
|
$this->beConstructedWith($userId); |
| 25 |
|
} |
| 26 |
|
|
| 27 |
|
function it_is_initializable() |
| 28 |
|
{ |
| 29 |
|
$this->shouldHaveType(UserAlreadyExistsException::class); |
| 30 |
|
$this->shouldHaveType(Exception::class); |
| 31 |
|
} |
| 32 |
|
|
| 33 |
|
function it_should_return_message(UserId $userId) |
| 34 |
|
{ |
| 35 |
|
$userId->id()->shouldBeCalled()->willReturn('user-id'); |
| 36 |
|
$this->getMessage()->shouldReturn('Already exists a user with the "user-id" id'); |
| 37 |
|
} |
| 38 |
|
} |
| 39 |
|
|