/**
  * @covers MicrosoftAzure\Storage\Blob\Models\DeleteBlobOptions::getSnapshot
  */
 public function testGetSnapshot()
 {
     // Setup
     $blob = new DeleteBlobOptions();
     $expected = TestResources::QUEUE_URI;
     $blob->setSnapshot($expected);
     // Test
     $actual = $blob->getSnapshot();
     // Assert
     $this->assertEquals($expected, $actual);
 }
 public static function getDeleteBlobOptions()
 {
     $ret = array();
     $options = new DeleteBlobOptions();
     array_push($ret, $options);
     $options = new DeleteBlobOptions();
     $options->setTimeout(10);
     array_push($ret, $options);
     $options = new DeleteBlobOptions();
     $options->setTimeout(-10);
     array_push($ret, $options);
     foreach (self::getAllAccessConditions() as $ac) {
         $options = new DeleteBlobOptions();
         $options->setAccessCondition($ac);
         array_push($ret, $options);
     }
     $options = new DeleteBlobOptions();
     $options->setDeleteSnaphotsOnly(true);
     array_push($ret, $options);
     $options = new DeleteBlobOptions();
     $options->setDeleteSnaphotsOnly(false);
     array_push($ret, $options);
     $options = new DeleteBlobOptions();
     $options->setSnapshot('placeholder');
     array_push($ret, $options);
     // TODO: Handle Lease ID
     //        $options = new DeleteBlobOptions();
     //        $options->setLeaseId('setLeaseId');
     //        array_push($ret, $options);
     return $ret;
 }
Exemplo n.º 3
0
 /**
  * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::deleteBlob
  */
 public function testDeleteBlobSnapshot()
 {
     // Setup
     $name = 'deleteblobsnapshot' . $this->createSuffix();
     $blob = 'myblob';
     $contentType = 'text/plain; charset=UTF-8';
     $this->createContainer($name);
     $options = new CreateBlobOptions();
     $options->setContentType($contentType);
     $this->restProxy->createBlockBlob($name, $blob, 'Hello world', $options);
     $snapshot = $this->restProxy->createBlobSnapshot($name, $blob);
     $options = new DeleteBlobOptions();
     $options->setSnapshot($snapshot->getSnapshot());
     // Test
     $this->restProxy->deleteBlob($name, $blob, $options);
     // Assert
     $listOptions = new ListBlobsOptions();
     $listOptions->setIncludeSnapshots(true);
     $blobsResult = $this->restProxy->listBlobs($name, $listOptions);
     $blobs = $blobsResult->getBlobs();
     $actualBlob = $blobs[0];
     $this->assertNull($actualBlob->getSnapshot());
 }