/**
  * @covers WindowsAzure\Blob\Models\BlobPrefix::getName
  */
 public function testGetName()
 {
     // Setup
     $blob = new BlobPrefix();
     $expected = TestResources::QUEUE1_NAME;
     $blob->setName($expected);
     // Test
     $actual = $blob->getName();
     // Assert
     $this->assertEquals($expected, $actual);
 }
예제 #2
0
 /**
  * Creates ListBlobsResult object from parsed XML response.
  *
  * @param array $parsed XML response parsed into array.
  * 
  * @return WindowsAzure\Blob\Models\ListBlobsResult.
  */
 public static function create($parsed)
 {
     $result = new ListBlobsResult();
     $result->_prefix = Utilities::tryGetValue($parsed, Resources::QP_PREFIX);
     $result->_marker = Utilities::tryGetValue($parsed, Resources::QP_MARKER);
     $result->_nextMarker = Utilities::tryGetValue($parsed, Resources::QP_NEXT_MARKER);
     $result->_maxResults = intval(Utilities::tryGetValue($parsed, Resources::QP_MAX_RESULTS, 0));
     $result->_delimiter = Utilities::tryGetValue($parsed, Resources::QP_DELIMITER);
     $result->_blobs = array();
     $result->_blobPrefixes = array();
     $rawBlobs = array();
     $rawBlobPrefixes = array();
     if (is_array($parsed['Blobs']) && array_key_exists('Blob', $parsed['Blobs'])) {
         $rawBlobs = Utilities::getArray($parsed['Blobs']['Blob']);
     }
     foreach ($rawBlobs as $value) {
         $blob = new Blob();
         $blob->setName($value['Name']);
         $blob->setUrl($value['Url']);
         $blob->setSnapshot(Utilities::tryGetValue($value, 'Snapshot'));
         $blob->setProperties(BlobProperties::create(Utilities::tryGetValue($value, 'Properties')));
         $blob->setMetadata(Utilities::tryGetValue($value, Resources::QP_METADATA, array()));
         $result->_blobs[] = $blob;
     }
     if (is_array($parsed['Blobs']) && array_key_exists('BlobPrefix', $parsed['Blobs'])) {
         $rawBlobPrefixes = Utilities::getArray($parsed['Blobs']['BlobPrefix']);
     }
     foreach ($rawBlobPrefixes as $value) {
         $blobPrefix = new BlobPrefix();
         $blobPrefix->setName($value['Name']);
         $result->_blobPrefixes[] = $blobPrefix;
     }
     return $result;
 }