Goal-Calibration/tests/Unit/Text/UseCases/CreateTextTest.php

25 lines
695 B
PHP

<?php
namespace Tests\Unit\Text\UseCases;
use App\Text\Text;
use App\Text\TextRepository;
use App\Text\UseCases\CreateText;
use App\Text\UseCases\CreateTextRequest;
use PHPUnit\Framework\TestCase;
use Tests\Fakes\FakeTextRepository;
class CreateTextTest extends TestCase
{
public function test_create_text(): void
{
$textRepo = new FakeTextRepository;
$useCase = new CreateText($textRepo);
$text = $useCase->execute(new CreateTextRequest(
name: 'test',
));
$this->assertInstanceOf(TextRepository::class, $textRepo);
$this->assertInstanceOf(Text::class, $text);
$this->assertEquals('test', $text->getName());
}
}