/** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlob * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_addOptionalRangeHeader * @covers MicrosoftAzure\Storage\Blob\Models\GetBlobResult::create */ public function testGetBlobWithEndRange() { // Setup $name = 'getblobwithendrange' . $this->createSuffix(); $blob = 'myblob'; $this->createContainer($name); $length = 512; $range = new PageRange(0, 511); $contentStream = Resources::EMPTY_STRING; $this->restProxy->createPageBlob($name, $blob, $length); for ($i = 0; $i < 512; $i++) { $contentStream .= 'A'; } $this->restProxy->createBlobPages($name, $blob, $range, $contentStream); $options = new GetBlobOptions(); $options->setRangeStart(null); $options->setRangeEnd(511); // Test $result = $this->restProxy->getBlob($name, $blob, $options); // Assert $this->assertEquals(BlobType::PAGE_BLOB, $result->getProperties()->getBlobType()); $this->assertEquals($contentStream, stream_get_contents($result->getContentStream())); }
public static function getGetBlobOptions() { $ret = array(); $options = new GetBlobOptions(); array_push($ret, $options); $options = new GetBlobOptions(); $options->setTimeout(10); array_push($ret, $options); $options = new GetBlobOptions(); $options->setTimeout(-10); array_push($ret, $options); // Get Blob only supports the temporal access conditions. foreach (self::getTemporalAccessConditions() as $ac) { $options = new GetBlobOptions(); $options->setAccessCondition($ac); array_push($ret, $options); } $options = new GetBlobOptions(); $options->setRangeStart(50); $options->setRangeEnd(200); array_push($ret, $options); $options = new GetBlobOptions(); $options->setRangeStart(50); $options->setRangeEnd(200); $options->setComputeRangeMD5(true); array_push($ret, $options); $options = new GetBlobOptions(); $options->setRangeStart(50); array_push($ret, $options); $options = new GetBlobOptions(); $options->setComputeRangeMD5(true); array_push($ret, $options); $options = new GetBlobOptions(); $options->setRangeEnd(200); $options->setComputeRangeMD5(true); array_push($ret, $options); $options = new GetBlobOptions(); $options->setRangeEnd(200); array_push($ret, $options); $options = new GetBlobOptions(); $options->setSnapshot('placeholder'); array_push($ret, $options); // TODO: Handle Lease ID // $options = new GetBlobOptions(); // $options->setLeaseId('setLeaseId'); // array_push($ret, $options); return $ret; }
/** * @covers MicrosoftAzure\Storage\Blob\Models\GetBlobOptions::setRangeEnd * @covers MicrosoftAzure\Storage\Blob\Models\GetBlobOptions::getRangeEnd */ public function testSetRangeEnd() { // Setup $expected = 123; $prooperties = new GetBlobOptions(); $prooperties->setRangeEnd($expected); // Test $prooperties->setRangeEnd($expected); // Assert $this->assertEquals($expected, $prooperties->getRangeEnd()); }