test nonexistant parent node id throws exception

This commit is contained in:
Yisroel Baum 2026-02-21 22:23:30 +02:00
parent 021a2a6f15
commit 143a4ffe39
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
2 changed files with 20 additions and 4 deletions

View file

@ -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,
));
}
}