test that create node validates existing text

This commit is contained in:
Yisroel Baum 2026-02-21 21:08:17 +02:00
parent ba65f8fa42
commit 3b79417065
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

View file

@ -8,6 +8,7 @@ use App\Node\UseCases\CreateNode;
use App\Node\UseCases\CreateNodeRequest; use App\Node\UseCases\CreateNodeRequest;
use App\Text\CreateTextDto; use App\Text\CreateTextDto;
use App\Text\Text; use App\Text\Text;
use DomainException;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Tests\Fakes\FakeNodeRepository; use Tests\Fakes\FakeNodeRepository;
use Tests\Fakes\FakeTextRepository; use Tests\Fakes\FakeTextRepository;
@ -50,4 +51,13 @@ class CreateNodeTest extends TestCase
)); ));
$this->assertInstanceOf(Text::class, $node->getText()); $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',
));
}
} }