feat: refonte du gestionnaire de chapitres pour intégrer la génération de fichiers CBZ, le téléchargement d'images en lot et la gestion des requêtes de scraping, avec mise à jour des interfaces et des modèles associés
This commit is contained in:
parent
cdee6f77fc
commit
d7088b14c2
43
tests/Domain/Scraping/Adapter/InMemoryMangaRepository.php
Normal file
43
tests/Domain/Scraping/Adapter/InMemoryMangaRepository.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tests\Domain\Scraping\Adapter;
|
||||
|
||||
use App\Domain\Scraping\Domain\Contract\Repository\MangaRepositoryInterface;
|
||||
use App\Domain\Scraping\Domain\Model\Manga;
|
||||
|
||||
class InMemoryMangaRepository implements MangaRepositoryInterface
|
||||
{
|
||||
private array $mangas = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// Ajoute un manga par défaut pour les tests
|
||||
$this->mangas['test-manga'] = new Manga(
|
||||
'test-manga',
|
||||
'Test Manga',
|
||||
'test-manga',
|
||||
'2024',
|
||||
'Test Author',
|
||||
'A test manga description'
|
||||
);
|
||||
}
|
||||
|
||||
public function getById(string $id): Manga
|
||||
{
|
||||
if (!isset($this->mangas[$id])) {
|
||||
throw new \RuntimeException('Manga not found');
|
||||
}
|
||||
|
||||
return $this->mangas[$id];
|
||||
}
|
||||
|
||||
public function save(Manga $manga): void
|
||||
{
|
||||
$this->mangas[$manga->getId()] = $manga;
|
||||
}
|
||||
|
||||
public function clear(): void
|
||||
{
|
||||
$this->mangas = [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user