コード例 #1
0
 /**
  * @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions::setCacheControl
  * @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions::getCacheControl
  */
 public function testSetCacheControl()
 {
     // Setup
     $expected = '0x8CAFB82EFF70C46';
     $options = new CreateBlobOptions();
     $options->setCacheControl($expected);
     // Test
     $options->setCacheControl($expected);
     // Assert
     $this->assertEquals($expected, $options->getCacheControl());
 }
コード例 #2
0
 /**
  * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlob
  * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlob
  */
 public function testGetPageBlobWorks()
 {
     // Act
     $opts = new CreateBlobOptions();
     $opts->setBlobCacheControl('test');
     $opts->setBlobContentEncoding('UTF-8');
     $opts->setBlobContentLanguage('en-us');
     // $opts->setBlobContentMD5('1234');
     $opts->setBlobContentType('text/plain');
     $opts->setCacheControl('test');
     $opts->setContentEncoding('UTF-8');
     // $opts->setContentMD5('1234');
     $opts->setContentType('text/plain');
     $this->restProxy->createPageBlob(self::$_test_container_for_blobs, 'test', 4096, $opts);
     $result = $this->restProxy->getBlob(self::$_test_container_for_blobs, 'test');
     // Assert
     $this->assertNotNull($result, '$result');
     $this->assertNotNull($result->getMetadata(), '$result->getMetadata()');
     $this->assertEquals(0, count($result->getMetadata()), 'count($result->getMetadata())');
     $props = $result->getProperties();
     $this->assertEquals('test', $props->getCacheControl(), '$props->getCacheControl()');
     $this->assertEquals('UTF-8', $props->getContentEncoding(), '$props->getContentEncoding()');
     $this->assertEquals('en-us', $props->getContentLanguage(), '$props->getContentLanguage()');
     $this->assertEquals('text/plain', $props->getContentType(), '$props->getContentType()');
     $this->assertEquals(4096, $props->getContentLength(), '$props->getContentLength()');
     $this->assertNotNull($props->getETag(), '$props->getETag()');
     $this->assertNull($props->getContentMD5(), '$props->getContentMD5()');
     $this->assertNotNull($props->getLastModified(), '$props->getLastModified()');
     $this->assertEquals('PageBlob', $props->getBlobType(), '$props->getBlobType()');
     $this->assertEquals('unlocked', $props->getLeaseStatus(), '$props->getLeaseStatus()');
     $this->assertEquals(0, $props->getSequenceNumber(), '$props->getSequenceNumber()');
     $this->assertEquals(4096, strlen(stream_get_contents($result->getContentStream())), 'strlen($result->getContentStream())');
 }