insertGetId([ 'source_url' => 'https://rossvyaz.gov.ru/test', 'checksum_sha256' => str_repeat('c', 64), 'status' => 'completed', 'imported_at' => now(), ]); DB::table('phone_ranges')->insert([ 'def_code' => 391, 'from_num' => 2000000, 'to_num' => 2999999, 'operator' => 'Ростелеком', 'region' => 'Красноярский край', 'subject_code' => 24, 'imported_at' => now(), 'import_id' => $importId, ]); } /** Fetcher, отдающий фиксированный HTML. */ function openerFetcher(string $html): Fetcher { return new class($html) implements Fetcher { public function __construct(private string $html) {} public function site(string $url): FetchedSite { return new FetchedSite($url, $this->html); } public function directory(string $url): array { return []; } }; } it('глубокий путь: мусорный номер (код вне реестра) не попадает в numbers', function (): void { seedOpenerRange(); // есть только 391 2000000..2999999 // Настоящий 73912920000 (391) + мусор 76132306130 (код 613, вне реестра). $html = 'звонок' .' +7 613 230 61 30'; $r = (new SiteOpener(openerFetcher($html)))->open('kraslombard24.ru', '391'); $numbers = collect($r->numbers)->pluck('number'); expect($numbers)->toContain('73912920000') ->and($numbers)->not->toContain('76132306130'); });