From 3b79417065244dca7447d3e01d3ba867bba5706a Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Sat, 21 Feb 2026 21:08:17 +0200 Subject: [PATCH] test that create node validates existing text --- tests/Unit/Node/UseCases/CreateNodeTest.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/Unit/Node/UseCases/CreateNodeTest.php b/tests/Unit/Node/UseCases/CreateNodeTest.php index b53dc24..61c5386 100644 --- a/tests/Unit/Node/UseCases/CreateNodeTest.php +++ b/tests/Unit/Node/UseCases/CreateNodeTest.php @@ -8,6 +8,7 @@ use App\Node\UseCases\CreateNode; use App\Node\UseCases\CreateNodeRequest; use App\Text\CreateTextDto; use App\Text\Text; +use DomainException; use PHPUnit\Framework\TestCase; use Tests\Fakes\FakeNodeRepository; use Tests\Fakes\FakeTextRepository; @@ -50,4 +51,13 @@ class CreateNodeTest extends TestCase )); $this->assertInstanceOf(Text::class, $node->getText()); } + + public function test_throws_if_text_doesnt_exist(): void + { + $this->expectException(DomainException::class); + $node = $this->useCase->execute(new CreateNodeRequest( + textId: 1, + title: 'test', + )); + } }