Skip to content

Commit

Permalink
Merge pull request #74 from nicolas-grekas/test-get-contents-error
Browse files Browse the repository at this point in the history
Add StreamIntegrationTest::testGetContentsError()
  • Loading branch information
dbu authored Nov 13, 2023
2 parents 92ef823 + 76c64ee commit f725461
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/StreamIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

0 comments on commit f725461

Please sign in to comment.