diff --git a/src/StreamIntegrationTest.php b/src/StreamIntegrationTest.php index 6d9e63d..804ebd7 100644 --- a/src/StreamIntegrationTest.php +++ b/src/StreamIntegrationTest.php @@ -301,4 +301,21 @@ public function testGetContents() $this->assertEquals('def', $stream->getContents()); $this->assertSame('', $stream->getContents()); } + + public function testGetContentsError() + { + if (isset($this->skippedTests[__FUNCTION__])) { + $this->markTestSkipped($this->skippedTests[__FUNCTION__]); + } + + $resource = fopen('php://memory', 'rw'); + fwrite($resource, 'abcdef'); + rewind($resource); + $stream = $this->createStream($resource); + + fclose($resource); + + $this->expectException(\RuntimeException::class); + $stream->getContents(); + } }