/** * @param \Gaufrette\Stream $stream */ function it_closes_stream($stream) { $stream->open(Argument::any())->willReturn(true); $stream->close()->shouldBeCalled(); $this->stream_open('gaufrette://some/filename', 'w+'); $this->stream_close(); }
protected function stream(FileInterface $file, Stream $dst) { $src = $this->createSourceStream($file); // always use reading only for the source $this->openStream($src, 'r'); while (!$src->eof()) { $data = $src->read($this->bufferSize); $dst->write($data); } $dst->close(); $src->close(); }
/** * @param \Gaufrette\Stream $stream */ function it_should_close_stream($stream) { $stream->close()->shouldBeCalled(); $this->stream_open('gaufrette://some/filename', 'w+'); $this->stream_close(); }
/** * 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(); }