test that nonexistant text will throw error
This commit is contained in:
parent
c32087c35d
commit
f8a1c2616d
2 changed files with 17 additions and 6 deletions
|
|
@ -43,6 +43,7 @@ class CreatePlanTest extends TestCase
|
|||
scheduledNodeRepo: $this->scheduledNodeRepo,
|
||||
planRepo: $this->planRepo,
|
||||
);
|
||||
$this->textRepo->create(new CreateTextDto('testname'));
|
||||
$this->useCase = new CreatePlan(
|
||||
$this->planRepo,
|
||||
$this->userRepo,
|
||||
|
|
@ -83,11 +84,20 @@ class CreatePlanTest extends TestCase
|
|||
));
|
||||
}
|
||||
|
||||
public function test_nonexistant_text_id_throws(): void
|
||||
{
|
||||
$this->expectException(DomainException::class);
|
||||
$this->expectExceptionMessage("Text with id: 1 doesnt exist");
|
||||
$plan = $this->useCase->execute(new CreatePlanRequest(
|
||||
userId: 0,
|
||||
name: 'testPlan',
|
||||
textId: 1,
|
||||
));
|
||||
}
|
||||
|
||||
public function test_plan_schedules_nodes_on_creation(): void
|
||||
{
|
||||
$text = $this->textRepo->create(new CreateTextDto(
|
||||
name: 'testname',
|
||||
));
|
||||
$text = $this->textRepo->find(0);
|
||||
$this->nodeRepo->create(new CreateNodeDto(
|
||||
text: $text,
|
||||
title: 'testtitle',
|
||||
|
|
@ -103,9 +113,7 @@ class CreatePlanTest extends TestCase
|
|||
|
||||
public function test_plan_only_schedules_nodes_which_arent_parents(): void
|
||||
{
|
||||
$text = $this->textRepo->create(new CreateTextDto(
|
||||
name: 'testname',
|
||||
));
|
||||
$text = $this->textRepo->find(0);
|
||||
$rootNode = $this->nodeRepo->create(new CreateNodeDto(
|
||||
text: $text,
|
||||
title: 'root node',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue