feat: Renommage de GetManga à GetMangaById + ajout de axios

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-02-12 16:41:11 +01:00
parent 666636e5bf
commit 504c62c155
6 changed files with 34 additions and 26 deletions

View File

@@ -2,8 +2,8 @@
namespace App\Tests\Domain\Manga\Application\QueryHandler;
use App\Domain\Manga\Application\Query\GetManga;
use App\Domain\Manga\Application\QueryHandler\GetMangaHandler;
use App\Domain\Manga\Application\Query\GetMangaById;
use App\Domain\Manga\Application\QueryHandler\GetMangaByIdHandler;
use App\Domain\Manga\Domain\Exception\MangaNotFoundException;
use App\Domain\Manga\Domain\Model\Manga;
use App\Domain\Manga\Domain\Model\ValueObject\ExternalId;
@@ -13,22 +13,22 @@ use App\Domain\Manga\Domain\Model\ValueObject\MangaTitle;
use App\Tests\Domain\Manga\Adapter\InMemoryMangaRepository;
use PHPUnit\Framework\TestCase;
class GetMangaHandlerTest extends TestCase
class GetMangaByIdHandlerTest extends TestCase
{
private InMemoryMangaRepository $repository;
private GetMangaHandler $handler;
private GetMangaByIdHandler $handler;
protected function setUp(): void
{
$this->repository = new InMemoryMangaRepository();
$this->handler = new GetMangaHandler($this->repository);
$this->handler = new GetMangaByIdHandler($this->repository);
}
public function testHandleThrowsExceptionWhenMangaNotFound(): void
{
$this->expectException(MangaNotFoundException::class);
$query = new GetManga('non-existent-id');
$query = new GetMangaById('non-existent-id');
$this->handler->handle($query);
}
@@ -51,7 +51,7 @@ class GetMangaHandlerTest extends TestCase
$this->repository->save($manga);
// Act
$query = new GetManga('123');
$query = new GetMangaById('123');
$response = $this->handler->handle($query);
// Assert
@@ -72,4 +72,4 @@ class GetMangaHandlerTest extends TestCase
{
$this->repository->clear();
}
}
}