From f3a3c20ce639b16c7d39a8115941e8c9cceda335 Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Wed, 20 Feb 2019 09:41:01 +0100 Subject: [PATCH] Add tests for read and write only streams --- tests/StreamTest.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/StreamTest.php b/tests/StreamTest.php index a100ebd7..90fc58dd 100644 --- a/tests/StreamTest.php +++ b/tests/StreamTest.php @@ -300,6 +300,16 @@ public function readableModeProvider() ]; } + public function testStreamIsNotReadable() + { + $r = fopen('php://output', 'w'); + $stream = new Stream($r); + + $this->assertFalse($stream->isReadable()); + + $stream->close(); + } + /** * @dataProvider writableModeProvider * @@ -338,6 +348,16 @@ public function writableModeProvider() ['a+'], ]; } + + public function testStreamIsNotWritable() + { + $r = fopen('php://input', 'r'); + $stream = new Stream($r); + + $this->assertFalse($stream->isWritable()); + + $stream->close(); + } } namespace GuzzleHttp\Psr7;