test nonexistant parent node id throws exception
This commit is contained in:
parent
021a2a6f15
commit
143a4ffe39
2 changed files with 20 additions and 4 deletions
|
|
@ -59,6 +59,7 @@ class CreateNodeTest extends TestCase
|
|||
public function test_throws_if_text_doesnt_exist(): void
|
||||
{
|
||||
$this->expectException(DomainException::class);
|
||||
$this->expectExceptionMessage("Text with id: 1 doesnt exist");
|
||||
$node = $this->useCase->execute(new CreateNodeRequest(
|
||||
textId: 1,
|
||||
title: 'test',
|
||||
|
|
@ -83,4 +84,15 @@ class CreateNodeTest extends TestCase
|
|||
$node2->getParentNode()->getId()
|
||||
);
|
||||
}
|
||||
|
||||
public function test_nonexistant_parent_id_throws(): void
|
||||
{
|
||||
$this->expectException(DomainException::class);
|
||||
$this->expectExceptionMessage("Node with id: 0 doesnt exist");
|
||||
$node = $this->useCase->execute(new CreateNodeRequest(
|
||||
textId: 0,
|
||||
title: 'test',
|
||||
parentNodeId: 0,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue