1d124afb76
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
32 lines
758 B
PHP
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] ?? [];
|
|
}
|
|
}
|