Пример #1
0
 /**
  * Makes a stream and and fills it with input data.
  *
  * @return \Es\Http\Stream The stream
  */
 public static function make()
 {
     $stream = new Stream();
     $source = static::getSource();
     $stream->copy($source);
     if (!static::$source) {
         fclose($source);
     }
     return $stream;
 }
Пример #2
0
 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);
 }