/** * @covers WindowsAzure\Blob\BlobRestProxy::copyBlob * @covers WindowsAzure\Blob\BlobRestProxy::_getCopyBlobSourceName */ public function testCopyBlobSnapshot() { // Setup $containerName = 'copyblobsnapshot' . $this->createSuffix(); $sourceBlobName = 'sourceblob'; $blobValue = 'testBlobValue'; $destinationBlobName = 'destinationblob'; $this->createContainer($containerName); $this->restProxy->createBlockBlob($containerName, $sourceBlobName, $blobValue); $snapshotResult = $this->restProxy->createBlobSnapshot($containerName, $sourceBlobName); $options = new CopyBlobOptions(); $options->setSourceSnapshot($snapshotResult->getSnapshot()); // Test $this->restProxy->copyBlob($containerName, $destinationBlobName, $containerName, $sourceBlobName, $options); // Assert $sourceBlob = $this->restProxy->getBlob($containerName, $sourceBlobName); $destinationBlob = $this->restProxy->getBlob($containerName, $destinationBlobName); $sourceBlobContent = stream_get_contents($sourceBlob->getContentStream()); $destinationBlobContent = stream_get_contents($destinationBlob->getContentStream()); $this->assertEquals($sourceBlobContent, $destinationBlobContent); }
public static function getCopyBlobOptions() { $ret = array(); $options = new CopyBlobOptions(); array_push($ret, $options); $options = new CopyBlobOptions(); $options->setTimeout(10); array_push($ret, $options); $options = new CopyBlobOptions(); $options->setTimeout(-10); array_push($ret, $options); foreach (self::getAllAccessConditions() as $ac) { $options = new CopyBlobOptions(); $options->setSourceAccessCondition($ac); array_push($ret, $options); } foreach (self::getAllAccessConditions() as $ac) { $options = new CopyBlobOptions(); $options->setAccessCondition($ac); array_push($ret, $options); } $options = new CopyBlobOptions(); $metadata = array('Xkey' => 'Avalue', 'Yfoo' => 'Bbar', 'Zbaz' => 'Cboo'); $options->setMetadata($metadata); array_push($ret, $options); $options = new CopyBlobOptions(); $options->setSourceSnapshot('placeholder'); array_push($ret, $options); // TODO: Handle Lease ID // $options = new CopyBlobOptions(); // $options->setLeaseId('setLeaseId'); // array_push($ret, $options); // // $options = new CopyBlobOptions(); // $options->setSourceLeaseId('setSourceLeaseId'); // array_push($ret, $options); return $ret; }