public function testReadRaisesExceptionWhenStreamIsDetached() { $this->tmpnam = tempnam(sys_get_temp_dir(), 'phly'); file_put_contents($this->tmpnam, 'FOO BAR'); $resource = fopen($this->tmpnam, 'r'); $stream = new Stream($resource); $stream->detach(); $this->setExpectedException('RuntimeException', 'No resource'); $stream->read(4096); }
public function testReadReturnsEmptyStringWhenStreamIsDetached() { $this->tmpnam = tempnam(sys_get_temp_dir(), 'phly'); file_put_contents($this->tmpnam, 'FOO BAR'); $resource = fopen($this->tmpnam, 'r'); $stream = new Stream($resource); $stream->detach(); $this->assertEquals('', $stream->read(4096)); }