예제 #1
0
 /**
  * Creates ListQueuesResult object from parsed XML response.
  *
  * @param array $parsedResponse XML response parsed into array.
  * 
  * @return MicrosoftAzure\Storage\Queue\Models\ListQueuesResult.
  */
 public static function create($parsedResponse)
 {
     $result = new ListQueuesResult();
     $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->_queues = array();
     $rawQueues = array();
     if (!empty($parsedResponse['Queues'])) {
         $rawQueues = Utilities::getArray($parsedResponse['Queues']['Queue']);
     }
     foreach ($rawQueues as $value) {
         $queue = new Queue($value['Name'], $serviceEndpoint . $value['Name']);
         $metadata = Utilities::tryGetValue($value, Resources::QP_METADATA);
         $queue->setMetadata(is_null($metadata) ? array() : $metadata);
         $result->_queues[] = $queue;
     }
     return $result;
 }
예제 #2
0
 /**
  * @covers MicrosoftAzure\Storage\Queue\Models\Queue::getMetadata
  */
 public function testGetMetadata()
 {
     // Setup
     $queue = new Queue('myqueue', 'myurl');
     $expected = array('key1' => 'value1', 'key2' => 'value2');
     $queue->setMetadata($expected);
     // Test
     $actual = $queue->getMetadata();
     // Assert
     $this->assertEquals($expected, $actual);
 }