public static function getGetBlobOptions()
 {
     $ret = array();
     $options = new GetBlobOptions();
     array_push($ret, $options);
     $options = new GetBlobOptions();
     $options->setTimeout(10);
     array_push($ret, $options);
     $options = new GetBlobOptions();
     $options->setTimeout(-10);
     array_push($ret, $options);
     // Get Blob only supports the temporal access conditions.
     foreach (self::getTemporalAccessConditions() as $ac) {
         $options = new GetBlobOptions();
         $options->setAccessCondition($ac);
         array_push($ret, $options);
     }
     $options = new GetBlobOptions();
     $options->setRangeStart(50);
     $options->setRangeEnd(200);
     array_push($ret, $options);
     $options = new GetBlobOptions();
     $options->setRangeStart(50);
     $options->setRangeEnd(200);
     $options->setComputeRangeMD5(true);
     array_push($ret, $options);
     $options = new GetBlobOptions();
     $options->setRangeStart(50);
     array_push($ret, $options);
     $options = new GetBlobOptions();
     $options->setComputeRangeMD5(true);
     array_push($ret, $options);
     $options = new GetBlobOptions();
     $options->setRangeEnd(200);
     $options->setComputeRangeMD5(true);
     array_push($ret, $options);
     $options = new GetBlobOptions();
     $options->setRangeEnd(200);
     array_push($ret, $options);
     $options = new GetBlobOptions();
     $options->setSnapshot('placeholder');
     array_push($ret, $options);
     // TODO: Handle Lease ID
     //        $options = new GetBlobOptions();
     //        $options->setLeaseId('setLeaseId');
     //        array_push($ret, $options);
     return $ret;
 }
 /**
  * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobSnapshot
  * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlob
  * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::deleteBlob
  * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlob
  * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobs
  */
 private function createBlobSnapshotWorker($options, $container)
 {
     $blob = BlobServiceFunctionalTestData::getInterestingBlobName($container);
     // Make sure there is something to test
     $dataSize = 512;
     $this->restProxy->createPageBlob($container, $blob, $dataSize);
     $snapshot1 = $this->restProxy->createBlobSnapshot($container, $blob);
     if (!is_null($options)) {
         BlobServiceFunctionalTestData::fixETagAccessCondition($options->getAccessCondition(), $snapshot1->getETag());
     }
     try {
         $res = is_null($options) ? $this->restProxy->createBlobSnapshot($container, $blob) : $this->restProxy->createBlobSnapshot($container, $blob, $options);
         if (is_null($options)) {
             $options = new CreateBlobSnapshotOptions();
         }
         if (!is_null($options->getTimeout()) && $options->getTimeout() < 1) {
             $this->assertTrue(false, 'Expect negative timeouts in $options to throw');
         }
         if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition())) {
             $this->assertTrue(false, 'Expect failing temporal access condition should throw');
         }
         if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition())) {
             $this->assertTrue(false, 'Expect failing etag access condition to throw');
         }
         $listOptions = new ListBlobsOptions();
         $listOptions->setIncludeSnapshots(true);
         $listOptions->setPrefix($blob);
         $listBlobsResult = $this->restProxy->listBlobs($container == '' ? '$root' : $container, $listOptions);
         $blobs = $listBlobsResult->getBlobs();
         $getBlobOptions = new GetBlobOptions();
         $getBlobOptions->setSnapshot($res->getSnapshot());
         $getBlobResult = $this->restProxy->getBlob($container, $blob, $getBlobOptions);
         $this->verifyCreateBlobSnapshotWorker($res, $options, $blobs, $getBlobResult);
     } catch (ServiceException $e) {
         if (!is_null($options->getTimeout()) && $options->getTimeout() < 1) {
             $this->assertEquals(TestResources::STATUS_INTERNAL_SERVER_ERROR, $e->getCode(), 'bad timeout: deleteHttpStatusCode');
         } else {
             if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition())) {
                 $this->assertEquals(TestResources::STATUS_PRECONDITION_FAILED, $e->getCode(), 'bad temporal access condition IF_UNMODIFIED_SINCE: deleteHttpStatusCode');
             } else {
                 if (!BlobServiceFunctionalTestData::passETagAccessCondition($options->getAccessCondition())) {
                     $this->assertEquals(TestResources::STATUS_PRECONDITION_FAILED, $e->getCode(), 'bad etag access condition: deleteHttpStatusCode');
                 } else {
                     throw $e;
                 }
             }
         }
     }
     // Clean up.
     $this->restProxy->deleteBlob($container, $blob);
 }
 /**
  * @covers MicrosoftAzure\Storage\Blob\Models\GetBlobOptions::getSnapshot
  */
 public function testGetSnapshot()
 {
     // Setup
     $blob = new GetBlobOptions();
     $expected = TestResources::QUEUE_URI;
     $blob->setSnapshot($expected);
     // Test
     $actual = $blob->getSnapshot();
     // Assert
     $this->assertEquals($expected, $actual);
 }