Пример #1
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;
 }
 /**
  * @covers WindowsAzure\Blob\Models\CreateBlobOptions::setBlobContentMD5
  * @covers WindowsAzure\Blob\Models\CreateBlobOptions::getBlobContentMD5
  */
 public function testSetBlobContentMD5()
 {
     // Setup
     $expected = '0x8CAFB82EFF70C46';
     $options = new CreateBlobOptions();
     $options->setBlobContentMD5($expected);
     // Test
     $options->setBlobContentMD5($expected);
     // Assert
     $this->assertEquals($expected, $options->getBlobContentMD5());
 }