Ejemplo n.º 1
0
 /**
  * @covers MicrosoftAzure\Storage\Common\Internal\Logger::log
  * @covers MicrosoftAzure\Storage\Common\Internal\Logger::setLogFile
  */
 public function testLogWithString()
 {
     // Setup
     $virtualPath = VirtualFileSystem::newFile(Resources::EMPTY_STRING);
     $tip = 'This is string';
     $expected = "{$tip}\nI'm a string\n";
     Logger::setLogFile($virtualPath);
     // Test
     Logger::log('I\'m a string', $tip);
     // Assert
     $actual = file_get_contents($virtualPath);
     $this->assertEquals($expected, $actual);
 }
Ejemplo n.º 2
0
 /**
  * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlob
  * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_addCreateBlobOptionalHeaders
  */
 public function testCreateBlockBlobWithStream()
 {
     // Setup
     $name = 'createblockblobwithstream' . $this->createSuffix();
     $contentType = 'text/plain; charset=UTF-8';
     $this->createContainer($name);
     $options = new CreateBlobOptions();
     $options->setContentType($contentType);
     $fileContents = 'Hello world, I\'m a file';
     $stream = fopen(VirtualFileSystem::newFile($fileContents), 'r');
     // Test
     $this->restProxy->createBlockBlob($name, 'myblob', $stream, $options);
     // Assert
     $result = $this->restProxy->listBlobs($name);
     $blobs = $result->getBlobs();
     $blob = $blobs[0];
     $this->assertCount(1, $result->getBlobs());
     $this->assertEquals($contentType, $blob->getProperties()->getContentType());
 }