Files
Mangarr/tests/Domain/Scraping/Adapter/InMemoryScraperAdapter.php
2025-02-07 11:56:51 +01:00

30 lines
686 B
PHP

<?php
namespace App\Tests\Domain\Scraping\Adapter;
use App\Domain\Scraping\Domain\Contract\Service\ScraperInterface;
use App\Domain\Scraping\Domain\Model\ScrapingJob;
use Ramsey\Uuid\Uuid;
class InMemoryScraperAdapter implements ScraperInterface
{
private ?\Exception $shouldThrowException = null;
public function scrape(ScrapingJob $job): void
{
if ($this->shouldThrowException) {
throw $this->shouldThrowException;
}
}
public function simulateError(\Exception $exception): void
{
$this->shouldThrowException = $exception;
}
public function supports(string $sourceType): bool
{
return true;
}
}