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
@@ -3,24 +3,23 @@
|
||||
namespace App\Tests\Domain\Scraping\Adapter;
|
||||
|
||||
use App\Domain\Scraping\Domain\Contract\Service\ScraperInterface;
|
||||
use App\Domain\Scraping\Domain\Model\ScrapingJob;
|
||||
use App\Domain\Scraping\Domain\Model\ValueObject\CbzPath;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use App\Domain\Scraping\Domain\Model\ValueObject\ScrapingRequest;
|
||||
use App\Domain\Scraping\Domain\Model\ValueObject\ScrapingResult;
|
||||
|
||||
class InMemoryScraperAdapter implements ScraperInterface
|
||||
{
|
||||
private ?\Exception $shouldThrowException = null;
|
||||
|
||||
public function scrape(ScrapingJob $job): ScrapingJob
|
||||
public function scrape(ScrapingRequest $request): ScrapingResult
|
||||
{
|
||||
if ($this->shouldThrowException) {
|
||||
$job->fail($this->shouldThrowException->getMessage());
|
||||
return $job;
|
||||
throw $this->shouldThrowException;
|
||||
}
|
||||
|
||||
$job->complete();
|
||||
$job->cbzPath = new CbzPath('/path/to/test.cbz');
|
||||
return $job;
|
||||
return new ScrapingResult(
|
||||
['http://example.com/image1.jpg', 'http://example.com/image2.jpg'],
|
||||
2
|
||||
);
|
||||
}
|
||||
|
||||
public function simulateError(\Exception $exception): void
|
||||
|
||||
Reference in New Issue
Block a user