feat: scraping endpoints, job persistence, firsts unit tests, legacy entities usage
This commit is contained in:
parent
c55cd62ec7
commit
0374ab0e46
@@ -8,21 +8,8 @@ use Ramsey\Uuid\Uuid;
|
||||
|
||||
class InMemoryScraperAdapter implements ScraperInterface
|
||||
{
|
||||
private array $jobs = [];
|
||||
private ?\Exception $shouldThrowException = null;
|
||||
|
||||
public function createScrapingJob(string $mangaId, string $chapterId, string $sourceId): ScrapingJob
|
||||
{
|
||||
if ($this->shouldThrowException) {
|
||||
throw $this->shouldThrowException;
|
||||
}
|
||||
|
||||
$job = new ScrapingJob(Uuid::uuid4(), $mangaId, $chapterId, $sourceId);
|
||||
$this->jobs[] = $job;
|
||||
|
||||
return $job;
|
||||
}
|
||||
|
||||
public function scrape(ScrapingJob $job): void
|
||||
{
|
||||
if ($this->shouldThrowException) {
|
||||
@@ -35,11 +22,6 @@ class InMemoryScraperAdapter implements ScraperInterface
|
||||
$this->shouldThrowException = $exception;
|
||||
}
|
||||
|
||||
public function getJobs(): array
|
||||
{
|
||||
return $this->jobs;
|
||||
}
|
||||
|
||||
public function supports(string $sourceType): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user