/**
  * @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions::setSequenceNumber
  * @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions::getSequenceNumber
  */
 public function testSetSequenceNumber()
 {
     // Setup
     $expected = 123;
     $options = new CreateBlobOptions();
     $options->setSequenceNumber($expected);
     // Test
     $options->setSequenceNumber($expected);
     // Assert
     $this->assertEquals($expected, $options->getSequenceNumber());
 }
Ejemplo n.º 2
0
 /**
  * Creates a new page blob. Note that calling createPageBlob to create a page
  * blob only initializes the blob.
  * To add content to a page blob, call createBlobPages method.
  * 
  * @param string                   $container The container name.
  * @param string                   $blob      The blob name.
  * @param integer                  $length    Specifies the maximum size for the
  * page blob, up to 1 TB. The page blob size must be aligned to a 512-byte 
  * boundary.
  * @param Models\CreateBlobOptions $options   The optional parameters.
  * 
  * @return CopyBlobResult
  * 
  * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx
  */
 public function createPageBlob($container, $blob, $length, $options = null)
 {
     Validate::isString($container, 'container');
     Validate::isString($blob, 'blob');
     Validate::notNullOrEmpty($blob, 'blob');
     Validate::isInteger($length, 'length');
     Validate::notNull($length, 'length');
     $method = Resources::HTTP_PUT;
     $headers = array();
     $postParams = array();
     $queryParams = array();
     $path = $this->_createPath($container, $blob);
     $statusCode = Resources::STATUS_CREATED;
     if (is_null($options)) {
         $options = new CreateBlobOptions();
     }
     $this->addOptionalHeader($headers, Resources::X_MS_BLOB_TYPE, BlobType::PAGE_BLOB);
     $this->addOptionalHeader($headers, Resources::X_MS_BLOB_CONTENT_LENGTH, $length);
     $this->addOptionalHeader($headers, Resources::X_MS_BLOB_SEQUENCE_NUMBER, $options->getSequenceNumber());
     $headers = $this->_addCreateBlobOptionalHeaders($options, $headers);
     $this->addOptionalQueryParam($queryParams, Resources::QP_TIMEOUT, $options->getTimeout());
     $response = $this->send($method, $headers, $queryParams, $postParams, $path, $statusCode);
     return CopyBlobResult::create(HttpFormatter::formatHeaders($response->getHeaders()));
 }