/** * 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(); }
/** * @param \Gaufrette\Stream $stream */ function it_should_check_if_eof_in_stream($stream) { $this->stream_open('gaufrette://some/filename', 'w+'); $stream->eof()->willReturn(false); $this->stream_eof()->shouldReturn(false); $stream->eof()->willReturn(true); $this->stream_eof()->shouldReturn(true); }
/** * @param \Gaufrette\Stream $stream */ function it_checks_if_eof($stream) { $stream->open(Argument::any())->willReturn(true); $this->stream_open('gaufrette://some/filename', 'w+'); $stream->eof()->willReturn(false); $this->stream_eof()->shouldReturn(false); $stream->eof()->willReturn(true); $this->stream_eof()->shouldReturn(true); }