コード例 #1
0
 /**
  * @param \Gaufrette\Stream $stream
  */
 function it_does_not_read_from_stream($stream)
 {
     $stream->open(Argument::any())->willReturn(true);
     $stream->read(4)->willReturn('some');
     $this->stream_open('gaufrette://some/filename', 'r+');
     $this->stream_read(4)->shouldReturn('some');
 }
コード例 #2
0
 /**
  * @param \Gaufrette\Stream $stream
  */
 function it_should_read_from_stream($stream)
 {
     $stream->read(4)->willReturn('some');
     $this->stream_open('gaufrette://some/filename', 'r+');
     $this->stream_read(4)->shouldReturn('some');
 }
コード例 #3
0
 /**
  * Copy stream to storage
  *
  * @param Stream $srcStream
  * @param string $destinationFileName
  */
 protected function copyStreamToStorage(Stream $srcStream, $destinationFileName)
 {
     $dstStream = $this->filesystem->createStream($destinationFileName);
     $srcStream->open(new StreamMode('rb+'));
     $dstStream->open(new StreamMode('wb+'));
     while (!$srcStream->eof()) {
         $dstStream->write($srcStream->read(self::READ_COUNT));
     }
     $dstStream->close();
     $srcStream->close();
 }