public function testGetContentsShouldGetFullStreamContents() { $this->tmpnam = tempnam(sys_get_temp_dir(), 'PHLY'); $resource = fopen($this->tmpnam, 'r+'); $this->stream->attach($resource); fwrite($resource, 'FooBar'); // rewind, because current pointer is at end of stream! $this->stream->rewind(); $test = $this->stream->getContents(); $this->assertEquals('FooBar', $test); }