test that node is created
This commit is contained in:
parent
0998c70160
commit
dce04278ea
1 changed files with 25 additions and 0 deletions
25
tests/Unit/Node/UseCases/CreateNodeTest.php
Normal file
25
tests/Unit/Node/UseCases/CreateNodeTest.php
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Unit\Node\UseCases;
|
||||||
|
|
||||||
|
use App\Node\Node;
|
||||||
|
use App\Node\NodeRepository;
|
||||||
|
use App\Node\UseCases\CreateNode;
|
||||||
|
use App\Node\UseCases\CreateNodeRequest;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use Tests\Fakes\FakeNodeRepository;
|
||||||
|
|
||||||
|
class CreateNodeTest extends TestCase
|
||||||
|
{
|
||||||
|
public function test_create_node(): void
|
||||||
|
{
|
||||||
|
$nodeRepo = new FakeNodeRepository;
|
||||||
|
$useCase = new CreateNode($nodeRepo);
|
||||||
|
$node = $useCase->execute(new CreateNodeRequest(
|
||||||
|
title: 'test',
|
||||||
|
));
|
||||||
|
$this->assertInstanceOf(NodeRepository::class, $nodeRepo);
|
||||||
|
$this->assertInstanceOf(Node::class, $node);
|
||||||
|
$this->assertEquals('test', $node->getTitle());
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue