Skip to content

Commit

Permalink
Fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
kelunik committed Apr 13, 2024
1 parent 519681d commit 79e74fb
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/ResourceOutputStreamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Amp\ByteStream\StreamException;
use Amp\PHPUnit\AsyncTestCase;
use function Amp\delay;
use const PHP_OS;

class ResourceOutputStreamTest extends AsyncTestCase
{
Expand Down Expand Up @@ -36,7 +35,7 @@ public function testNotWritable(): void
public function testBrokenPipe(): ?\Generator
{
if (($sockets = @\stream_socket_pair(
\stripos(PHP_OS, "win") === 0 ? STREAM_PF_INET : STREAM_PF_UNIX,
\stripos(\PHP_OS, "win") === 0 ? STREAM_PF_INET : STREAM_PF_UNIX,
STREAM_SOCK_STREAM,
STREAM_IPPROTO_IP
)) === false) {
Expand All @@ -49,12 +48,12 @@ public function testBrokenPipe(): ?\Generator
\fclose($b);

$this->expectException(StreamException::class);
$this->expectExceptionMessage(/* S|s */ "end of 6 bytes failed with errno=" . (\stripos(PHP_OS, "win") === 0 ? "10053" : "32 Broken pipe"));
$this->expectExceptionMessage(/* S|s */ "end of 6 bytes failed with errno=" . (\stripos(\PHP_OS, "win") === 0 ? "10053" : "32 Broken pipe"));

yield $stream->write("foobar");

// The first write still succeeds somehow on Windows...
if (\stripos(PHP_OS, "win") === 0) {
if (\stripos(\PHP_OS, "win") === 0) {
yield $stream->write("foobar");
}
}
Expand All @@ -71,7 +70,7 @@ public function testClosedRemoteSocket(): ?\Generator
\fclose($b);

$this->expectException(StreamException::class);
$this->expectExceptionMessage(/* S|s */ "end of 6 bytes failed with errno=" . (\stripos(PHP_OS, "win") === 0 ? "10053" : "32 Broken pipe"));
$this->expectExceptionMessage(/* S|s */ "end of 6 bytes failed with errno=" . (\stripos(\PHP_OS, "win") === 0 ? "10053" : "32 Broken pipe"));

yield $stream->write("foobar");
// There's some delay until a write fails on macOS (and possibly other OSes)
Expand Down

0 comments on commit 79e74fb

Please sign in to comment.