26 lines
883 B
PHP
26 lines
883 B
PHP
<?php
|
|
|
|
use App\Services\Autopodbor\Agent\Fetch\FetchedSite;
|
|
use App\Services\Autopodbor\Agent\Fetch\Fetcher;
|
|
use App\Services\Autopodbor\Agent\Study\SiteOpener;
|
|
|
|
it('вскрывает сайт: номер из tel: → kind code, попадает в codeDigits', function () {
|
|
$fake = new class implements Fetcher
|
|
{
|
|
public function site(string $url): FetchedSite
|
|
{
|
|
return new FetchedSite($url, '<a href="tel:+73912920000">звонок</a>');
|
|
}
|
|
|
|
public function directory(string $url): array
|
|
{
|
|
return [];
|
|
}
|
|
};
|
|
$r = (new SiteOpener($fake))->open('kraslombard24.ru', '391');
|
|
expect($r->ok)->toBeTrue()
|
|
->and($r->codeDigits)->toContain('73912920000')
|
|
->and(collect($r->numbers)->pluck('kind'))->toContain('code')
|
|
->and($r->htmlLower)->toContain('tel:+73912920000');
|
|
});
|