/**
  * @covers MicrosoftAzure\Storage\Blob\Models\GetBlobOptions::setLeaseId
  * @covers MicrosoftAzure\Storage\Blob\Models\GetBlobOptions::getLeaseId
  */
 public function testSetLeaseId()
 {
     // Setup
     $expected = '0x8CAFB82EFF70C46';
     $options = new GetBlobOptions();
     $options->setLeaseId($expected);
     // Test
     $options->setLeaseId($expected);
     // Assert
     $this->assertEquals($expected, $options->getLeaseId());
 }
Esempio n. 2
0
 /**
  * Reads or downloads a blob from the system, including its metadata and 
  * properties.
  * 
  * @param string                $container name of the container
  * @param string                $blob      name of the blob
  * @param Models\GetBlobOptions $options   optional parameters
  * 
  * @return Models\GetBlobResult
  * 
  * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179440.aspx
  */
 public function getBlob($container, $blob, $options = null)
 {
     Validate::isString($container, 'container');
     Validate::isString($blob, 'blob');
     $method = Resources::HTTP_GET;
     $headers = array();
     $postParams = array();
     $queryParams = array();
     $path = $this->_createPath($container, $blob);
     $statusCode = array(Resources::STATUS_OK, Resources::STATUS_PARTIAL_CONTENT);
     if (is_null($options)) {
         $options = new GetBlobOptions();
     }
     $getMD5 = $options->getComputeRangeMD5();
     $headers = $this->addOptionalAccessConditionHeader($headers, $options->getAccessCondition());
     $headers = $this->_addOptionalRangeHeader($headers, $options->getRangeStart(), $options->getRangeEnd());
     $this->addOptionalHeader($headers, Resources::X_MS_LEASE_ID, $options->getLeaseId());
     $this->addOptionalHeader($headers, Resources::X_MS_RANGE_GET_CONTENT_MD5, $getMD5 ? 'true' : null);
     $this->addOptionalQueryParam($queryParams, Resources::QP_TIMEOUT, $options->getTimeout());
     $this->addOptionalQueryParam($queryParams, Resources::QP_SNAPSHOT, $options->getSnapshot());
     $response = $this->send($method, $headers, $queryParams, $postParams, $path, $statusCode);
     $metadata = $this->getMetadataArray(HttpFormatter::formatHeaders($response->getHeaders()));
     return GetBlobResult::create(HttpFormatter::formatHeaders($response->getHeaders()), $response->getBody(), $metadata);
 }