/**
  * @covers WindowsAzure\Blob\Models\CreateBlobSnapshotOptions::setMetadata
  * @covers WindowsAzure\Blob\Models\CreateBlobSnapshotOptions::getMetadata
  */
 public function testSetMetadata()
 {
     $createBlobSnapshotOptions = new CreateBlobSnapshotOptions();
     $expected = array('key1' => 'value1', 'key2' => 'value2');
     $createBlobSnapshotOptions->setMetadata($expected);
     $this->assertEquals($expected, $createBlobSnapshotOptions->getMetadata());
 }
 public static function getCreateBlobSnapshotOptions()
 {
     $ret = array();
     $options = new CreateBlobSnapshotOptions();
     array_push($ret, $options);
     $options = new CreateBlobSnapshotOptions();
     $options->setTimeout(10);
     array_push($ret, $options);
     $options = new CreateBlobSnapshotOptions();
     $options->setTimeout(-10);
     array_push($ret, $options);
     foreach (self::getAllAccessConditions() as $ac) {
         $options = new CreateBlobSnapshotOptions();
         $options->setAccessCondition($ac);
         array_push($ret, $options);
     }
     $options = new CreateBlobSnapshotOptions();
     $options->setMetadata(self::getNiceMetadata());
     array_push($ret, $options);
     // TODO: Handle Lease ID
     //        $options = new CreateBlobSnapshotOptions();
     //        $options->setLeaseId('setLeaseId');
     //        array_push($ret, $options);
     return $ret;
 }
 /**
  * @covers WindowsAzure\Blob\BlobRestProxy::createBlobSnapshot
  * @covers WindowsAzure\Blob\BlobRestProxy::createBlockBlob
  * @covers WindowsAzure\Blob\BlobRestProxy::getBlobProperties
  */
 public function testCreateBlobSnapshotWithOptionsWorks()
 {
     // Act
     $container = self::$_test_container_for_blobs;
     $blob = 'test3';
     $this->restProxy->createBlockBlob($container, $blob, 'some content');
     $opts = new CreateBlobSnapshotOptions();
     $metadata = array('test' => 'bar', 'blah' => 'bleah');
     $opts->setMetadata($metadata);
     $snapshot = $this->restProxy->createBlobSnapshot($container, $blob, $opts);
     $opts = new GetBlobPropertiesOptions();
     $opts->setSnapshot($snapshot->getSnapshot());
     $result = $this->restProxy->getBlobProperties($container, $blob, $opts);
     // Assert
     $this->assertNotNull($result, '$result');
     $this->assertEquals($snapshot->getETag(), $result->getProperties()->getETag(), '$result->getProperties()->getETag()');
     $this->assertEquals($snapshot->getLastModified(), $result->getProperties()->getLastModified(), '$result->getProperties()->getLastModified()');
     // The capitalizaion gets changed.
     $this->assertTrue(Utilities::arrayKeyExistsInsensitive('test', $result->getMetadata()), 'Utilities::arrayKeyExistsInsensitive(\'test\', $result->getMetadata())');
     $this->assertTrue(!(array_search('bar', $result->getMetadata()) === FALSE), '!(array_search(\'bar\', $result->getMetadata()) === FALSE)');
     $this->assertTrue(Utilities::arrayKeyExistsInsensitive('blah', $result->getMetadata()), 'Utilities::arrayKeyExistsInsensitive(\'blah\', $result->getMetadata())');
     $this->assertTrue(!(array_search('bleah', $result->getMetadata()) === FALSE), '!(array_search(\'bleah\', $result->getMetadata()) === FALSE)');
 }