test that create node validates existing text
This commit is contained in:
parent
ba65f8fa42
commit
3b79417065
1 changed files with 10 additions and 0 deletions
|
|
@ -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',
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue