/** * @covers WindowsAzure\Blob\Models\ListBlobBlocksOptions::getSnapshot * @covers WindowsAzure\Blob\Models\ListBlobBlocksOptions::__construct */ public function testGetSnapshot() { // Setup $blob = new ListBlobBlocksOptions(); $expected = TestResources::QUEUE_URI; $blob->setSnapshot($expected); // Test $actual = $blob->getSnapshot(); // Assert $this->assertEquals($expected, $actual); }
/** * Retrieves the list of blocks that have been uploaded as part of a block blob. * * There are two block lists maintained for a blob: * 1) Committed Block List: The list of blocks that have been successfully * committed to a given blob with commitBlobBlocks. * 2) Uncommitted Block List: The list of blocks that have been uploaded for a * blob using Put Block (REST API), but that have not yet been committed. * These blocks are stored in Windows Azure in association with a blob, but do * not yet form part of the blob. * * @param string $container name of the container * @param string $blob name of the blob * @param Models\ListBlobBlocksOptions $options optional parameters * * @return Models\ListBlobBlocksResult * * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179400.aspx */ public function listBlobBlocks($container, $blob, $options = null) { Validate::isString($container, 'container'); Validate::isString($blob, 'blob'); Validate::notNullOrEmpty($blob, 'blob'); $method = Resources::HTTP_GET; $headers = array(); $postParams = array(); $queryParams = array(); $path = $this->_createPath($container, $blob); $statusCode = Resources::STATUS_OK; if (is_null($options)) { $options = new ListBlobBlocksOptions(); } $this->addOptionalHeader($headers, Resources::X_MS_LEASE_ID, $options->getLeaseId()); $this->addOptionalQueryParam($queryParams, Resources::QP_TIMEOUT, $options->getTimeout()); $this->addOptionalQueryParam($queryParams, Resources::QP_BLOCK_LIST_TYPE, $options->getBlockListType()); $this->addOptionalQueryParam($queryParams, Resources::QP_SNAPSHOT, $options->getSnapshot()); $this->addOptionalQueryParam($queryParams, Resources::QP_COMP, 'blocklist'); $response = $this->send($method, $headers, $queryParams, $postParams, $path, $statusCode); $parsed = $this->dataSerializer->unserialize($response->getBody()); return ListBlobBlocksResult::create($response->getHeader(), $parsed); }