示例#1
0
 /**
  * Creates block list from array of blocks.
  * 
  * @param array $array The blocks array.
  * 
  * @return BlockList
  */
 public static function create($array)
 {
     $blockList = new BlockList();
     foreach ($array as $value) {
         $blockList->addEntry($value->getBlockId(), $value->getType());
     }
     return $blockList;
 }
示例#2
0
 /**
  * @covers MicrosoftAzure\Storage\Blob\Models\BlockList::getEntries
  */
 public function testGetEntries()
 {
     // Setup
     $expectedId = '1234';
     $expectedType = BlobBlockType::COMMITTED_TYPE;
     $blockList = new BlockList();
     $blockList->addEntry($expectedId, $expectedType);
     // Test
     $entries = $blockList->getEntries();
     // Assert
     $this->assertCount(1, $entries);
 }
 /**
  * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::commitBlobBlocks
  * @covers MicrosoftAzure\Storage\Blob\Models\BlockList::toXml
  */
 public function testCommitBlobBlocks()
 {
     // Setup
     $name = 'commitblobblocks' . $this->createSuffix();
     $blob = 'myblob';
     $id1 = 'AAAAAA==';
     $id2 = 'ANAAAA==';
     $this->createContainer($name);
     $this->restProxy->createBlobBlock($name, $blob, $id1, 'Hello world');
     $this->restProxy->createBlobBlock($name, $blob, $id2, 'Hello world');
     $blockList = new BlockList();
     $blockList->addEntry($id1, BlobBlockType::LATEST_TYPE);
     $blockList->addEntry($id2, BlobBlockType::LATEST_TYPE);
     // Test
     $this->restProxy->commitBlobBlocks($name, $blob, $blockList);
     // Assert
     $result = $this->restProxy->listBlobs($name);
     $this->assertCount(1, $result->getBlobs());
 }