public function resume($resumeUri)
{
if (!$this->data->isSeekable()) {
throw new GoogleException('Cannot resume upload on a stream which cannot be seeked.');
}
$this->resumeUri = $resumeUri;
$response = $this->getStatusResponse();
if ($response->getBody()->getSize() > 0) {
return json_decode($response->getBody(), true);
}
$this->rangeStart = $this->getRangeStart($response->getHeaderLine('Range'));
return $this->upload();
}
/** * @expectedException Google\Cloud\Exception\GoogleException */ public function testThrowsExceptionWhenResumingNonSeekableStream() { $stream = $this->prophesize('Psr\\Http\\Message\\StreamInterface'); $stream->isSeekable()->willReturn(false); $stream->getMetadata('uri')->willReturn('blah'); $uploader = new ResumableUploader($this->requestWrapper->reveal(), $stream->reveal(), 'http://www.example.com'); $uploader->resume('http://some-resume-uri.example.com'); }