Skip to content

Commit f725461

Browse files
authored
Merge pull request #74 from nicolas-grekas/test-get-contents-error
Add StreamIntegrationTest::testGetContentsError()
2 parents 92ef823 + 76c64ee commit f725461

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/StreamIntegrationTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,4 +301,21 @@ public function testGetContents()
301301
$this->assertEquals('def', $stream->getContents());
302302
$this->assertSame('', $stream->getContents());
303303
}
304+
305+
public function testGetContentsError()
306+
{
307+
if (isset($this->skippedTests[__FUNCTION__])) {
308+
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
309+
}
310+
311+
$resource = fopen('php://memory', 'rw');
312+
fwrite($resource, 'abcdef');
313+
rewind($resource);
314+
$stream = $this->createStream($resource);
315+
316+
fclose($resource);
317+
318+
$this->expectException(\RuntimeException::class);
319+
$stream->getContents();
320+
}
304321
}

0 commit comments

Comments
 (0)