test and impl that only one root node exists per text

in practice this means only one node with a null parentNode
This commit is contained in:
Yisroel Baum 2026-02-21 22:44:18 +02:00
parent 4f83ae7926
commit d1eb648b73
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
2 changed files with 37 additions and 0 deletions

View file

@ -95,4 +95,20 @@ class CreateNodeTest extends TestCase
parentNodeId: 0,
));
}
public function test_one_root_node_per_text(): void
{
$this->expectException(DomainException::class);
$this->expectExceptionMessage('A root node already exists for this text');
$this->useCase->execute(new CreateNodeRequest(
textId: 0,
title: 'test',
parentNodeId: null,
));
$this->useCase->execute(new CreateNodeRequest(
textId: 0,
title: 'test',
parentNodeId: null,
));
}
}