public function testCopyCopiesContentUsingPath() { $content = 'Lorem ipsum dolor sit amet'; $temp = sys_get_temp_dir(); $path = $temp . PHP_DS . 'foo.bar'; $fp = fopen($path, 'w+b'); fwrite($fp, $content); fclose($fp); $stream = new Stream(); $stream->copy($path); $this->assertSame($content, $stream->getContents()); unlink($path); }
public function testGetContentsReturnEmptyStringWhenResourceIsNotReadable() { $resource = Stream::fopen('php://temp', 'w'); $stream = new Stream($resource); $this->assertEquals('', $stream->getContents()); }