Skip to content

Commit e52f601

Browse files
committed
Fix pebbleAvailable() to use curl instead of file_get_contents
file_get_contents with an SSL stream context is unreliable in Pest parallel workers; switching to curl (explicitly loaded as a PHP extension in CI) ensures the Pebble probe returns a valid HTTP status code and integration tests run.
1 parent 26b43f5 commit e52f601

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

tests/Pest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,18 @@ function pebbleAvailable(): bool
4040

4141
if ($result === null) {
4242
$url = getenv('PEBBLE_URL') ?: 'https://localhost:14000/dir';
43-
$ctx = stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]);
44-
$result = @file_get_contents($url, false, $ctx) !== false;
43+
$ch = curl_init($url);
44+
curl_setopt_array($ch, [
45+
CURLOPT_RETURNTRANSFER => true,
46+
CURLOPT_SSL_VERIFYPEER => false,
47+
CURLOPT_SSL_VERIFYHOST => false,
48+
CURLOPT_TIMEOUT => 3,
49+
CURLOPT_CONNECTTIMEOUT => 2,
50+
]);
51+
curl_exec($ch);
52+
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
53+
curl_close($ch);
54+
$result = $code > 0;
4555
}
4656

4757
return $result;

0 commit comments

Comments
 (0)