Esempio n. 1
0
 /**
  * @covers MicrosoftAzure\Storage\Blob\Models\Container::getProperties
  */
 public function testGetProperties()
 {
     // Setup
     $date = Utilities::rfc1123ToDateTime('Wed, 12 Aug 2009 20:39:39 GMT');
     $container = new Container();
     $expected = new ContainerProperties();
     $expected->setETag('0x8CACB9BD7C1EEEC');
     $expected->setLastModified($date);
     $container->setProperties($expected);
     // Test
     $actual = $container->getProperties();
     // Assert
     $this->assertEquals($expected, $actual);
 }
 /**
  * Creates ListBlobResult object from parsed XML response.
  *
  * @param array $parsedResponse XML response parsed into array.
  * 
  * @return ListBlobResult
  */
 public static function create($parsedResponse)
 {
     $result = new ListContainersResult();
     $serviceEndpoint = Utilities::tryGetKeysChainValue($parsedResponse, Resources::XTAG_ATTRIBUTES, Resources::XTAG_SERVICE_ENDPOINT);
     $result->_accountName = Utilities::tryParseAccountNameFromUrl($serviceEndpoint);
     $result->_prefix = Utilities::tryGetValue($parsedResponse, Resources::QP_PREFIX);
     $result->_marker = Utilities::tryGetValue($parsedResponse, Resources::QP_MARKER);
     $result->_nextMarker = Utilities::tryGetValue($parsedResponse, Resources::QP_NEXT_MARKER);
     $result->_maxResults = Utilities::tryGetValue($parsedResponse, Resources::QP_MAX_RESULTS);
     $result->_containers = array();
     $rawContainer = array();
     if (!empty($parsedResponse['Containers'])) {
         $containersArray = $parsedResponse['Containers']['Container'];
         $rawContainer = Utilities::getArray($containersArray);
     }
     foreach ($rawContainer as $value) {
         $container = new Container();
         $container->setName($value['Name']);
         $container->setUrl($serviceEndpoint . $value['Name']);
         $container->setMetadata(Utilities::tryGetValue($value, Resources::QP_METADATA, array()));
         $properties = new ContainerProperties();
         $date = $value['Properties']['Last-Modified'];
         $date = Utilities::rfc1123ToDateTime($date);
         $properties->setLastModified($date);
         $properties->setETag($value['Properties']['Etag']);
         $container->setProperties($properties);
         $result->_containers[] = $container;
     }
     return $result;
 }