feat: ajout de la gestion des URL d'image et de miniature dans les réponses des mangas, avec mise à jour des classes et des tests associés

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-03-28 15:05:13 +01:00
parent 6ea24deacf
commit 7051bf5274
9 changed files with 50 additions and 29 deletions

View File

@@ -63,10 +63,12 @@ class SearchMangaTest extends AbstractApiTestCase
// Then
$this->assertResponseIsSuccessful();
$data = $response->toArray();
$this->assertCount(2, $data['items']);
$titles = array_map(fn($item) => $item['title'], $data['items']);
$this->assertCount(2, $data['items']['hydra:member']);
$titles = array_map(fn($item) => $item['title'], $data['items']['hydra:member']);
$this->assertContains('One Piece', $titles);
$this->assertContains('One Punch Man', $titles);
}
@@ -88,10 +90,10 @@ class SearchMangaTest extends AbstractApiTestCase
// Then
$this->assertResponseIsSuccessful();
$data = $response->toArray();
$this->assertCount(1, $data['items']);
$this->assertEquals('Dragon Ball', $data['items'][0]['title']);
$this->assertEquals('dragon-ball', $data['items'][0]['slug']);
$this->assertCount(1, $data['items']['hydra:member']);
$this->assertEquals('Dragon Ball', $data['items']['hydra:member'][0]['title']);
$this->assertEquals('dragon-ball', $data['items']['hydra:member'][0]['slug']);
}
// public function testSearchMangaWithPagination(): void
@@ -114,7 +116,7 @@ class SearchMangaTest extends AbstractApiTestCase
// // Then
// $this->assertResponseIsSuccessful();
// $data = $response->toArray();
// $this->assertCount(1, $data['items']);
// $this->assertTrue($data['hasNextPage']);
// $this->assertTrue($data['hasPreviousPage']);
@@ -131,9 +133,12 @@ class SearchMangaTest extends AbstractApiTestCase
->setGenres(['action'])
->setStatus('ongoing')
->setRating(4.5)
->setMonitored(false);
->setMonitored(false)
->setImageUrl('https://via.placeholder.com/150')
->setThumbnailUrl('https://via.placeholder.com/150')
->setCreatedAt(new \DateTimeImmutable('2020-01-01'));
$this->entityManager->persist($manga);
$this->entityManager->flush();
}
}
}