Skip to content

Commit

Permalink
Skip testing with socket when socket cannot be opened
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed May 7, 2024
1 parent 2292f50 commit 88448af
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tests/unit/TextUI/Output/Default/DefaultPrinterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Medium;
use PHPUnit\Framework\TestCase;
use PHPUnit\TextUI\CannotOpenSocketException;
use PHPUnit\TextUI\InvalidSocketException;
use PHPUnit\TextUI\Output\DefaultPrinter;

Expand All @@ -22,11 +23,17 @@ final class DefaultPrinterTest extends TestCase
{
public static function providePrinter(): array
{
return [
[DefaultPrinter::standardOutput()],
[DefaultPrinter::standardError()],
[DefaultPrinter::from('socket://www.example.com:80')],
$data = [
'standard output' => [DefaultPrinter::standardOutput()],
'standard error' => [DefaultPrinter::standardError()],
];

try {
$data['socket'] = [DefaultPrinter::from('socket://www.example.com:80')];
} catch (CannotOpenSocketException $e) {
}

return $data;
}

#[DataProvider('providePrinter')]
Expand Down

0 comments on commit 88448af

Please sign in to comment.