Ejemplo n.º 1
0
 /**
  * Creates ListBlobBlocksResult from given response headers and parsed body
  * 
  * @param array $headers HTTP response headers
  * @param array $parsed  HTTP response body in array representation
  * 
  * @return ListBlobBlocksResult
  */
 public static function create($headers, $parsed)
 {
     $result = new ListBlobBlocksResult();
     $clean = array_change_key_case($headers);
     $result->setETag(Utilities::tryGetValue($clean, Resources::ETAG));
     $date = Utilities::tryGetValue($clean, Resources::LAST_MODIFIED);
     if (!is_null($date)) {
         $date = Utilities::rfc1123ToDateTime($date);
         $result->setLastModified($date);
     }
     $result->setContentLength(intval(Utilities::tryGetValue($clean, Resources::X_MS_BLOB_CONTENT_LENGTH)));
     $result->setContentType(Utilities::tryGetValue($clean, Resources::CONTENT_TYPE));
     $result->_uncommittedBlocks = self::_getEntries($parsed, 'UncommittedBlocks');
     $result->_committedBlocks = self::_getEntries($parsed, 'CommittedBlocks');
     return $result;
 }
 /**
  * @covers WindowsAzure\Blob\Models\ListBlobBlocksResult::setContentLength
  * @covers WindowsAzure\Blob\Models\ListBlobBlocksResult::getContentLength
  */
 public function testSetContentLength()
 {
     // Setup
     $expected = 100;
     $result = new ListBlobBlocksResult();
     $result->setContentLength($expected);
     // Test
     $result->setContentLength($expected);
     // Assert
     $this->assertEquals($expected, $result->getContentLength());
 }