コード例 #1
0
ファイル: BlobRestProxy.php プロジェクト: yszar/linuxwp
 /**
  * Helper method for getContainerProperties and getContainerMetadata.
  * 
  * @param string                    $container The container name.
  * @param Models\BlobServiceOptions $options   The optional parameters.
  * @param string                    $operation The operation string. Should be
  * 'metadata' to get metadata.
  * 
  * @return Models\GetContainerPropertiesResult
  */
 private function _getContainerPropertiesImpl($container, $options = null, $operation = null)
 {
     Validate::isString($container, 'container');
     $method = Resources::HTTP_GET;
     $headers = array();
     $queryParams = array();
     $postParams = array();
     $path = $container;
     $statusCode = Resources::STATUS_OK;
     if (is_null($options)) {
         $options = new BlobServiceOptions();
     }
     $this->addOptionalQueryParam($queryParams, Resources::QP_REST_TYPE, 'container');
     $this->addOptionalQueryParam($queryParams, Resources::QP_COMP, $operation);
     $this->addOptionalQueryParam($queryParams, Resources::QP_TIMEOUT, $options->getTimeout());
     $response = $this->send($method, $headers, $queryParams, $postParams, $path, $statusCode);
     $result = new GetContainerPropertiesResult();
     $metadata = $this->getMetadataArray($response->getHeader());
     $date = $response->getHeader(Resources::LAST_MODIFIED);
     $date = Utilities::rfc1123ToDateTime($date);
     $result->setETag($response->getHeader(Resources::ETAG));
     $result->setMetadata($metadata);
     $result->setLastModified($date);
     return $result;
 }
 /**
  * @covers WindowsAzure\Blob\Models\GetContainerPropertiesResult::getMetadata
  */
 public function testGetMetadata()
 {
     // Setup
     $container = new GetContainerPropertiesResult();
     $expected = array('key1' => 'value1', 'key2' => 'value2');
     $container->setMetadata($expected);
     // Test
     $actual = $container->getMetadata();
     // Assert
     $this->assertEquals($expected, $actual);
 }