update text controller test with node repo

This commit is contained in:
Yisroel Baum 2026-04-17 11:01:20 +03:00
parent d4f5b22034
commit 9b24fddec1
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

View file

@ -8,6 +8,7 @@ use App\Text\UseCases\CreateText;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Slim\Psr7\Factory\ServerRequestFactory; use Slim\Psr7\Factory\ServerRequestFactory;
use Slim\Psr7\Response; use Slim\Psr7\Response;
use Tests\Fakes\FakeNodeRepository;
use Tests\Fakes\FakeTextRepository; use Tests\Fakes\FakeTextRepository;
class TextControllerTest extends TestCase class TextControllerTest extends TestCase
@ -22,7 +23,7 @@ class TextControllerTest extends TestCase
$this->textRepo->create(new CreateTextDto( $this->textRepo->create(new CreateTextDto(
name: 'test text', name: 'test text',
)); ));
$this->controller = new TextController($this->textRepo); $this->controller = new TextController($this->textRepo, new FakeNodeRepository);
} }
public function test_get_one_text(): void public function test_get_one_text(): void
@ -70,7 +71,10 @@ class TextControllerTest extends TestCase
$response = $this->controller->createText( $response = $this->controller->createText(
$request, $request,
new Response(), new Response(),
new CreateText($this->textRepo), new CreateText(
$this->textRepo,
new FakeNodeRepository,
),
); );
$this->assertEquals( $this->assertEquals(
json_encode([ json_encode([