/**
  * @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions::setLeaseId
  * @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions::getLeaseId
  */
 public function testSetLeaseId()
 {
     // Setup
     $expected = '0x8CAFB82EFF70C46';
     $options = new CreateBlobOptions();
     $options->setLeaseId($expected);
     // Test
     $options->setLeaseId($expected);
     // Assert
     $this->assertEquals($expected, $options->getLeaseId());
 }
示例#2
0
 /**
  * Adds optional create blob headers.
  * 
  * @param CreateBlobOptions $options The optional parameters.
  * @param array             $headers The HTTP request headers.
  * 
  * @return array
  */
 private function _addCreateBlobOptionalHeaders($options, $headers)
 {
     $contentType = $options->getContentType();
     $metadata = $options->getMetadata();
     $blobContentType = $options->getBlobContentType();
     $blobContentEncoding = $options->getBlobContentEncoding();
     $blobContentLanguage = $options->getBlobContentLanguage();
     $blobContentMD5 = $options->getBlobContentMD5();
     $blobCacheControl = $options->getBlobCacheControl();
     $leaseId = $options->getLeaseId();
     if (!is_null($contentType)) {
         $this->addOptionalHeader($headers, Resources::CONTENT_TYPE, $options->getContentType());
     } else {
         $this->addOptionalHeader($headers, Resources::CONTENT_TYPE, Resources::BINARY_FILE_TYPE);
     }
     $headers = $this->addMetadataHeaders($headers, $metadata);
     $headers = $this->addOptionalAccessConditionHeader($headers, $options->getAccessCondition());
     $this->addOptionalHeader($headers, Resources::CONTENT_ENCODING, $options->getContentEncoding());
     $this->addOptionalHeader($headers, Resources::CONTENT_LANGUAGE, $options->getContentLanguage());
     $this->addOptionalHeader($headers, Resources::CONTENT_MD5, $options->getContentMD5());
     $this->addOptionalHeader($headers, Resources::CACHE_CONTROL, $options->getCacheControl());
     $this->addOptionalHeader($headers, Resources::X_MS_LEASE_ID, $leaseId);
     $this->addOptionalHeader($headers, Resources::X_MS_BLOB_CONTENT_TYPE, $blobContentType);
     $this->addOptionalHeader($headers, Resources::X_MS_BLOB_CONTENT_ENCODING, $blobContentEncoding);
     $this->addOptionalHeader($headers, Resources::X_MS_BLOB_CONTENT_LANGUAGE, $blobContentLanguage);
     $this->addOptionalHeader($headers, Resources::X_MS_BLOB_CONTENT_MD5, $blobContentMD5);
     $this->addOptionalHeader($headers, Resources::X_MS_BLOB_CACHE_CONTROL, $blobCacheControl);
     return $headers;
 }