Files
portal/app/tests/Unit/Autopodbor/Agent/FakeFetcher.php
T
2026-06-30 10:42:04 +03:00

32 lines
758 B
PHP

<?php
declare(strict_types=1);
namespace Tests\Unit\Autopodbor\Agent;
use App\Services\Autopodbor\Agent\Fetch\DirectoryCard;
use App\Services\Autopodbor\Agent\Fetch\FetchedSite;
use App\Services\Autopodbor\Agent\Fetch\Fetcher;
final class FakeFetcher implements Fetcher
{
/**
* @param array<string,FetchedSite> $sites
* @param array<string,list<DirectoryCard>> $cards
*/
public function __construct(
private array $sites = [],
private array $cards = [],
) {}
public function site(string $url): FetchedSite
{
return $this->sites[$url] ?? new FetchedSite(url: $url, rawHtml: '');
}
public function directory(string $url): array
{
return $this->cards[$url] ?? [];
}
}