From b3c5f7ae5144e1fadd59e98ec750c5d0cd05e77a Mon Sep 17 00:00:00 2001 From: Tank Tang Date: Wed, 12 Jul 2017 09:44:44 +0800 Subject: [PATCH] Refine test code for better coverage and structure. --- src/Blob/BlobRestProxy.php | 30 +- src/Blob/Internal/IBlob.php | 18 +- src/Blob/Models/AppendBlockOptions.php | 18 +- src/Blob/Models/BlockList.php | 10 +- src/Blob/Models/LeaseResult.php | 6 +- src/Blob/Models/ListBlobBlocksResult.php | 42 +- .../Internal/Serialization/XmlSerializer.php | 16 +- .../Blob/BlobServiceFunctionalTest.php | 520 ++++++++++- .../Blob/BlobServiceFunctionalTestData.php | 150 ++- .../Queue/QueueServiceFunctionalTest.php | 174 ++-- .../Table/TableServiceFunctionalTest.php | 225 +++-- tests/unit/Blob/BlobRestProxyTest.php | 858 +++--------------- .../Blob/Models/ListBlobBlocksResultTest.php | 2 +- 13 files changed, 1091 insertions(+), 978 deletions(-) diff --git a/src/Blob/BlobRestProxy.php b/src/Blob/BlobRestProxy.php index 56736f4..048f936 100644 --- a/src/Blob/BlobRestProxy.php +++ b/src/Blob/BlobRestProxy.php @@ -120,7 +120,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob } /** - * Set the value for SingleBlobUploadThresholdInBytes, Max 64MB + * Set the value for SingleBlobUploadThresholdInBytes, Max 256MB * * @param int $val The max size to send as a single blob block * @@ -560,7 +560,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob * @param string $action Either clear or create. * @param string $container The container name. * @param string $blob The blob name. - * @param Range $range The page ranges. + * @param Range $range The page ranges. * @param string $content The content string. * @param CreateBlobPagesOptions $options The optional parameters. * @@ -2459,7 +2459,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob * * @param string $container The container name. * @param string $blob The blob name. - * @param Models\BlockList|array $blockList The block entries. + * @param Models\BlockList|Block[] $blockList The block entries. * @param Models\CommitBlobBlocksOptions $options The optional parameters. * * @return Models\PutBlobResult @@ -2493,7 +2493,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob * * @param string $container The container name. * @param string $blob The blob name. - * @param Models\BlockList|array $blockList The block entries. + * @param Models\BlockList|Block[] $blockList The block entries. * @param Models\CommitBlobBlocksOptions $options The optional parameters. * * @return \GuzzleHttp\Promise\PromiseInterface @@ -3816,9 +3816,12 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob * @param string $container name of the container * @param string $blob name of the blob * @param string $proposedLeaseId lease id when acquiring - * @param int $leaseDuration the lease duration. A non-infinite - * lease can be between 15 and 60 seconds. - * Default is never to expire. + * @param int $leaseDuration the lease duration. + * A non-infinite + * lease can be between + * 15 and 60 seconds. + * Default is never + * to expire. * @param Models\BlobServiceOptions $options optional parameters * * @return Models\LeaseResult @@ -3848,9 +3851,12 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob * @param string $container name of the container * @param string $blob name of the blob * @param string $proposedLeaseId lease id when acquiring - * @param int $leaseDuration the lease duration. A non-infinite - * lease can be between 15 and 60 seconds. - * Default is never to expire. + * @param int $leaseDuration the lease duration. + * A non-infinite + * lease can be between + * 15 and 60 seconds. + * Default is never to + * expire. * @param Models\BlobServiceOptions $options optional parameters * * @return \GuzzleHttp\Promise\PromiseInterface @@ -4171,8 +4177,8 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob /** * Adds optional header to headers if set * - * @param array $headers The array of request headers. - * @param array $accessCondition The access condition object. + * @param array $headers The array of request headers. + * @param array $accessCondition The access condition object. * * @return array */ diff --git a/src/Blob/Internal/IBlob.php b/src/Blob/Internal/IBlob.php index 72bdcbb..8cf605d 100644 --- a/src/Blob/Internal/IBlob.php +++ b/src/Blob/Internal/IBlob.php @@ -762,10 +762,10 @@ interface IBlob * block list or from the uncommitted block list, or to commit the most recently * uploaded version of the block, whichever list it may belong to. * - * @param string $container name of the container - * @param string $blob name of the blob - * @param BlobModels\BlockList|array $blockList the block list entries - * @param BlobModels\CommitBlobBlocksOptions $options optional parameters + * @param string $container name of the container + * @param string $blob name of the blob + * @param BlobModels\BlockList|BlobModels\Block[] $blockList the block list entries + * @param BlobModels\CommitBlobBlocksOptions $options optional parameters * * @return BlobModels\PutBlobResult * @@ -789,11 +789,11 @@ interface IBlob * block list or from the uncommitted block list, or to commit the most recently * uploaded version of the block, whichever list it may belong to. * - * @param string $container The container name. - * @param string $blob The blob name. - * @param BlobModels\BlockList|array $blockList The block entries. - * @param BlobModels\CommitBlobBlocksOptions $options The optional - * parameters. + * @param string $container name of the container + * @param string $blob name of the blob + * @param BlobModels\BlockList|BlobModels\Block[] $blockList the block list + * entries + * @param BlobModels\CommitBlobBlocksOptions $options optional parameters * * @return \GuzzleHttp\Promise\PromiseInterface * diff --git a/src/Blob/Models/AppendBlockOptions.php b/src/Blob/Models/AppendBlockOptions.php index 8091dbb..087b751 100644 --- a/src/Blob/Models/AppendBlockOptions.php +++ b/src/Blob/Models/AppendBlockOptions.php @@ -36,9 +36,9 @@ namespace MicrosoftAzure\Storage\Blob\Models; */ class AppendBlockOptions extends BlobServiceOptions { - private $_contentMD5; - private $_maxBlobSize; - private $_appendPosition; + private $contentMD5; + private $maxBlobSize; + private $appendPosition; /** * Gets block contentMD5. @@ -47,7 +47,7 @@ class AppendBlockOptions extends BlobServiceOptions */ public function getContentMD5() { - return $this->_contentMD5; + return $this->contentMD5; } /** @@ -59,7 +59,7 @@ class AppendBlockOptions extends BlobServiceOptions */ public function setContentMD5($contentMD5) { - $this->_contentMD5 = $contentMD5; + $this->contentMD5 = $contentMD5; } /** @@ -69,7 +69,7 @@ class AppendBlockOptions extends BlobServiceOptions */ public function getMaxBlobSize() { - return $this->_maxBlobSize; + return $this->maxBlobSize; } /** @@ -81,7 +81,7 @@ class AppendBlockOptions extends BlobServiceOptions */ public function setMaxBlobSize($maxBlobSize) { - $this->_maxBlobSize = $maxBlobSize; + $this->maxBlobSize = $maxBlobSize; } /** @@ -91,7 +91,7 @@ class AppendBlockOptions extends BlobServiceOptions */ public function getAppendPosition() { - return $this->_appendPosition; + return $this->appendPosition; } /** @@ -103,6 +103,6 @@ class AppendBlockOptions extends BlobServiceOptions */ public function setAppendPosition($appendPosition) { - $this->_appendPosition = $appendPosition; + $this->appendPosition = $appendPosition; } } diff --git a/src/Blob/Models/BlockList.php b/src/Blob/Models/BlockList.php index 528c576..50c8385 100644 --- a/src/Blob/Models/BlockList.php +++ b/src/Blob/Models/BlockList.php @@ -40,7 +40,7 @@ use MicrosoftAzure\Storage\Common\Internal\Serialization\XmlSerializer; */ class BlockList { - private $_entries; + private $entries; private static $xmlRootName = 'BlockList'; /** @@ -80,7 +80,7 @@ class BlockList $block->setBlockId($blockId); $block->setType($type); - $this->_entries[] = $block; + $this->entries[] = $block; } /** @@ -128,7 +128,7 @@ class BlockList */ public function getEntry($blockId) { - foreach ($this->_entries as $value) { + foreach ($this->entries as $value) { if ($blockId == $value->getBlockId()) { return $value; } @@ -144,7 +144,7 @@ class BlockList */ public function getEntries() { - return $this->_entries; + return $this->entries; } /** @@ -161,7 +161,7 @@ class BlockList $properties = array(XmlSerializer::ROOT_NAME => self::$xmlRootName); $array = array(); - foreach ($this->_entries as $value) { + foreach ($this->entries as $value) { $array[] = array( $value->getType() => $value->getBlockId() ); diff --git a/src/Blob/Models/LeaseResult.php b/src/Blob/Models/LeaseResult.php index 0e7c4b9..d60444c 100644 --- a/src/Blob/Models/LeaseResult.php +++ b/src/Blob/Models/LeaseResult.php @@ -39,7 +39,7 @@ use MicrosoftAzure\Storage\Common\Internal\Utilities; */ class LeaseResult { - private $_leaseId; + private $leaseId; /** * Creates LeaseResult from response headers @@ -68,7 +68,7 @@ class LeaseResult */ public function getLeaseId() { - return $this->_leaseId; + return $this->leaseId; } /** @@ -80,6 +80,6 @@ class LeaseResult */ protected function setLeaseId($leaseId) { - $this->_leaseId = $leaseId; + $this->leaseId = $leaseId; } } diff --git a/src/Blob/Models/ListBlobBlocksResult.php b/src/Blob/Models/ListBlobBlocksResult.php index f27b132..95dda30 100644 --- a/src/Blob/Models/ListBlobBlocksResult.php +++ b/src/Blob/Models/ListBlobBlocksResult.php @@ -40,12 +40,12 @@ use MicrosoftAzure\Storage\Common\Internal\Utilities; */ class ListBlobBlocksResult { - private $_lastModified; - private $_etag; - private $_contentType; - private $_contentLength; - private $_committedBlocks; - private $_uncommittedBlocks; + private $lastModified; + private $etag; + private $contentType; + private $contentLength; + private $committedBlocks; + private $uncommittedBlocks; /** * Gets block entries from parsed response @@ -55,7 +55,7 @@ class ListBlobBlocksResult * * @return array */ - private static function _getEntries(array $parsed, $type) + private static function getEntries(array $parsed, $type) { $entries = array(); @@ -107,11 +107,11 @@ class ListBlobBlocksResult Utilities::tryGetValue($clean, Resources::CONTENT_TYPE) ); - $result->_uncommittedBlocks = self::_getEntries( + $result->uncommittedBlocks = self::getEntries( $parsed, 'UncommittedBlocks' ); - $result->_committedBlocks = self::_getEntries($parsed, 'CommittedBlocks'); + $result->committedBlocks = self::getEntries($parsed, 'CommittedBlocks'); return $result; } @@ -123,7 +123,7 @@ class ListBlobBlocksResult */ public function getLastModified() { - return $this->_lastModified; + return $this->lastModified; } /** @@ -136,7 +136,7 @@ class ListBlobBlocksResult protected function setLastModified(\DateTime $lastModified) { Validate::isDate($lastModified); - $this->_lastModified = $lastModified; + $this->lastModified = $lastModified; } /** @@ -146,7 +146,7 @@ class ListBlobBlocksResult */ public function getETag() { - return $this->_etag; + return $this->etag; } /** @@ -158,7 +158,7 @@ class ListBlobBlocksResult */ protected function setETag($etag) { - $this->_etag = $etag; + $this->etag = $etag; } /** @@ -168,7 +168,7 @@ class ListBlobBlocksResult */ public function getContentType() { - return $this->_contentType; + return $this->contentType; } /** @@ -180,7 +180,7 @@ class ListBlobBlocksResult */ protected function setContentType($contentType) { - $this->_contentType = $contentType; + $this->contentType = $contentType; } /** @@ -190,7 +190,7 @@ class ListBlobBlocksResult */ public function getContentLength() { - return $this->_contentLength; + return $this->contentLength; } /** @@ -203,7 +203,7 @@ class ListBlobBlocksResult protected function setContentLength($contentLength) { Validate::isInteger($contentLength, 'contentLength'); - $this->_contentLength = $contentLength; + $this->contentLength = $contentLength; } /** @@ -213,7 +213,7 @@ class ListBlobBlocksResult */ public function getUncommittedBlocks() { - return $this->_uncommittedBlocks; + return $this->uncommittedBlocks; } /** @@ -225,7 +225,7 @@ class ListBlobBlocksResult */ protected function setUncommittedBlocks(array $uncommittedBlocks) { - $this->_uncommittedBlocks = $uncommittedBlocks; + $this->uncommittedBlocks = $uncommittedBlocks; } /** @@ -235,7 +235,7 @@ class ListBlobBlocksResult */ public function getCommittedBlocks() { - return $this->_committedBlocks; + return $this->committedBlocks; } /** @@ -247,6 +247,6 @@ class ListBlobBlocksResult */ protected function setCommittedBlocks(array $committedBlocks) { - $this->_committedBlocks = $committedBlocks; + $this->committedBlocks = $committedBlocks; } } diff --git a/src/Common/Internal/Serialization/XmlSerializer.php b/src/Common/Internal/Serialization/XmlSerializer.php index 650560c..df0e23d 100644 --- a/src/Common/Internal/Serialization/XmlSerializer.php +++ b/src/Common/Internal/Serialization/XmlSerializer.php @@ -54,11 +54,11 @@ class XmlSerializer implements ISerializer * * @return array */ - private function _sxml2arr($sxml, array $arr = null) + private function sxml2arr($sxml, array $arr = null) { foreach ((array) $sxml as $key => $value) { if (is_object($value) || (is_array($value))) { - $arr[$key] = $this->_sxml2arr($value); + $arr[$key] = $this->sxml2arr($value); } else { $arr[$key] = $value; } @@ -77,7 +77,7 @@ class XmlSerializer implements ISerializer * * @return void */ - private function _arr2xml(\XMLWriter $xmlw, array $data, $defaultTag = null) + private function arr2xml(\XMLWriter $xmlw, array $data, $defaultTag = null) { foreach ($data as $key => $value) { if ($key === Resources::XTAG_ATTRIBUTES) { @@ -93,7 +93,7 @@ class XmlSerializer implements ISerializer } } - $this->_arr2xml($xmlw, $value); + $this->arr2xml($xmlw, $value); if (!is_int($key)) { $xmlw->endElement(); @@ -113,7 +113,7 @@ class XmlSerializer implements ISerializer * * @return mixed */ - private static function _getInstanceAttributes($targetObject, array $methodArray) + private static function getInstanceAttributes($targetObject, array $methodArray) { foreach ($methodArray as $method) { if ($method->name == 'getAttributes') { @@ -141,7 +141,7 @@ class XmlSerializer implements ISerializer $xmlWriter->setIndent(true); $reflectionClass = new \ReflectionClass($targetObject); $methodArray = $reflectionClass->getMethods(); - $attributes = self::_getInstanceAttributes( + $attributes = self::getInstanceAttributes( $targetObject, $methodArray ); @@ -222,7 +222,7 @@ class XmlSerializer implements ISerializer } unset($array[Resources::XTAG_NAMESPACE]); - self::_arr2xml($xmlw, $array, $defaultTag); + self::arr2xml($xmlw, $array, $defaultTag); $xmlw->endElement(); @@ -240,6 +240,6 @@ class XmlSerializer implements ISerializer { $sxml = new \SimpleXMLElement($serialized); - return $this->_sxml2arr($sxml); + return $this->sxml2arr($sxml); } } diff --git a/tests/functional/Blob/BlobServiceFunctionalTest.php b/tests/functional/Blob/BlobServiceFunctionalTest.php index 26e7b2c..9110b94 100644 --- a/tests/functional/Blob/BlobServiceFunctionalTest.php +++ b/tests/functional/Blob/BlobServiceFunctionalTest.php @@ -27,14 +27,23 @@ namespace MicrosoftAzure\Storage\Tests\functional\Blob; use MicrosoftAzure\Storage\Tests\Framework\TestResources; use MicrosoftAzure\Storage\Blob\Models\BlobServiceOptions; use MicrosoftAzure\Storage\Blob\Models\CopyBlobOptions; +use MicrosoftAzure\Storage\Blob\Models\BlobType; +use MicrosoftAzure\Storage\Blob\Models\BlobBlockType; +use MicrosoftAzure\Storage\Blob\Models\Block; +use MicrosoftAzure\Storage\Blob\Models\BlockList; use MicrosoftAzure\Storage\Blob\Models\CreateBlobSnapshotOptions; use MicrosoftAzure\Storage\Blob\Models\CreateContainerOptions; +use MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions; use MicrosoftAzure\Storage\Blob\Models\DeleteBlobOptions; use MicrosoftAzure\Storage\Blob\Models\GetBlobMetadataOptions; +use MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesOptions; use MicrosoftAzure\Storage\Blob\Models\GetBlobOptions; use MicrosoftAzure\Storage\Blob\Models\GetBlobPropertiesOptions; +use MicrosoftAzure\Storage\Blob\Models\AppendBlockOptions; +use MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesOptions; use MicrosoftAzure\Storage\Blob\Models\ListBlobsOptions; use MicrosoftAzure\Storage\Blob\Models\ListContainersOptions; +use MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksOptions; use MicrosoftAzure\Storage\Blob\Models\PublicAccessType; use MicrosoftAzure\Storage\Common\Exceptions\ServiceException; use MicrosoftAzure\Storage\Common\Internal\Resources; @@ -3034,18 +3043,505 @@ class BlobServiceFunctionalTest extends FunctionalTestBase ); } - // createBlockBlob - // createBlobBlock - // commitBlobBlocks - // listBlobBlocks + /** + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlobAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobAsync + */ + public function testCreateBlockBlobNormal() + { + $attrs = BlobServiceFunctionalTestData::getCreateBlockBlobAttributes(); + $container = BlobServiceFunctionalTestData::getContainerName(); - // createPageBlob - // createBlobPages - // clearBlobPages - // listBlobRegions + foreach ($attrs as $attr) { + $threshold = array_key_exists('threshold', $attr)? + $attr['threshold'] : Resources::MB_IN_BYTES_32; + $size = $attr['size']; + $this->createBlockBlobWorker($container, $threshold, $size); + } + } - // acquireLease - // renewLease - // releaseLease - // breakLease + private function createBlockBlobWorker($container, $threshold, $size) + { + //create a temp file of size $size. + $cwd = getcwd(); + $uuid = uniqid('test-file-', true); + $path = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; + $resource = fopen($path, 'w+'); + + $count = $size / Resources::MB_IN_BYTES_32; + for ($i = 0; $i < $count; ++$i) { + fwrite($resource, openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_32)); + } + $remain = $size - (Resources::MB_IN_BYTES_32 * $count); + fwrite($resource, openssl_random_pseudo_bytes($remain)); + rewind($resource); + + //upload the blob + $blobName = BlobServiceFunctionalTestData::getInterestingBlobName($container); + $metadata = array('m1' => 'v1', 'm2' => 'v2'); + $contentType = 'text/plain; charset=UTF-8'; + $options = new CreateBlobOptions(); + $options->setContentType($contentType); + $options->setMetadata($metadata); + $this->restProxy->setSingleBlobUploadThresholdInBytes($threshold); + $this->restProxy->createBlockBlob( + $container, + $blobName, + $resource, + $options + ); + + // Test + $result = $this->restProxy->getBlob($container, $blobName); + + //get the path for the file to be downloaded into. + $uuid = uniqid('test-file-', true); + $downloadPath = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; + $downloadResource = fopen($downloadPath, 'w'); + //download the file + $content = $result->getContentStream(); + + while (!feof($content)) { + fwrite( + $downloadResource, + stream_get_contents($content, Resources::MB_IN_BYTES_32) + ); + } + + // Assert + $this->assertEquals( + BlobType::BLOCK_BLOB, + $result->getProperties()->getBlobType() + ); + $this->assertEquals($metadata, $result->getMetadata()); + $originMd5 = md5_file($path); + $downloadMd5 = md5_file($downloadPath); + $this->assertEquals($originMd5, $downloadMd5); + + //clean-up. + if (is_resource($resource)) { + fclose($resource); + } + fclose($downloadResource); + unlink($path); + unlink($downloadPath); + } + + /** + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlobAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobBlock + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobBlockAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::commitBlobBlocks + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::commitBlobBlocksAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobBlocks + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobBlocksAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobProperties + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobPropertiesAsync + */ + public function testBlockBlobBlocks() + { + //create block blob + $container = BlobServiceFunctionalTestData::getContainerName(); + $blob = BlobServiceFunctionalTestData::getInterestingBlobName($container); + $this->restProxy->createBlockBlob($container, $blob, ''); + + //create blocks + $blockIds = array(); + $contents = array(); + for ($i = 0; $i < 5; ++$i) { + $blockId = BlobServiceFunctionalTestData::getInterestingBlockId(); + $content = openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_4); + $this->restProxy->createBlobBlock($container, $blob, $blockId, $content); + $blockIds[] = $blockId; + $contents[] = $content; + } + $this->verifyBlocks($container, $blob, $blockIds, false); + //commit blocks 1 and 3. + $latest = BlobBlockType::LATEST_TYPE; + $committed = BlobBlockType::COMMITTED_TYPE; + $blockList = [ + new Block($blockIds[1], $latest), + new Block($blockIds[3], $latest) + ]; + $this->restProxy->commitBlobBlocks($container, $blob, $blockList); + //verify MD5 and uncommitted. + $this->verifyBlobMd5($container, $blob, $contents[1] . $contents[3]); + $this->verifyBlocks( + $container, + $blob, + [$blockIds[1], $blockIds[3]] + ); + + //update blob with blocks 3 and 4. + for ($i = 0; $i < 5; ++$i) { + $this->restProxy->createBlobBlock( + $container, + $blob, + $blockIds[$i], + $contents[$i] + ); + } + $blockList = [ + new Block($blockIds[3], $latest), + new Block($blockIds[4], $latest), + ]; + $this->restProxy->commitBlobBlocks($container, $blob, $blockList); + //verify MD5 and uncommitted. + $this->verifyBlobMd5($container, $blob, $contents[3] . $contents[4]); + $this->verifyBlocks( + $container, + $blob, + [$blockIds[3], $blockIds[4]] + ); + + //commit a blob with same id with block 3 + $this->restProxy->createBlobBlock($container, $blob, $blockIds[0], $contents[0]); + $content = openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_4); + $this->restProxy->createBlobBlock($container, $blob, $blockIds[3], $content); + //test BlobBlockType::COMMITTED_TYPE + $blockList = [ + new Block($blockIds[3], $committed), + new Block($blockIds[0], $latest), + ]; + $this->restProxy->commitBlobBlocks($container, $blob, $blockList); + //verify MD5 and uncommitted. + $this->verifyBlobMd5($container, $blob, $contents[3] . $contents[0]); + $this->verifyBlocks( + $container, + $blob, + [$blockIds[0], $blockIds[3]] + ); + //test BlobBlockType::LATEST_TYPE + $this->restProxy->createBlobBlock($container, $blob, $blockIds[0], $contents[0]); + $content = openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_4); + $this->restProxy->createBlobBlock($container, $blob, $blockIds[3], $content); + $blockList = [ + new Block($blockIds[3], $latest), + new Block($blockIds[0], $latest), + ]; + $this->restProxy->commitBlobBlocks($container, $blob, $blockList); + //verify MD5 and uncommitted. + $this->verifyBlobMd5($container, $blob, $content . $contents[0]); + $this->verifyBlocks( + $container, + $blob, + [$blockIds[3], $blockIds[0]] + ); + } + + private function verifyBlobMd5($container, $blob, $content) + { + $c = stream_get_contents($this->restProxy->getBlob($container, $blob)->getContentStream()); + $expectedMd5 = md5($content); + $actualMd5 = md5($c); + $this->assertEquals($expectedMd5, $actualMd5); + } + + private function verifyBlocks($container, $blob, $list, $isCommitted = true) + { + $options = new ListBlobBlocksOptions(); + if ($isCommitted) { + $options->setIncludeCommittedBlobs(true); + } else { + $options->setIncludeUncommittedBlobs(true); + } + $result = $this->restProxy->listBlobBlocks($container, $blob, $options); + $blocks = $isCommitted? $result->getCommittedBlocks() : $result->getUncommittedBlocks(); + foreach ($list as $blockId) { + $this->assertTrue(array_key_exists($blockId, $blocks)); + } + } + + /** + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlobAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobPages + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobPagesAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::clearBlobPages + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::clearBlobPagesAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listPageBlobRanges + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listPageBlobRangesAsync + */ + public function testPutListClearPageRanges() + { + $rangesArray = BlobServiceFunctionalTestData::getRangesArray(); + $container = BlobServiceFunctionalTestData::getInterestingContainerName(); + $this->createContainer($container); + $blob = BlobServiceFunctionalTestData::getInterestingBlobName($container); + $this->restProxy->createPageBlob($container, $blob, 2048); + foreach ($rangesArray as $array) { + $this->putListClearPageRangesWorker( + $container, + $blob, + $array['putRange'], + $array['clearRange'], + $array['listRange'], + $array['resultListRange'] + ); + } + $this->deleteContainer($container); + } + + private function putListClearPageRangesWorker( + $container, + $blob, + $putRange, + $clearRange, + $listRange, + $resultListRange + ) { + if ($putRange != null) { + $length = $putRange->getLength(); + if ($length == null) { + $length = 2048 - $putRange->getStart(); + } + $content = \openssl_random_pseudo_bytes($length); + $options = new CreateBlobPagesOptions(); + //setting the wrong md5. + $options->setContentMD5(Utilities::calculateContentMD5('')); + $message = ''; + try { + $this->restProxy->createBlobPages( + $container, + $blob, + $putRange, + $content, + $options + ); + } catch (ServiceException $e) { + $message = $e->getMessage(); + } + $this->assertContains('400', $message); + $this->assertContains( + 'The MD5 value specified in the request did not match with the MD5 value calculated by the server.', + $message + ); + //Ends debug code snippet + // Now set the correct content MD5 + $options->setContentMD5(Utilities::calculateContentMD5($content)); + $this->restProxy->createBlobPages( + $container, + $blob, + $putRange, + $content, + $options + ); + $getOptions = new GetBlobOptions(); + $getOptions->setRangeStart($putRange->getStart()); + $getOptions->setRangeEnd($putRange->getEnd()); + $getOptions->setComputeRangeMD5(true); + $result = $this->restProxy->getBlob($container, $blob, $getOptions); + $actualContent = stream_get_contents($result->getContentStream()); + $actualMD5 = $result->getProperties()->getContentMD5(); + //Validate + $this->assertEquals(Utilities::calculateContentMD5($content), $actualMD5); + $this->assertEquals($content, $actualContent); + } + if ($clearRange != null) { + $this->restProxy->clearBlobPages($container, $blob, $clearRange); + } + //Validate result + $listRangeOptions = new ListPageBlobRangesOptions(); + if ($listRange != null) { + $listRangeOptions->setRangeStart($listRange->getStart()); + $listRangeOptions->setRangeEnd($listRange->getEnd()); + } + $listResult = + $this->restProxy->listPageBlobRanges($container, $blob, $listRangeOptions); + $this->assertEquals(2048, $listResult->getContentLength()); + $resultRanges = $listResult->getRanges(); + for ($i = 0; $i < count($resultRanges); ++$i) { + $this->assertEquals($resultListRange[$i], $resultRanges[$i]); + } + } + + /** + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createAppendBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createAppendBlobAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::appendBlock + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::appendBlockAsync + */ + public function testAppendBlob() + { + $container = BlobServiceFunctionalTestData::getInterestingContainerName(); + $this->createContainer($container); + $blob = BlobServiceFunctionalTestData::getInterestingBlobName($container); + $this->restProxy->createAppendBlob($container, $blob); + + $setupArrays = BlobServiceFunctionalTestData::getAppendBlockSetup(); + foreach ($setupArrays as $setupArray) { + $content = openssl_random_pseudo_bytes($setupArray['size']); + $options = $setupArray['options']; + $errorMsg = $setupArray['error']; + $message = ''; + try { + $this->restProxy->appendBlock( + $container, + $blob, + $content, + $options + ); + } catch (ServiceException $e) { + $message = $e->getMessage(); + } + if ($errorMsg == '') { + $this->assertEquals('', $message); + } else { + $this->assertContains($errorMsg, $message); + } + } + } + + /** + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::acquireLease + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::acquireLeaseAsync + */ + public function testLeaseContainer() + { + $container = BlobServiceFunctionalTestData::getInterestingContainerName(); + $this->restProxy->createContainer($container); + $leaseId = Utilities::getGuid(); + $result = $this->restProxy->acquireLease($container, '', $leaseId); + $this->assertEquals($leaseId, $result->getLeaseId()); + $message = ''; + try { + $this->restProxy->deleteContainer($container); + } catch (ServiceException $e) { + $message = $e->getMessage(); + } + $this->assertContains('There is currently a lease on the container and no lease ID was specified in the request', $message); + $options = new BlobServiceOptions(); + $options->setLeaseId($leaseId); + $this->restProxy->deleteContainer($container, $options); + } + + /** + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::acquireLease + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::acquireLeaseAsync + */ + public function testLeaseBlob() + { + $container = BlobServiceFunctionalTestData::getInterestingContainerName(); + $this->restProxy->createContainer($container); + $blob = BlobServiceFunctionalTestData::getInterestingBlobName($container); + $this->restProxy->createPageBlob($container, $blob, 1024); + $leaseId = Utilities::getGuid(); + $result = $this->restProxy->acquireLease($container, $blob, $leaseId); + $this->assertEquals($leaseId, $result->getLeaseId()); + $message = ''; + try { + $this->restProxy->deleteBlob($container, $blob); + } catch (ServiceException $e) { + $message = $e->getMessage(); + } + $this->assertContains('There is currently a lease on the blob and no lease ID was specified in the request.', $message); + $options = new DeleteBlobOptions(); + $options->setLeaseId($leaseId); + $this->restProxy->deleteBlob($container, $blob, $options); + } + + /** + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::acquireLease + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::acquireLeaseAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::renewLease + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::renewLeaseAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::releaseLease + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::releaseLeaseAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::changeLease + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::changeLeaseAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::breakLease + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::breakLeaseAsync + */ + public function testLeaseOperations() + { + $container = BlobServiceFunctionalTestData::getInterestingContainerName(); + $this->restProxy->createContainer($container); + //configure + $blob = BlobServiceFunctionalTestData::getInterestingBlobName($container); + $this->restProxy->createPageBlob($container, $blob, 1024); + $leaseId = Utilities::getGuid(); + + $message = ''; + //test acquire lease duration no in bound + try { + $this->restProxy->acquireLease($container, $blob, $leaseId, 14); + } catch (ServiceException $e) { + $message = $e->getMessage(); + } + $this->assertContains(' The value for one of the HTTP headers is not in the correct format.', $message); + try { + $this->restProxy->acquireLease($container, $blob, $leaseId, 61); + } catch (ServiceException $e) { + $message = $e->getMessage(); + } + $this->assertContains(' The value for one of the HTTP headers is not in the correct format.', $message); + $result = $this->restProxy->acquireLease($container, $blob, $leaseId, 15); + $this->assertEquals($leaseId, $result->getLeaseId()); + //test lease duration expire + \sleep(15); + $this->restProxy->deleteBlob($container, $blob); + + //re-configure + $blob = BlobServiceFunctionalTestData::getInterestingBlobName($container); + $this->restProxy->createPageBlob($container, $blob, 1024); + $leaseId = Utilities::getGuid(); + $this->restProxy->acquireLease($container, $blob, $leaseId); + //test change lease + $newLeaseId = Utilities::getGuid(); + $result = $this->restProxy->changeLease($container, $blob, $leaseId, $newLeaseId); + $options = new DeleteBlobOptions(); + $options->setLeaseId($newLeaseId); + $this->restProxy->deleteBlob($container, $blob, $options); + + $result = $this->restProxy->listBlobs($container); + $this->assertTrue(empty($result->getBlobs())); + + //test renew lease + //re-configure + $blob = BlobServiceFunctionalTestData::getInterestingBlobName($container); + $this->restProxy->createPageBlob($container, $blob, 1024); + $leaseId = Utilities::getGuid(); + $this->restProxy->acquireLease($container, $blob, $leaseId, 15); + \sleep(15); + $this->restProxy->renewLease($container, $blob, $leaseId); + try { + $this->restProxy->deleteBlob($container, $blob); + } catch (ServiceException $e) { + $message = $e->getMessage(); + } + $this->assertContains('There is currently a lease on the blob and no lease ID was specified in the request.', $message); + + //test release lease + $this->restProxy->releaseLease($container, $blob, $leaseId); + //acquire a lease immediately after. + $leaseId = Utilities::getGuid(); + $this->restProxy->acquireLease($container, $blob, $leaseId); + try { + $this->restProxy->deleteBlob($container, $blob); + } catch (ServiceException $e) { + $message = $e->getMessage(); + } + $this->assertContains('There is currently a lease on the blob and no lease ID was specified in the request.', $message); + + //test break lease + $result = $this->restProxy->breakLease($container, $blob, 10); + $leaseId = Utilities::getGuid(); + try { + $this->restProxy->acquireLease($container, $blob, $leaseId); + } catch (ServiceException $e) { + $message = $e->getMessage(); + } + $this->assertContains('There is currently a lease on the blob and no lease ID was specified in the request.', $message); + \sleep(10); + $this->restProxy->acquireLease($container, $blob, $leaseId); + $options = new DeleteBlobOptions(); + $options->setLeaseId($leaseId); + $this->restProxy->deleteBlob($container, $blob, $options); + + $result = $this->restProxy->listBlobs($container); + $this->assertTrue(empty($result->getBlobs())); + } } diff --git a/tests/functional/Blob/BlobServiceFunctionalTestData.php b/tests/functional/Blob/BlobServiceFunctionalTestData.php index c87566f..fa3320b 100644 --- a/tests/functional/Blob/BlobServiceFunctionalTestData.php +++ b/tests/functional/Blob/BlobServiceFunctionalTestData.php @@ -32,6 +32,7 @@ use MicrosoftAzure\Storage\Blob\Models\BlobServiceOptions; use MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions; use MicrosoftAzure\Storage\Blob\Models\CreateBlobSnapshotOptions; use MicrosoftAzure\Storage\Blob\Models\CreateContainerOptions; +use MicrosoftAzure\Storage\Blob\Models\AppendBlockOptions; use MicrosoftAzure\Storage\Blob\Models\DeleteBlobOptions; use MicrosoftAzure\Storage\Blob\Models\GetBlobOptions; use MicrosoftAzure\Storage\Blob\Models\GetBlobPropertiesOptions; @@ -40,6 +41,8 @@ use MicrosoftAzure\Storage\Blob\Models\ListContainersOptions; use MicrosoftAzure\Storage\Blob\Models\PublicAccessType; use MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesOptions; use MicrosoftAzure\Storage\Common\Internal\Resources; +use MicrosoftAzure\Storage\Common\Internal\Utilities; +use MicrosoftAzure\Storage\Common\Models\Range; use MicrosoftAzure\Storage\Common\Models\Logging; use MicrosoftAzure\Storage\Common\Models\Metrics; use MicrosoftAzure\Storage\Common\Models\CORS; @@ -54,6 +57,7 @@ class BlobServiceFunctionalTestData public static $nonExistBlobPrefix; public static $testContainerNames; public static $testBlobNames; + private static $blockIdCount; private static $accountName; private static $badETag = '0x123456789ABCDEF'; @@ -66,6 +70,7 @@ class BlobServiceFunctionalTestData self::$nonExistBlobPrefix = 'qa-' . ($rint . 2) . '-'; self::$testContainerNames = array( self::$testUniqueId . 'a1', self::$testUniqueId . 'a2', self::$testUniqueId . 'b1' ); self::$testBlobNames = array( 'b' . self::$testUniqueId . 'a1', 'b' . self::$testUniqueId . 'a2', 'b' . self::$testUniqueId . 'b1' ); + self::$blockIdCount = 0; } public static function getInterestingContainerName() @@ -104,6 +109,14 @@ class BlobServiceFunctionalTestData return $blobname; } + public static function getInterestingBlockId() + { + //Block ID must be base64 encoded. + return base64_encode( + str_pad(self::$blockIdCount++, 6, '0', STR_PAD_LEFT) + ); + } + public static function getSimpleMessageText() { return 'simple message text #' . (self::$tempBlobCounter++); @@ -812,11 +825,6 @@ class BlobServiceFunctionalTestData $options->setSnapshot('placeholder'); array_push($ret, $options); - // TODO: Handle Lease ID - // $options = new GetBlobOptions(); - // $options->setLeaseId('setLeaseId'); - // array_push($ret, $options); - return $ret; } @@ -853,11 +861,6 @@ class BlobServiceFunctionalTestData $options->setSnapshot('placeholder'); array_push($ret, $options); - // TODO: Handle Lease ID - // $options = new DeleteBlobOptions(); - // $options->setLeaseId('setLeaseId'); - // array_push($ret, $options); - return $ret; } @@ -886,11 +889,6 @@ class BlobServiceFunctionalTestData $options->setMetadata(self::getNiceMetadata()); array_push($ret, $options); - // TODO: Handle Lease ID - // $options = new CreateBlobSnapshotOptions(); - // $options->setLeaseId('setLeaseId'); - // array_push($ret, $options); - return $ret; } @@ -932,15 +930,121 @@ class BlobServiceFunctionalTestData $options = new CopyBlobOptions(); $options->setSourceSnapshot('placeholder'); array_push($ret, $options); + + return $ret; + } - // TODO: Handle Lease ID - // $options = new CopyBlobOptions(); - // $options->setLeaseId('setLeaseId'); - // array_push($ret, $options); - // - // $options = new CopyBlobOptions(); - // $options->setSourceLeaseId('setSourceLeaseId'); - // array_push($ret, $options); + public static function getCreateBlockBlobAttributes() + { + $ret = array(); + $ret[] = ['size' => Resources::MB_IN_BYTES_4]; + $ret[] = ['size' => Resources::MB_IN_BYTES_32]; + $ret[] = ['size' => Resources::MB_IN_BYTES_32 + Resources::MB_IN_BYTES_1]; + $ret[] = ['size' => Resources::MB_IN_BYTES_128]; + $ret[] = ['size' => Resources::MB_IN_BYTES_256]; + $ret[] = [ + 'threshold' => Resources::MB_IN_BYTES_4, + 'size' => Resources::MB_IN_BYTES_4 * 2 + ]; + $ret[] = [ + 'threshold' => Resources::MB_IN_BYTES_64, + 'size' => Resources::MB_IN_BYTES_64 + ]; + $ret[] = [ + 'threshold' => Resources::MB_IN_BYTES_64, + 'size' => Resources::MB_IN_BYTES_64 + Resources::MB_IN_BYTES_1 + ]; + + return $ret; + } + + public static function getRangesArray() + { + $ret = array(); + + $ret[] = [ + 'putRange' => new Range(0, 511), + 'clearRange' => null, + 'listRange' => null, + 'resultListRange' => [new Range(0, 511)] + ]; + + $ret[] = [ + 'putRange' => new Range(1024, 1535), + 'clearRange' => null, + 'listRange' => null, + 'resultListRange' => [new Range(0, 511), new Range(1024, 1535)] + ]; + + $ret[] = [ + 'putRange' => new Range(512, 1023), + 'clearRange' => null, + 'listRange' => null, + 'resultListRange' => [new Range(0, 1535)] + ]; + + $ret[] = [ + 'putRange' => null, + 'clearRange' => new Range(1024, 1535), + 'listRange' => null, + 'resultListRange' => [new Range(0, 1023)] + ]; + + $ret[] = [ + 'putRange' => null, + 'clearRange' => null, + 'listRange' => new Range(0, 511), + 'resultListRange' => [new Range(0, 511)] + ]; + + $ret[] = [ + 'putRange' => new Range(1024, 2047), + 'clearRange' => new Range(512, 1023), + 'listRange' => null, + 'resultListRange' => [new Range(0, 511), new Range(1024, 2047)] + ]; + + $ret[] = [ + 'putRange' => null, + 'clearRange' => new Range(0, 2047), + 'listRange' => null, + 'resultListRange' => array() + ]; + + return $ret; + } + + public static function getAppendBlockSetup() + { + $ret = array(); + + $size = Resources::MB_IN_BYTES_4; + $options = new AppendBlockOptions(); + $errorMsg = ''; + $ret[] = ['size' => $size, 'options' => $options, 'error' => $errorMsg]; + + $size = Resources::MB_IN_BYTES_1; + $options = new AppendBlockOptions(); + $options->setContentMD5(Utilities::calculateContentMD5('')); + $errorMsg = 'The MD5 value specified in the request did not match with the MD5 value calculated by the server.'; + $ret[] = ['size' => $size, 'options' => $options, 'error' => $errorMsg]; + + $size = Resources::MB_IN_BYTES_1; + $options = new AppendBlockOptions(); + $options->setMaxBlobSize(Resources::MB_IN_BYTES_4); + $errorMsg = 'The max blob size condition specified was not met'; + $ret[] = ['size' => $size, 'options' => $options, 'error' => $errorMsg]; + + $size = Resources::MB_IN_BYTES_1; + $options = new AppendBlockOptions(); + $options->setAppendPosition(Resources::MB_IN_BYTES_1); + $errorMsg = 'The append position condition specified was not met.'; + $ret[] = ['size' => $size, 'options' => $options, 'error' => $errorMsg]; + + $size = Resources::MB_IN_BYTES_1 + Resources::MB_IN_BYTES_4; + $options = new AppendBlockOptions(); + $errorMsg = 'The request body is too large and exceeds the maximum permissible limit.'; + $ret[] = ['size' => $size, 'options' => $options, 'error' => $errorMsg]; return $ret; } diff --git a/tests/functional/Queue/QueueServiceFunctionalTest.php b/tests/functional/Queue/QueueServiceFunctionalTest.php index 07be017..5a4b964 100644 --- a/tests/functional/Queue/QueueServiceFunctionalTest.php +++ b/tests/functional/Queue/QueueServiceFunctionalTest.php @@ -43,7 +43,9 @@ class QueueServiceFunctionalTest extends FunctionalTestBase { /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getServiceProperties + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getServicePropertiesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setServiceProperties + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setServicePropertiesAsync */ public function testGetServicePropertiesNoOptions() { @@ -71,7 +73,9 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getServiceProperties + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getServicePropertiesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setServiceProperties + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setServicePropertiesAsync */ public function testGetServiceProperties() { @@ -103,9 +107,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase } } - /** - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::getServiceProperties - */ private function getServicePropertiesWorker($options) { self::println('Trying $options: ' . self::tmptostring($options)); @@ -204,19 +205,12 @@ class QueueServiceFunctionalTest extends FunctionalTestBase ); } -// /** -// * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getServiceProperties -// * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setServiceProperties -// */ -// public function testSetServicePropertiesNoOptions() -// { -// $serviceProperties = QueueServiceFunctionalTestData::getDefaultServiceProperties(); -// $this->setServicePropertiesWorker($serviceProperties, null); -// } /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getServiceProperties + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getServicePropertiesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setServiceProperties + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setServicePropertiesAsync */ public function testSetServiceProperties() { @@ -235,10 +229,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase } } - /** - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::getServiceProperties - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::setServiceProperties - */ private function setServicePropertiesWorker($serviceProperties, $options) { try { @@ -288,6 +278,7 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueues + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueuesAsync */ public function testListQueuesNoOptions() { @@ -296,6 +287,7 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueues + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueuesAsync */ public function testListQueues() { @@ -305,9 +297,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase } } - /** - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::listQueues - */ private function listQueuesWorker($options) { $finished = false; @@ -442,9 +431,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueue + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueueAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueue + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueueAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadata + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadataAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueues + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueuesAsync */ public function testCreateQueueNoOptions() { @@ -453,9 +446,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueue + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueueAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueue + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueueAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadata + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadataAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueues + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueuesAsync */ public function testCreateQueue() { @@ -465,12 +462,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase } } - /** - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createQueue - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::deleteQueue - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::getQueueMetadata - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::listQueues - */ private function createQueueWorker($options) { self::println('Trying $options: ' . self::tmptostring($options)); @@ -552,8 +543,11 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueue + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueueAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueue + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueueAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueues + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueuesAsync */ public function testDeleteQueueNoOptions() { @@ -562,8 +556,11 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueue + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueueAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueue + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueueAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueues + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueuesAsync */ public function testDeleteQueue() { @@ -575,11 +572,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase } } - /** - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createQueue - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::deleteQueue - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::listQueues - */ private function deleteQueueWorker($options) { self::println('Trying $options: ' . self::tmptostring($options)); @@ -644,14 +636,17 @@ class QueueServiceFunctionalTest extends FunctionalTestBase } } - // TODO: Negative tests, like accessing a non-existant queue, or recreating an existing queue? - /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueue + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueueAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueue + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueueAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadata + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadataAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setQueueMetadata + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setQueueMetadataAsync */ public function testGetQueueMetadataNoOptions() { @@ -663,10 +658,15 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueue + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueueAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueue + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueueAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadata + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadataAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setQueueMetadata + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setQueueMetadataAsync */ public function testGetQueueMetadata() { @@ -682,13 +682,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase } } - /** - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createMessage - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createQueue - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::deleteQueue - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::getQueueMetadata - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::setQueueMetadata - */ private function getQueueMetadataWorker($options, $metadata) { self::println('Trying $options: ' . self::tmptostring($options) . @@ -760,9 +753,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueue + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueueAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueue + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueueAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadata + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadataAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setQueueMetadata + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setQueueMetadataAsync */ public function testSetQueueMetadataNoOptions() { @@ -778,9 +775,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueue + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueueAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueue + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueueAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadata + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadataAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setQueueMetadata + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setQueueMetadataAsync */ public function testSetQueueMetadata() { @@ -800,12 +801,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase } } - /** - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createQueue - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::deleteQueue - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::getQueueMetadata - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::setQueueMetadata - */ private function setQueueMetadataWorker($options, $metadata) { self::println('Trying $options: ' . self::tmptostring($options) . @@ -852,8 +847,11 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync */ public function testCreateMessageEmpty() { @@ -862,8 +860,11 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync */ public function testCreateMessageUnicodeMessage() { @@ -885,8 +886,11 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync */ public function testCreateMessageXmlMessage() { @@ -898,8 +902,11 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync */ public function testCreateMessageWithSmallTTL() { @@ -929,8 +936,11 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync */ public function testCreateMessage() { @@ -959,11 +969,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase } } - /** - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::clearMessages - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createMessage - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::listMessages - */ private function createMessageWorker($messageText, $options) { self::println('Trying $options: ' . self::tmptostring($options)); @@ -1042,9 +1047,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::updateMessage + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::updateMessageAsync */ public function testUpdateMessageNoOptions() { @@ -1071,9 +1080,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::updateMessage + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::updateMessageAsync */ public function testUpdateMessage() { @@ -1104,12 +1117,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase } } - /** - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::clearMessages - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createMessage - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::listMessages - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::updateMessage - */ private function updateMessageWorker($messageText, $startingMessage, $visibilityTimeoutInSeconds, $options) { self::println('Trying $options: ' . self::tmptostring($options) . @@ -1203,9 +1210,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteMessage + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteMessageAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync */ public function testDeleteMessageNoOptions() { @@ -1214,9 +1225,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteMessage + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteMessageAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync */ public function testDeleteMessage() { @@ -1228,12 +1243,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase } } - /** - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::clearMessages - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createMessage - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::deleteMessage - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::listMessages - */ private function deleteMessageWorker($options) { self::println('Trying $options: ' . self::tmptostring($options)); @@ -1282,9 +1291,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::peekMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::peekMessagesAsync */ public function testListMessagesNoOptions() { @@ -1293,9 +1306,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::peekMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::peekMessagesAsync */ public function testListMessages() { @@ -1319,12 +1336,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase } } - /** - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::clearMessages - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createMessage - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::listMessages - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::peekMessages - */ private function listMessagesWorker($options) { self::println('Trying $options: ' . self::tmptostring($options)); @@ -1422,9 +1433,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::peekMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::peekMessagesAsync */ public function testPeekMessagesNoOptions() { @@ -1433,9 +1448,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::peekMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::peekMessagesAsync */ public function testPeekMessages() { @@ -1455,12 +1474,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase } } - /** - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::clearMessages - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createMessage - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::listMessages - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::peekMessages - */ private function peekMessagesWorker($options) { self::println('Trying $options: ' . self::tmptostring($options)); @@ -1525,8 +1538,11 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync */ public function testClearMessagesNoOptions() { @@ -1535,8 +1551,11 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync */ public function testClearMessages() { @@ -1548,11 +1567,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase } } - /** - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::clearMessages - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createMessage - * @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::listMessages - */ private function clearMessagesWorker($options) { self::println('Trying $options: ' . @@ -1610,6 +1624,7 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueues + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueuesAsync * @covers MicrosoftAzure\Storage\Common\Internal\ServiceRestProxy::createHandlerStack */ public function testMiddlewares() @@ -1662,6 +1677,7 @@ class QueueServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueues + * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueuesAsync * @covers MicrosoftAzure\Storage\Common\Internal\ServiceRestProxy::createHandlerStack */ public function testRetryFromSecondary() diff --git a/tests/functional/Table/TableServiceFunctionalTest.php b/tests/functional/Table/TableServiceFunctionalTest.php index b346ff2..b5869ab 100644 --- a/tests/functional/Table/TableServiceFunctionalTest.php +++ b/tests/functional/Table/TableServiceFunctionalTest.php @@ -56,7 +56,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase { /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServiceProperties + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServicePropertiesAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::setServiceProperties + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::setServicePropertiesAsync */ public function testGetServicePropertiesNoOptions() { @@ -84,7 +86,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServiceProperties + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServicePropertiesAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::setServiceProperties + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::setServicePropertiesAsync */ public function testGetServiceProperties() { @@ -105,6 +109,7 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServiceProperties + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServicePropertiesAsync */ private function getServicePropertiesWorker($options) { @@ -196,7 +201,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServiceProperties + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServicePropertiesAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::setServiceProperties + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::setServicePropertiesAsync */ public function testSetServicePropertiesNoOptions() { @@ -206,7 +213,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServiceProperties + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServicePropertiesAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::setServiceProperties + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::setServicePropertiesAsync */ public function testSetServiceProperties() { @@ -224,7 +233,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServiceProperties + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServicePropertiesAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::setServiceProperties + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::setServicePropertiesAsync */ private function setServicePropertiesWorker($serviceProperties, $options) { @@ -255,6 +266,7 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTablesAsync */ public function testQueryTablesNoOptions() { @@ -263,6 +275,7 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTablesAsync */ public function testQueryTables() { @@ -275,6 +288,7 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTablesAsync */ private function queryTablesWorker($options) { @@ -372,8 +386,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTable + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTableAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTable + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTableAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTablesAsync */ public function testCreateTableNoOptions() { @@ -382,8 +399,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTable + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTableAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTable + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTableAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTablesAsync */ public function testCreateTable() { @@ -391,11 +411,6 @@ class TableServiceFunctionalTest extends FunctionalTestBase $this->createTableWorker($options); } - /** - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTable - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTable - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables - */ private function createTableWorker($options) { $table = TableServiceFunctionalTestData::getInterestingTableName(); @@ -437,8 +452,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTable + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTableAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTable + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTableAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTablesAsync */ public function testDeleteTableNoOptions() { @@ -447,8 +465,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTable + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTableAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTable + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTableAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTablesAsync */ public function testDeleteTable() { @@ -458,8 +479,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTable + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTableAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTable + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTableAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTablesAsync */ private function deleteTableWorker($options) { @@ -518,8 +542,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTable + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTableAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTable + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTableAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getTable + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getTableAsync */ public function testGetTableNoOptions() { @@ -528,8 +555,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTable + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTableAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTable + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTableAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getTable + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getTableAsync */ public function testGetTable() { @@ -539,8 +569,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTable + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTableAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTable + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTableAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getTable + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getTableAsync */ private function getTableWorker($options) { @@ -571,7 +604,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync */ public function testGetEntity() { @@ -584,7 +619,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync */ private function getEntityWorker($ent, $isGood, $options) { @@ -696,8 +733,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync */ public function testDeleteEntity() { @@ -712,8 +752,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync */ private function deleteEntityWorker($ent, $useETag, $options) { @@ -754,7 +797,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ public function testInsertEntity() { @@ -767,7 +812,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ public function testInsertBadEntity() { @@ -786,7 +833,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ public function testInsertEntityBoolean() { @@ -799,30 +848,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase } } -// /** -// * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity -// * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities -// */ -// public function testInsertEntityBooleanNegative() -// { -// foreach(TableServiceFunctionalTestData::getInterestingBadBooleans() as $o) { -// $ent = new Entity(); -// $ent->setPartitionKey(TableServiceFunctionalTestData::getNewKey()); -// $ent->setRowKey(TableServiceFunctionalTestData::getNewKey()); -// try { -// $ent->addProperty('BOOLEAN', EdmType::BOOLEAN, $o); -// $this->fail('Should get an exception when trying to parse this value'); -// $this->insertEntityWorker($ent, false, null, $o); -// } catch (\Exception $e) { -// $this->assertEquals(0, $e->getCode(), 'getCode'); -// $this->assertTrue(true, 'got expected exception'); -// } -// } -// } - /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ public function testInsertEntityDate() { @@ -837,7 +867,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ public function testInsertEntityDateNegative() { @@ -858,7 +890,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ public function testInsertEntityDouble() { @@ -873,7 +907,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ public function testInsertEntityDoubleNegative() { @@ -894,7 +930,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ public function testInsertEntityGuid() { @@ -909,7 +947,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ public function testInsertEntityGuidNegative() { @@ -930,7 +970,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ public function testInsertEntityInt() { @@ -945,7 +987,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ public function testInsertEntityIntNegative() { @@ -966,7 +1010,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ public function testInsertEntityLong() { @@ -981,7 +1027,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ public function testInsertEntityLongNegative() { @@ -1002,7 +1050,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ public function testInsertEntityBinary() { @@ -1017,7 +1067,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ public function testInsertEntityBinaryNegative() { @@ -1038,7 +1090,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ public function testInsertEntityString() { @@ -1053,7 +1107,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ private function insertEntityWorker($ent, $isGood, $options, $specialValue = null) { @@ -1102,8 +1158,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntityAsync */ public function testUpdateEntity() { @@ -1120,8 +1179,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntityAsync */ private function updateEntityWorker($initialEnt, $ent, $options) { @@ -1153,8 +1215,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ public function testMergeEntity() { @@ -1171,8 +1236,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ private function mergeEntityWorker($initialEnt, $ent, $options) { @@ -1205,8 +1273,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ public function testInsertOrReplaceEntity() { @@ -1233,8 +1304,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ private function insertOrReplaceEntityWorker($initialEnt, $ent, $options) { @@ -1266,8 +1340,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ public function testInsertOrMergeEntity() { @@ -1294,8 +1371,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync */ private function insertOrMergeEntityWorker($initialEnt, $ent, $options) { @@ -1328,11 +1408,17 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntityAsync */ public function testCRUDdeleteEntity() { @@ -1350,11 +1436,17 @@ class TableServiceFunctionalTest extends FunctionalTestBase /* /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntityAsync */ public function testCRUDinsertEntity() { @@ -1372,11 +1464,17 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntityAsync */ public function testCRUDinsertOrMergeEntity() { @@ -1396,11 +1494,17 @@ class TableServiceFunctionalTest extends FunctionalTestBase /* /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntityAsync */ public function testCRUDinsertOrReplaceEntity() { @@ -1420,11 +1524,17 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntityAsync */ public function testCRUDmergeEntity() { @@ -1442,11 +1552,19 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntityAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntityAsync + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntityAsync */ public function testCRUDupdateEntity() { @@ -1462,14 +1580,6 @@ class TableServiceFunctionalTest extends FunctionalTestBase } } - /** - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntity - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntity - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntity - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntity - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity - */ private function crudWorker($opType, $concurType, $mutatePivot, $ent, $options) { $exptErr = $this->expectConcurrencyFailure($opType, $concurType); @@ -1503,7 +1613,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::batch + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::batchAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntityAsync */ public function testBatchPositiveFirstNoKeyMatch() { @@ -1512,7 +1626,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::batch + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::batchAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntityAsync */ public function testBatchPositiveFirstKeyMatchNoETag() { @@ -1521,7 +1639,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::batch + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::batchAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntityAsync */ public function testBatchPositiveFirstKeyMatchETagMismatch() { @@ -1531,7 +1653,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::batch + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::batchAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntityAsync */ public function testBatchPositiveFirstKeyMatchETagMatch() { @@ -1540,7 +1666,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::batch + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::batchAsync * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntityAsync */ public function testBatchNegative() { @@ -1668,10 +1798,6 @@ class TableServiceFunctionalTest extends FunctionalTestBase } } - /** - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::batch - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity - */ private function batchPositiveOuter($firstConcurType, $seed) { // The random here is not to generate random values, but to @@ -1738,10 +1864,6 @@ class TableServiceFunctionalTest extends FunctionalTestBase } } - /** - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::batch - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity - */ private function batchWorker($configs, $options) { $exptErrs = array(); @@ -1840,9 +1962,6 @@ class TableServiceFunctionalTest extends FunctionalTestBase $this->clearTable($table); } - /** - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity - */ private function verifyEntryData($table, $exptErr, $targetEnt, $opResult) { if ($opResult instanceof InsertEntityResult) { @@ -1919,14 +2038,6 @@ class TableServiceFunctionalTest extends FunctionalTestBase } } - /** - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntity - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntity - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntity - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntity - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity - */ private function executeCrudMethod($table, $targetEnt, $opType, $concurType, $options) { switch ($opType) { @@ -1982,9 +2093,6 @@ class TableServiceFunctionalTest extends FunctionalTestBase } } - /** - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity - */ private function verifyCrudWorker($opType, $table, $initialEnt, $targetEnt, $expectedSuccess) { $entInTable = null; @@ -2036,9 +2144,6 @@ class TableServiceFunctionalTest extends FunctionalTestBase } } - /** - * @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity - */ private function createTargetEntity($table, $initialEnt, $concurType, $mutatePivot) { $targetEnt = TableServiceFunctionalTestUtils::cloneEntity($initialEnt); @@ -2139,6 +2244,7 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTablesAsync * @covers MicrosoftAzure\Storage\Common\Internal\ServiceRestProxy::createHandlerStack */ public function testMiddlewares() @@ -2191,6 +2297,7 @@ class TableServiceFunctionalTest extends FunctionalTestBase /** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables + * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTablesAsync * @covers MicrosoftAzure\Storage\Common\Internal\ServiceRestProxy::createHandlerStack */ public function testRetryFromSecondary() diff --git a/tests/unit/Blob/BlobRestProxyTest.php b/tests/unit/Blob/BlobRestProxyTest.php index 580a760..8f985cb 100644 --- a/tests/unit/Blob/BlobRestProxyTest.php +++ b/tests/unit/Blob/BlobRestProxyTest.php @@ -98,7 +98,9 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listContainers - * @covers MicrosoftAzure\Storage\Common\Internal\ServiceRestProxy::send + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listContainersAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createContainer + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createContainerAsync */ public function testListContainersSimple() { @@ -123,8 +125,11 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase } /** - * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listContainers - */ + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listContainers + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listContainersAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createContainer + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createContainerAsync + */ public function testListContainersWithOptions() { // Setup @@ -155,8 +160,11 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase } /** - * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listContainers - */ + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listContainers + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listContainersAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createContainer + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createContainerAsync + */ public function testListContainersWithNextMarker() { // Setup @@ -190,6 +198,9 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listContainers + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listContainersAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createContainer + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createContainerAsync * @expectedException MicrosoftAzure\Storage\Common\Exceptions\ServiceException * @expectedExceptionMessage 400 */ @@ -215,6 +226,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listContainers + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listContainersAsync */ public function testListContainersWithNoContainers() { @@ -228,6 +240,9 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listContainers + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listContainersAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createContainer + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createContainerAsync */ public function testListContainersWithOneResult() { @@ -245,6 +260,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createContainer + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createContainerAsync */ public function testCreateContainerSimple() { @@ -263,6 +279,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createContainer + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createContainerAsync */ public function testCreateContainerWithoutOptions() { @@ -281,6 +298,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createContainer + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createContainerAsync */ public function testCreateContainerWithMetadata() { @@ -305,7 +323,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createContainer - $this->setExpectedException(get_class(new ServiceException('400'))); + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createContainerAsync * @expectedException MicrosoftAzure\Storage\Common\Exceptions\ServiceException * @expectedExceptionMessage 400 */ @@ -320,6 +338,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createContainer + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createContainerAsync * @expectedException MicrosoftAzure\Storage\Common\Exceptions\ServiceException * @expectedExceptionMessage 409 */ @@ -335,6 +354,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::deleteContainer + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::deleteContainerAsync */ public function testDeleteContainer() { @@ -353,6 +373,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::deleteContainer + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::deleteContainerAsync * @expectedException MicrosoftAzure\Storage\Common\Exceptions\ServiceException * @expectedExceptionMessage 404 */ @@ -367,7 +388,8 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getContainerProperties - * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_getContainerPropertiesImpl + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getContainerPropertiesAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getContainerPropertiesImpl */ public function testGetContainerProperties() { @@ -386,7 +408,8 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getContainerMetadata - * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_getContainerPropertiesImpl + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getContainerMetadataAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getContainerPropertiesImpl */ public function testGetContainerMetadata() { @@ -411,6 +434,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getContainerAcl + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getContainerAclAsync */ public function testGetContainerAcl() { @@ -428,6 +452,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::setContainerAcl + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::setContainerAclAsync */ public function testSetContainerAcl() { @@ -451,6 +476,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::setContainerMetadata + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::setContainerMetadataAsync */ public function testSetContainerMetadata() { @@ -473,6 +499,9 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobs + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobsAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlobAsync * @expectedException \InvalidArgumentException * @expectedExceptionMessage can't be NULL. */ @@ -483,6 +512,9 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobs + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobsAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlobAsync * @covers MicrosoftAzure\Storage\Common\Internal\ServiceRestProxy::send */ public function testListBlobsSimple() @@ -516,6 +548,9 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobs + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobsAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlobAsync */ public function testListBlobsWithOptions() { @@ -553,6 +588,9 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobs + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobsAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlobAsync */ public function testListBlobsWithOptionsWithDelimiter() { @@ -590,6 +628,9 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobs + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobsAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlobAsync */ public function testListBlobsWithNextMarker() { @@ -624,6 +665,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobs + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobsAsync */ public function testListBlobsWithNoBlobs() { @@ -638,6 +680,9 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobs + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobsAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlobAsync */ public function testListBlobsWithOneResult() { @@ -653,7 +698,8 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlob - * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_addCreateBlobOptionalHeaders + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlobAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::addCreateBlobOptionalHeaders */ public function testCreatePageBlob() { @@ -673,7 +719,9 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createAppendBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createAppendBlobAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobProperties + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobPropertiesAsync */ public function testCreateAppendBlob() { @@ -695,9 +743,13 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createAppendBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createAppendBlobAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::appendBlock + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::appendBlockAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobs + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobsAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobProperties + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobPropertiesAsync */ public function testAppendBlock() { @@ -743,7 +795,9 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createAppendBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createAppendBlobAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::appendBlock + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::appendBlockAsync */ public function testAppendBlockSuccessWithAppendPosition() { @@ -766,7 +820,9 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createAppendBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createAppendBlobAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::appendBlock + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::appendBlockAsync * @expectedException MicrosoftAzure\Storage\Common\Exceptions\ServiceException * @expectedExceptionMessage 412 */ @@ -786,7 +842,9 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createAppendBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createAppendBlobAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::appendBlock + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::appendBlockAsync */ public function testAppendBlockSuccessWithMaxBlobSize() { @@ -805,7 +863,9 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createAppendBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createAppendBlobAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::appendBlock + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::appendBlockAsync * @expectedException MicrosoftAzure\Storage\Common\Exceptions\ServiceException * @expectedExceptionMessage 412 */ @@ -825,7 +885,8 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlob - * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_addCreateBlobOptionalHeaders + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlobAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::addCreateBlobOptionalHeaders */ public function testCreatePageBlobWithExtraOptions() { @@ -848,7 +909,8 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlob - * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_addCreateBlobOptionalHeaders + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlobAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::addCreateBlobOptionalHeaders */ public function testCreateBlockBlobWithBinary() { @@ -871,7 +933,8 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlob - * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_addCreateBlobOptionalHeaders + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlobAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::addCreateBlobOptionalHeaders */ public function testCreateBlockBlobWithPlainText() { @@ -895,7 +958,8 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlob - * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_addCreateBlobOptionalHeaders + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlobAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::addCreateBlobOptionalHeaders */ public function testCreateBlockBlobWithStream() { @@ -921,7 +985,8 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobProperties - * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_getBlobPropertiesResultFromResponse + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobPropertiesAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobPropertiesResultFromResponse * @covers MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesResult::create */ public function testGetBlobProperties() @@ -941,8 +1006,10 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobProperties + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobPropertiesAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::setBlobProperties - * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_getBlobPropertiesResultFromResponse + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::setBlobPropertiesAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobPropertiesResultFromResponse * @covers MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesResult::create */ public function testSetBlobProperties() @@ -966,7 +1033,8 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::setBlobProperties - * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_getBlobPropertiesResultFromResponse + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::setBlobPropertiesAsync + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobPropertiesResultFromResponse * @covers MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesResult::create */ public function testSetBlobPropertiesWithNoOptions() @@ -987,6 +1055,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobMetadata + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobMetadataAsync * @covers MicrosoftAzure\Storage\Blob\Models\GetBlobMetadataResult::create */ public function testGetBlobMetadata() @@ -1009,6 +1078,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::setBlobMetadata + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::setBlobMetadataAsync * @covers MicrosoftAzure\Storage\Blob\Models\SetBlobMetadataResult::create * @covers MicrosoftAzure\Storage\Common\Internal\ServiceRestProxy::addMetadataHeaders */ @@ -1031,6 +1101,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_addOptionalRangeHeader * @covers MicrosoftAzure\Storage\Blob\Models\GetBlobResult::create */ @@ -1087,6 +1158,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_addOptionalRangeHeader * @covers MicrosoftAzure\Storage\Blob\Models\GetBlobResult::create */ @@ -1122,6 +1194,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_addOptionalRangeHeader * @covers MicrosoftAzure\Storage\Blob\Models\GetBlobResult::create */ @@ -1156,6 +1229,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_addOptionalRangeHeader * @covers MicrosoftAzure\Storage\Blob\Models\GetBlobResult::create */ @@ -1187,6 +1261,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::deleteBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::deleteBlobAsync */ public function testDeleteBlob() { @@ -1209,6 +1284,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::deleteBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::deleteBlobAsync */ public function testDeleteBlobSnapshot() { @@ -1238,6 +1314,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::deleteBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::deleteBlobAsync */ public function testDeleteBlobSnapshotsOnly() { @@ -1267,6 +1344,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::acquireLease + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::acquireLeaseAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_putLeaseImpl * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_createPath */ @@ -1291,6 +1369,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::acquireLease + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::acquireLeaseAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_putLeaseImpl * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_createPath */ @@ -1318,6 +1397,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::changeLease + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::changeLeaseAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_putLeaseImpl * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_createPath */ @@ -1344,6 +1424,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::renewLease + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::renewLeaseAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_putLeaseImpl */ public function testRenewLease() @@ -1367,6 +1448,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::releaseLease + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::releaseLeaseAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_putLeaseImpl */ public function testReleaseLease() @@ -1391,6 +1473,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::breakLease + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::breakLeaseAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_putLeaseImpl */ public function testBreakLease() @@ -1417,6 +1500,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobPages + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobPagesAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_updatePageBlobPagesImpl * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_addOptionalRangeHeader */ @@ -1443,6 +1527,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::clearBlobPages + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::clearBlobPagesAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_updatePageBlobPagesImpl * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_addOptionalRangeHeader */ @@ -1470,6 +1555,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listPageBlobRanges + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listPageBlobRangesAsync * @covers MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesResult::create */ public function testListPageBlobRanges() @@ -1497,6 +1583,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listPageBlobRanges + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listPageBlobRangesAsync * @covers MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesResult::create */ public function testListPageBlobRangesEmpty() @@ -1518,6 +1605,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobBlock + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobBlockAsync */ public function testCreateBlobBlock() { @@ -1537,6 +1625,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::commitBlobBlocks + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::commitBlobBlocksAsync * @covers MicrosoftAzure\Storage\Blob\Models\BlockList::toXml */ public function testCommitBlobBlocks() @@ -1564,6 +1653,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::commitBlobBlocks + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::commitBlobBlocksAsync * @covers MicrosoftAzure\Storage\Blob\Models\BlockList::toXml */ public function testCommitBlobBlocksWithArray() @@ -1594,6 +1684,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobBlocks + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobBlocksAsync * @covers MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksResult::create * @covers MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksResult::getContentLength * @covers MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksResult::getUncommittedBlocks @@ -1622,6 +1713,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobBlocks + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobBlocksAsync * @covers MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksResult::create * @covers MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksResult::_getEntries */ @@ -1646,6 +1738,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::copyBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::copyBlobAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_getCopyBlobSourceName */ public function testCopyBlobDifferentContainer() @@ -1725,6 +1818,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::copyBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::copyBlobAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_getCopyBlobSourceName */ public function testCopyBlobSameContainer() @@ -1765,6 +1859,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::copyBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::copyBlobAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_getCopyBlobSourceName */ public function testCopyBlobExistingBlob() @@ -1807,7 +1902,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase } /** - * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::copyBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::copyBlobAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::_getCopyBlobSourceName */ public function testCopyBlobSnapshot() @@ -1844,6 +1939,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobSnapshot + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobSnapshotAsync * @covers MicrosoftAzure\Storage\Blob\Models\createBlobSnapshotResult::create */ public function testCreateBlobSnapshot() @@ -1872,6 +1968,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlobAsync * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlob */ public function testSingleBlobUploadZeroBytes() @@ -1924,6 +2021,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlob + * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlobAsync **/ public function testCreateBlobLargerThanSingleBlock() { @@ -1969,6 +2067,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::saveBlobToFile + * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::saveBlobToFileAsync */ public function testGetBlockBlobToFile() { @@ -2009,6 +2108,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::saveBlobToFile + * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::saveBlobToFileAsync */ public function testGetPageBlobToFile() { @@ -2043,727 +2143,9 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase unlink($path); } - /** - * @group large-scale - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlob - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlob - */ - public function testPutGet2GBBlockBlob() - { - // Setup - //create a temp file that is 2GB in size. - $cwd = getcwd(); - $uuid = uniqid('test-file-', true); - $path = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; - $resource = fopen($path, 'w+'); - $count = 2 * 1024 / 4; - for ($index = 0; $index < $count; ++$index) { - fwrite($resource, openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_4)); - } - rewind($resource); - //upload the blob - $name = 'getblob' . $this->createSuffix(); - $blob = 'myblob'; - $metadata = array('m1' => 'v1', 'm2' => 'v2'); - $contentType = 'text/plain; charset=UTF-8'; - $this->createContainer($name); - $options = new CreateBlobOptions(); - $options->setContentType($contentType); - $options->setMetadata($metadata); - $this->restProxy->createBlockBlob( - $name, - $blob, - $resource, - $options - ); - - // Test - $result = $this->restProxy->getBlob($name, $blob); - - //get the path for the file to be downloaded into. - $uuid = uniqid('test-file-', true); - $downloadPath = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; - $downloadResource = fopen($downloadPath, 'w'); - //download the file - $content = $result->getContentStream(); - - while (!feof($content)) { - fwrite( - $downloadResource, - stream_get_contents($content, Resources::MB_IN_BYTES_4) - ); - } - - // Assert - $this->assertEquals( - BlobType::BLOCK_BLOB, - $result->getProperties()->getBlobType() - ); - $this->assertEquals($metadata, $result->getMetadata()); - $originMd5 = md5_file($path); - $downloadMd5 = md5_file($downloadPath); - $this->assertEquals($originMd5, $downloadMd5); - - //clean-up. - if (is_resource($resource)) { - fclose($resource); - } - fclose($downloadResource); - unlink($path); - unlink($downloadPath); - } - - /** - * @group large-scale - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlob - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlob - */ - public function testPutGet5TBBlockBlob() - { - // Initial check for the environment. - // Does disk have enough space. - $this->assertTrue(disk_free_space('.') > (2 * Resources::TB_IN_BYTES_5)); - // Setup - //create a temp file that is 5TB in size. - $cwd = getcwd(); - $uuid = uniqid('test-file-', true); - $path = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; - $resource = fopen($path, 'w+'); - $count = 50000 * 100 / 64; - for ($index = 0; $index < $count; ++$index) { - fwrite($resource, openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_64)); - } - rewind($resource); - //upload the blob - $name = 'getblob' . $this->createSuffix(); - $blob = 'myblob'; - $metadata = array('m1' => 'v1', 'm2' => 'v2'); - $contentType = 'text/plain; charset=UTF-8'; - $this->createContainer($name); - $options = new CreateBlobOptions(); - $options->setContentType($contentType); - $options->setMetadata($metadata); - $this->restProxy->createBlockBlob( - $name, - $blob, - $resource, - $options - ); - - // Test - $result = $this->restProxy->getBlob($name, $blob); - - //get the path for the file to be downloaded into. - $uuid = uniqid('test-file-', true); - $downloadPath = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; - $downloadResource = fopen($downloadPath, 'w'); - //download the file - $content = $result->getContentStream(); - - while (!feof($content)) { - fwrite( - $downloadResource, - stream_get_contents($content, Resources::MB_IN_BYTES_4) - ); - } - - // Assert - $this->assertEquals( - BlobType::BLOCK_BLOB, - $result->getProperties()->getBlobType() - ); - $this->assertEquals($metadata, $result->getMetadata()); - $originMd5 = md5_file($path); - $downloadMd5 = md5_file($downloadPath); - $this->assertEquals($originMd5, $downloadMd5); - - //clean-up. - if (is_resource($resource)) { - fclose($resource); - } - fclose($downloadResource); - unlink($path); - unlink($downloadPath); - } - - /** - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlob - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlob - */ - public function testPutGet32MBBlockBlob() - { - // Setup - //create a temp file that is 32 in size. - $cwd = getcwd(); - $uuid = uniqid('test-file-', true); - $path = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; - $resource = fopen($path, 'w+'); - fwrite($resource, openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_32)); - rewind($resource); - //upload the blob - $name = 'getblob' . $this->createSuffix(); - $blob = 'myblob'; - $metadata = array('m1' => 'v1', 'm2' => 'v2'); - $contentType = 'text/plain; charset=UTF-8'; - $this->createContainer($name); - $options = new CreateBlobOptions(); - $options->setContentType($contentType); - $options->setMetadata($metadata); - $this->restProxy->createBlockBlob( - $name, - $blob, - $resource, - $options - ); - - // Test - $result = $this->restProxy->getBlob($name, $blob); - - //get the path for the file to be downloaded into. - $uuid = uniqid('test-file-', true); - $downloadPath = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; - $downloadResource = fopen($downloadPath, 'w'); - //download the file - $content = $result->getContentStream(); - - while (!feof($content)) { - fwrite( - $downloadResource, - stream_get_contents($content, Resources::MB_IN_BYTES_4) - ); - } - - // Assert - $this->assertEquals( - BlobType::BLOCK_BLOB, - $result->getProperties()->getBlobType() - ); - $this->assertEquals($metadata, $result->getMetadata()); - $originMd5 = md5_file($path); - $downloadMd5 = md5_file($downloadPath); - $this->assertEquals($originMd5, $downloadMd5); - - //clean-up. - if (is_resource($resource)) { - fclose($resource); - } - fclose($downloadResource); - unlink($path); - unlink($downloadPath); - } - - /** - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlob - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlob - */ - public function testPutGet33MBBlockBlob() - { - // Setup - //create a temp file that is 33 in size. - $cwd = getcwd(); - $uuid = uniqid('test-file-', true); - $path = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; - $resource = fopen($path, 'w+'); - fwrite($resource, openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_32)); - fwrite($resource, openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_1)); - rewind($resource); - //upload the blob - $name = 'getblob' . $this->createSuffix(); - $blob = 'myblob'; - $metadata = array('m1' => 'v1', 'm2' => 'v2'); - $contentType = 'text/plain; charset=UTF-8'; - $this->createContainer($name); - $options = new CreateBlobOptions(); - $options->setContentType($contentType); - $options->setMetadata($metadata); - $this->restProxy->createBlockBlob( - $name, - $blob, - $resource, - $options - ); - - // Test - $result = $this->restProxy->getBlob($name, $blob); - - //get the path for the file to be downloaded into. - $uuid = uniqid('test-file-', true); - $downloadPath = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; - $downloadResource = fopen($downloadPath, 'w'); - //download the file - $content = $result->getContentStream(); - - while (!feof($content)) { - fwrite( - $downloadResource, - stream_get_contents($content, Resources::MB_IN_BYTES_4) - ); - } - - // Assert - $this->assertEquals( - BlobType::BLOCK_BLOB, - $result->getProperties()->getBlobType() - ); - $this->assertEquals($metadata, $result->getMetadata()); - $originMd5 = md5_file($path); - $downloadMd5 = md5_file($downloadPath); - $this->assertEquals($originMd5, $downloadMd5); - - //clean-up. - if (is_resource($resource)) { - fclose($resource); - } - fclose($downloadResource); - unlink($path); - unlink($downloadPath); - } - - /** - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlob - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlob - */ - public function testPutGet64MBBlockBlob() - { - // Setup - //create a temp file that is 64 in size. - $cwd = getcwd(); - $uuid = uniqid('test-file-', true); - $path = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; - $resource = fopen($path, 'w+'); - fwrite($resource, openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_32)); - fwrite($resource, openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_32)); - rewind($resource); - //upload the blob - $name = 'getblob' . $this->createSuffix(); - $blob = 'myblob'; - $metadata = array('m1' => 'v1', 'm2' => 'v2'); - $contentType = 'text/plain; charset=UTF-8'; - $this->createContainer($name); - $options = new CreateBlobOptions(); - $options->setContentType($contentType); - $options->setMetadata($metadata); - $this->restProxy->setSingleBlobUploadThresholdInBytes(Resources::MB_IN_BYTES_64); - $this->restProxy->createBlockBlob( - $name, - $blob, - $resource, - $options - ); - $this->restProxy->setSingleBlobUploadThresholdInBytes(Resources::MB_IN_BYTES_32); - - // Test - $result = $this->restProxy->getBlob($name, $blob); - - //get the path for the file to be downloaded into. - $uuid = uniqid('test-file-', true); - $downloadPath = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; - $downloadResource = fopen($downloadPath, 'w'); - //download the file - $content = $result->getContentStream(); - - while (!feof($content)) { - fwrite( - $downloadResource, - stream_get_contents($content, Resources::MB_IN_BYTES_4) - ); - } - - // Assert - $this->assertEquals( - BlobType::BLOCK_BLOB, - $result->getProperties()->getBlobType() - ); - $this->assertEquals($metadata, $result->getMetadata()); - $originMd5 = md5_file($path); - $downloadMd5 = md5_file($downloadPath); - $this->assertEquals($originMd5, $downloadMd5); - - //clean-up. - if (is_resource($resource)) { - fclose($resource); - } - fclose($downloadResource); - unlink($path); - unlink($downloadPath); - } - - /** - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlob - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlob - */ - public function testPutGet65MBBlockBlob() - { - // Setup - //create a temp file that is 65 in size. - $cwd = getcwd(); - $uuid = uniqid('test-file-', true); - $path = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; - $resource = fopen($path, 'w+'); - fwrite($resource, openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_32)); - fwrite($resource, openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_32)); - fwrite($resource, openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_1)); - rewind($resource); - //upload the blob - $name = 'getblob' . $this->createSuffix(); - $blob = 'myblob'; - $metadata = array('m1' => 'v1', 'm2' => 'v2'); - $contentType = 'text/plain; charset=UTF-8'; - $this->createContainer($name); - $options = new CreateBlobOptions(); - $options->setContentType($contentType); - $options->setMetadata($metadata); - $this->restProxy->setSingleBlobUploadThresholdInBytes(Resources::MB_IN_BYTES_64); - $this->restProxy->createBlockBlob( - $name, - $blob, - $resource, - $options - ); - $this->restProxy->setSingleBlobUploadThresholdInBytes(Resources::MB_IN_BYTES_32); - - // Test - $result = $this->restProxy->getBlob($name, $blob); - - //get the path for the file to be downloaded into. - $uuid = uniqid('test-file-', true); - $downloadPath = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; - $downloadResource = fopen($downloadPath, 'w'); - //download the file - $content = $result->getContentStream(); - - while (!feof($content)) { - fwrite( - $downloadResource, - stream_get_contents($content, Resources::MB_IN_BYTES_4) - ); - } - - // Assert - $this->assertEquals( - BlobType::BLOCK_BLOB, - $result->getProperties()->getBlobType() - ); - $this->assertEquals($metadata, $result->getMetadata()); - $originMd5 = md5_file($path); - $downloadMd5 = md5_file($downloadPath); - $this->assertEquals($originMd5, $downloadMd5); - - //clean-up. - if (is_resource($resource)) { - fclose($resource); - } - fclose($downloadResource); - unlink($path); - unlink($downloadPath); - } - - /** - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlob - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlob - */ - public function testPutGetBlockBlobWith5MBBlocks() - { - // Setup - $content = openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_64); - //upload the blob - $name = 'getblob' . $this->createSuffix(); - $blob = 'myblob'; - $this->createContainer($name); - $this->restProxy->setBlockSize(Resources::MB_IN_BYTES_1 * 5); - $this->restProxy->createBlockBlob( - $name, - $blob, - $content - ); - - //Get the committed blocks count. - $options = new ListBlobBlocksOptions(); - $options->setIncludeCommittedBlobs(true); - - $result = $this->restProxy->listBlobBlocks($name, $blob, $options); - - $this->assertEquals(13, \count($result->getCommittedBlocks())); - } - - /** - * @group large-scale - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlob - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlob - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobPages - */ - public function testGetLargePageBlob() - { - //Setup - //create a temp file that is 2GB in size. - $cwd = getcwd(); - $uuid = uniqid('test-file-', true); - $path = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; - $resource = fopen($path, 'w+'); - $count = 2 * 1024 / 4; - for ($index = 0; $index < $count; ++$index) { - fwrite($resource, openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_4)); - } - rewind($resource); - //upload the blob - $name = 'createblobpages' . $this->createSuffix(); - $blob = 'myblob'; - $length = $count * Resources::MB_IN_BYTES_4; - $this->createContainer($name); - $this->restProxy->createPageBlob($name, $blob, $length); - //upload the blob for 4MB a chunk - $chunkSize = Resources::MB_IN_BYTES_4; - $uploadCount = $length / $chunkSize; - for ($chunkIdx = 0; $chunkIdx < $uploadCount; ++$chunkIdx) { - $range = new Range( - $chunkSize * $chunkIdx, - ($chunkSize * ($chunkIdx + 1)) - 1 - ); - $body = fread($resource, $chunkSize); - $actual = $this->restProxy->createBlobPages( - $name, - $blob, - $range, - $body - ); - } - - // Test - $result = $this->restProxy->getBlob($name, $blob); - - //get the path for the file to be downloaded into. - $uuid = uniqid('test-file-', true); - $downloadPath = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; - $downloadResource = fopen($downloadPath, 'w'); - //download the file - $content = $result->getContentStream(); - while (!feof($content)) { - fwrite( - $downloadResource, - stream_get_contents($content, Resources::MB_IN_BYTES_4) - ); - } - - // Assert - $this->assertEquals( - BlobType::PAGE_BLOB, - $result->getProperties()->getBlobType() - ); - $originMd5 = md5_file($path); - $downloadMd5 = md5_file($downloadPath); - $this->assertEquals($originMd5, $downloadMd5); - - // Delete file after assertion. - if (is_resource($resource)) { - fclose($resource); - } - fclose($downloadResource); - unlink($path); - unlink($downloadPath); - } - - /** - * @group large-scale - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlob - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlobFromContent - */ - public function testCreateLargePageBlobFromContent() - { - //Setup - //create a temp file that is 2GB in size. - $cwd = getcwd(); - $uuid = uniqid('test-file-', true); - $path = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; - $resource = fopen($path, 'w+'); - $count = 2 * 1024 / 4; - for ($index = 0; $index < $count; ++$index) { - fwrite($resource, openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_4)); - } - rewind($resource); - - //upload the blob - $container = 'createpageblobfromcontent' . $this->createSuffix(); - $blob = 'myblob'; - $length = $count * Resources::MB_IN_BYTES_4; - $this->createContainer($container); - - $metadata = array('m1' => 'v1', 'm2' => 'v2'); - $contentType = 'text/plain; charset=UTF-8'; - $options = new CreateBlobOptions(); - $options->setContentType($contentType); - $options->setMetadata($metadata); - - $createPageBlobResult = $this->restProxy->createPageBlobFromContent($container, $blob, $length, $resource, $options); - - $originMd5 = md5_file($path); - $this->assertEquals("PageBlob", $createPageBlobResult->getProperties()->getBlobType()); - $this->assertEquals($contentType, $createPageBlobResult->getProperties()->getContentType()); - $this->assertEquals(2, count($createPageBlobResult->getMetadata())); - $this->assertEquals($metadata["m1"], $createPageBlobResult->getMetadata()["m1"]); - $this->assertEquals($metadata["m2"], $createPageBlobResult->getMetadata()["m2"]); - - // Test - $result = $this->restProxy->getBlob($container, $blob); - - //get the path for the file to be downloaded into. - $uuid = uniqid('test-file-', true); - $downloadPath = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; - $downloadResource = fopen($downloadPath, 'w'); - - //download the file - $content = $result->getContentStream(); - while (!feof($content)) { - fwrite( - $downloadResource, - stream_get_contents($content, Resources::MB_IN_BYTES_4) - ); - } - - // Assert - $this->assertEquals( - BlobType::PAGE_BLOB, - $result->getProperties()->getBlobType() - ); - $downloadMd5 = md5_file($downloadPath); - $this->assertEquals($originMd5, $downloadMd5); - - // Delete file after assertion. - if (is_resource($resource)) { - fclose($resource); - } - fclose($downloadResource); - unlink($path); - unlink($downloadPath); - } - - /** - * @group large-scale - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::saveBlobToFile - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlob - */ - public function testGetLargeBlockBlobToFile() - { - // Setup - //create a temp file that is 2GB in size. - $cwd = getcwd(); - $uuid = uniqid('test-file-', true); - $path = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; - $resource = fopen($path, 'w+'); - $count = 2 * 1024 / 4; - for ($index = 0; $index < $count; ++$index) { - fwrite($resource, openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_4)); - } - rewind($resource); - //upload the blob - $name = 'getblob' . $this->createSuffix(); - $blob = 'myblob'; - $metadata = array('m1' => 'v1', 'm2' => 'v2'); - $contentType = 'text/plain; charset=UTF-8'; - $this->createContainer($name); - $options = new CreateBlobOptions(); - $options->setContentType($contentType); - $options->setMetadata($metadata); - $this->restProxy->createBlockBlob( - $name, - $blob, - $resource, - $options - ); - - //get the path for the file to be downloaded into. - $uuid = uniqid('test-file-', true); - $downloadPath = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; - - // Test - $result = $this->restProxy->saveBlobToFile($downloadPath, $name, $blob); - - - // Assert - $this->assertEquals( - BlobType::BLOCK_BLOB, - $result->getProperties()->getBlobType() - ); - $this->assertEquals($metadata, $result->getMetadata()); - if (is_resource($resource)) { - fclose($resource); - } - $originMd5 = md5_file($path); - $downloadMd5 = md5_file($downloadPath); - $this->assertEquals($originMd5, $downloadMd5); - - // Delete file after assertion. - unlink($path); - unlink($downloadPath); - } - - /** - * @group large-scale - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::saveBlobToFile - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlob - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobPages - */ - public function testGetLargePageBlobToFile() - { - //Setup - //create a temp file that is 2GB in size. - $cwd = getcwd(); - $uuid = uniqid('test-file-', true); - $path = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; - $resource = fopen($path, 'w+'); - $count = 2 * 1024 / 4; - for ($index = 0; $index < $count; ++$index) { - fwrite($resource, openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_4)); - } - rewind($resource); - //upload the blob - $name = 'createblobpages' . $this->createSuffix(); - $blob = 'myblob'; - $length = $count * Resources::MB_IN_BYTES_4; - $this->createContainer($name); - $this->restProxy->createPageBlob($name, $blob, $length); - //upload the blob for 4MB a chunk - $chunkSize = Resources::MB_IN_BYTES_4; - $uploadCount = $length / $chunkSize; - for ($chunkIdx = 0; $chunkIdx < $uploadCount; ++$chunkIdx) { - $range = new Range( - $chunkSize * $chunkIdx, - ($chunkSize * ($chunkIdx + 1)) - 1 - ); - $body = fread($resource, $chunkSize); - $actual = $this->restProxy->createBlobPages( - $name, - $blob, - $range, - $body - ); - } - - //get the path for the file to be downloaded into. - $uuid = uniqid('test-file-', true); - $downloadPath = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt'; - - // Test - $result = $this->restProxy->saveBlobToFile($downloadPath, $name, $blob); - - // Assert - $this->assertEquals( - BlobType::PAGE_BLOB, - $result->getProperties()->getBlobType() - ); - if (is_resource($resource)) { - fclose($resource); - } - $originMd5 = md5_file($path); - $downloadMd5 = md5_file($downloadPath); - $this->assertEquals($originMd5, $downloadMd5); - - // Delete file after assertion. - unlink($path); - unlink($downloadPath); - } - /** * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobPages + * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobPagesAsync */ public function testRangeCreationWithInvalidRange() { @@ -2792,6 +2174,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::saveBlobToFile + * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::saveBlobToFileAsync */ public function testsaveBlobToFileWithInvalidPath() { @@ -2830,6 +2213,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase /** * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::saveBlobToFile + * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::saveBlobToFileAsync */ public function testsaveBlobToFileWithBlobNotExist() { @@ -2854,7 +2238,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase } /** - * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::saveBlobToFile + * @covers \MicrosoftAzure\Storage\Blob\BlobRestProxy::saveBlobToFileAsync */ public function testsaveBlobToFileWithContainerNotExist() { diff --git a/tests/unit/Blob/Models/ListBlobBlocksResultTest.php b/tests/unit/Blob/Models/ListBlobBlocksResultTest.php index c98035d..63a7549 100644 --- a/tests/unit/Blob/Models/ListBlobBlocksResultTest.php +++ b/tests/unit/Blob/Models/ListBlobBlocksResultTest.php @@ -60,7 +60,7 @@ class ListBlobBlocksResultTest extends \PHPUnit_Framework_TestCase $sampleHeaders = TestResources::listBlocksMultipleEntriesHeaders(); $sampleBody = TestResources::listBlocksMultipleEntriesBody(); $expectedDate = Utilities::rfc1123ToDateTime($sampleHeaders['Last-Modified']); - $getEntry = self::getMethod('_getEntries'); + $getEntry = self::getMethod('getEntries'); $uncommittedBlocks = $getEntry->invokeArgs(null, array($sampleBody, 'UncommittedBlocks')); $committedBlocks = $getEntry->invokeArgs(null, array($sampleBody, 'CommittedBlocks'));