feat: ajout de la fonctionnalité de récupération des chapitres de manga, avec mise à jour de l'API et des composants pour gérer la récupération asynchrone des chapitres, ainsi que des améliorations dans la gestion des erreurs et des tests associés.

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-07-06 16:20:15 +02:00
parent 5a5569cf2c
commit ee2a9b3750
14 changed files with 137 additions and 34 deletions

View File

@@ -31,9 +31,10 @@ class FetchMangaChaptersHandlerTest extends TestCase
public function testHandleWithExistingManga(): void
{
$mangaId = 'manga-id';
$externalId = 'manga-123';
$manga = new Manga(
new MangaId('manga-id'),
new MangaId($mangaId),
new MangaTitle('Test Manga'),
new MangaSlug('test-manga'),
'Description',
@@ -58,7 +59,7 @@ class FetchMangaChaptersHandlerTest extends TestCase
]
]);
$command = new FetchMangaChapters($externalId);
$command = new FetchMangaChapters($mangaId);
$this->handler->handle($command);
$this->assertCount(1, $this->mangaRepository->getSavedChapters());
@@ -66,12 +67,36 @@ class FetchMangaChaptersHandlerTest extends TestCase
public function testHandleWithNonExistingManga(): void
{
$externalId = 'non-existing-manga';
$mangaId = 'non-existing-manga';
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Manga not found');
$command = new FetchMangaChapters($externalId);
$command = new FetchMangaChapters($mangaId);
$this->handler->handle($command);
}
public function testHandleWithMangaWithoutExternalId(): void
{
$mangaId = 'manga-id';
$manga = new Manga(
new MangaId($mangaId),
new MangaTitle('Test Manga'),
new MangaSlug('test-manga'),
'Description',
'Author',
2024,
[],
'ongoing',
null // Pas d'externalId
);
$this->mangaRepository->save($manga);
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Manga has no external ID');
$command = new FetchMangaChapters($mangaId);
$this->handler->handle($command);
}
}