public function testFailedResumableTransferWillNotThrowAndReturnSameChunk() { $this->graphApi->failOnTransfer(); $uploader = new FacebookResumableUploader($this->fbApp, $this->client, 'access_token', 'v2.4'); $chunk = new FacebookTransferChunk($this->file, '1', '2', '3', '4'); $newChunk = $uploader->transfer('/me/videos', $chunk); $this->assertSame($newChunk, $chunk); }
/** * Attempts to upload a chunk of a file in $retryCountdown tries. * * @param FacebookResumableUploader $uploader * @param string $endpoint * @param FacebookTransferChunk $chunk * @param int $retryCountdown * * @return FacebookTransferChunk * * @throws FacebookSDKException */ private function maxTriesTransfer(FacebookResumableUploader $uploader, $endpoint, FacebookTransferChunk $chunk, $retryCountdown) { $newChunk = $uploader->transfer($endpoint, $chunk, $retryCountdown < 1); if ($newChunk !== $chunk) { return $newChunk; } $retryCountdown--; // If transfer() returned the same chunk entity, the transfer failed but is resumable. return $this->maxTriesTransfer($uploader, $endpoint, $chunk, $retryCountdown); }