Http::response(json_encode([ ['name_value' => "www.example.com\nexample.com"], ['name_value' => "*.example.com\nwww.example.com"], ])), ]); $target = new Target(['type' => 'domain', 'value' => 'example.com']); $result = (new CrtShRunner)->run($target); $this->assertSame( ['*.example.com', 'example.com', 'www.example.com'], $result->raw['subdomains'] ); $this->assertStringContainsString('3 unique subdomains', $result->summary); } public function test_handles_empty_response(): void { Http::fake(['crt.sh/*' => Http::response('')]); $target = new Target(['type' => 'domain', 'value' => 'nonexistent-domain-xyz.com']); $result = (new CrtShRunner)->run($target); $this->assertSame([], $result->raw['subdomains']); $this->assertSame('No certificates found.', $result->summary); } public function test_rejects_non_domain_targets(): void { $target = new Target(['type' => 'ip', 'value' => '8.8.8.8']); $this->expectException(RunnerException::class); (new CrtShRunner)->run($target); } public function test_throws_on_http_failure(): void { Http::fake(['crt.sh/*' => Http::response('', 500)]); $target = new Target(['type' => 'domain', 'value' => 'example.com']); $this->expectException(RunnerException::class); (new CrtShRunner)->run($target); } }