/**
  * @covers WindowsAzure\Blob\Models\GetContainerAclResult::create
  */
 public function testCreate()
 {
     // Setup
     $sample = Resources::EMPTY_STRING;
     $expectedEtag = '0x8CAFB82EFF70C46';
     $expectedDate = new \DateTime('Sun, 25 Sep 2011 19:42:18 GMT');
     $expectedPublicAccess = 'container';
     // Test
     $result = GetContainerAclResult::create($expectedPublicAccess, $expectedEtag, $expectedDate, $sample);
     // Assert
     $obj = $result->getContainerAcl();
     $this->assertEquals($expectedPublicAccess, $obj->getPublicAccess());
     $this->assertCount(0, $obj->getSignedIdentifiers());
 }
Esempio n. 2
0
 /**
  * Gets the access control list (ACL) and any container-level access policies 
  * for the container.
  * 
  * @param string                    $container The container name.
  * @param Models\BlobServiceOptions $options   The optional parameters.
  * 
  * @return Models\GetContainerAclResult
  * 
  * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179469.aspx
  */
 public function getContainerAcl($container, $options = null)
 {
     Validate::isString($container, 'container');
     $method = Resources::HTTP_GET;
     $headers = array();
     $postParams = array();
     $queryParams = array();
     $path = $container;
     $statusCode = Resources::STATUS_OK;
     if (is_null($options)) {
         $options = new BlobServiceOptions();
     }
     $this->addOptionalQueryParam($queryParams, Resources::QP_TIMEOUT, $options->getTimeout());
     $this->addOptionalQueryParam($queryParams, Resources::QP_REST_TYPE, 'container');
     $this->addOptionalQueryParam($queryParams, Resources::QP_COMP, 'acl');
     $response = $this->send($method, $headers, $queryParams, $postParams, $path, $statusCode);
     $access = $response->getHeader(Resources::X_MS_BLOB_PUBLIC_ACCESS);
     $etag = $response->getHeader(Resources::ETAG);
     $modified = $response->getHeader(Resources::LAST_MODIFIED);
     $modifiedDate = Utilities::convertToDateTime($modified);
     $parsed = $this->dataSerializer->unserialize($response->getBody());
     return GetContainerAclResult::create($access, $etag, $modifiedDate, $parsed);
 }