Ejemplo n.º 1
0
 /**
  * @covers MicrosoftAzure\Storage\Blob\Models\Container::getName
  */
 public function testGetName()
 {
     // Setup
     $container = new Container();
     $expected = TestResources::QUEUE1_NAME;
     $container->setName($expected);
     // Test
     $actual = $container->getName();
     // 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;
 }