Пример #1
0
 /**
  * Creates GetBlobResult from getBlob call.
  * 
  * @param array  $headers  The HTTP response headers.
  * @param string $body     The response body.
  * @param array  $metadata The blob metadata.
  * 
  * @return GetBlobResult
  */
 public static function create($headers, $body, $metadata)
 {
     $result = new GetBlobResult();
     $result->setContentStream(Utilities::stringToStream($body));
     $result->setProperties(BlobProperties::create($headers));
     $result->setMetadata(is_null($metadata) ? array() : $metadata);
     return $result;
 }
 /**
  * @covers WindowsAzure\Common\Internal\Utilities::stringToStream
  */
 public function testStringToStream()
 {
     $data = 'This is string';
     $expected = fopen('data://text/plain,' . $data, 'r');
     // Test
     $actual = Utilities::stringToStream($data);
     // Assert
     $this->assertEquals(stream_get_contents($expected), stream_get_contents($actual));
 }
 /**
  * @covers WindowsAzure\Blob\Models\GetBlobResult::setContentStream
  * @covers WindowsAzure\Blob\Models\GetBlobResult::getContentStream
  */
 public function testSetContentStream()
 {
     // Setup
     $expected = Utilities::stringToStream('0x8CAFB82EFF70C46');
     $result = new GetBlobResult();
     // Test
     $result->setContentStream($expected);
     // Assert
     $this->assertEquals($expected, $result->getContentStream());
 }