Skip to content

Commit 88448af

Browse files
Skip testing with socket when socket cannot be opened
1 parent 2292f50 commit 88448af

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tests/unit/TextUI/Output/Default/DefaultPrinterTest.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use PHPUnit\Framework\Attributes\DataProvider;
1414
use PHPUnit\Framework\Attributes\Medium;
1515
use PHPUnit\Framework\TestCase;
16+
use PHPUnit\TextUI\CannotOpenSocketException;
1617
use PHPUnit\TextUI\InvalidSocketException;
1718
use PHPUnit\TextUI\Output\DefaultPrinter;
1819

@@ -22,11 +23,17 @@ final class DefaultPrinterTest extends TestCase
2223
{
2324
public static function providePrinter(): array
2425
{
25-
return [
26-
[DefaultPrinter::standardOutput()],
27-
[DefaultPrinter::standardError()],
28-
[DefaultPrinter::from('socket://www.example.com:80')],
26+
$data = [
27+
'standard output' => [DefaultPrinter::standardOutput()],
28+
'standard error' => [DefaultPrinter::standardError()],
2929
];
30+
31+
try {
32+
$data['socket'] = [DefaultPrinter::from('socket://www.example.com:80')];
33+
} catch (CannotOpenSocketException $e) {
34+
}
35+
36+
return $data;
3037
}
3138

3239
#[DataProvider('providePrinter')]

0 commit comments

Comments
 (0)