/** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlob * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::deleteBlob * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobs */ public function testListBlobsWithOptionsWorks() { // Arrange $blobNames = array('myblob1', 'myblob2', 'otherblob1', 'otherblob2'); foreach ($blobNames as $blob) { $this->restProxy->createPageBlob(self::$_test_container_for_listing, $blob, 512); } // Act $opts = new ListBlobsOptions(); $opts->setIncludeMetadata(true); $opts->setIncludeSnapshots(true); $results = $this->restProxy->listBlobs(self::$_test_container_for_listing, $opts); foreach ($blobNames as $blob) { $this->restProxy->deleteBlob(self::$_test_container_for_listing, $blob); } // Assert $this->assertNotNull($results, '$results'); $this->assertEquals(4, count($results->getBlobs()), 'count($results->getBlobs())'); }
/** * @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsOptions::getIncludeMetadata */ public function testGetIncludeMetadata() { // Setup $options = new ListBlobsOptions(); $expected = true; $options->setIncludeMetadata($expected); // Test $actual = $options->getIncludeMetadata(); // Assert $this->assertEquals($expected, $actual); }
/** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobs */ public function testListBlobsWithOptionsWithDelimiter() { $this->skipIfEmulated(); // Setup $name = 'listblobswithoptionswithdelimiter' . $this->createSuffix(); $blob1 = 'blob1'; $blob2 = 'blob2'; $blob3 = 'blob3'; $blob4 = 'lblob1'; $blob5 = 'lblob2'; $blob6 = 'lblob3'; $length = 512; $options = new ListBlobsOptions(); $options->setDelimiter('b'); $options->setIncludeMetadata(true); $options->setIncludeUncommittedBlobs(true); $options->setMaxResults(10); $this->createContainer($name); $this->restProxy->createPageBlob($name, $blob1, $length); $this->restProxy->createPageBlob($name, $blob2, $length); $this->restProxy->createPageBlob($name, $blob3, $length); $this->restProxy->createPageBlob($name, $blob4, $length); $this->restProxy->createPageBlob($name, $blob5, $length); $this->restProxy->createPageBlob($name, $blob6, $length); // Test $result = $this->restProxy->listBlobs($name, $options); // Assert $this->assertCount(0, $result->getBlobs()); $this->assertCount(2, $result->getBlobPrefixes()); }