Modifying the unneccessary public setters to protected to avoid mis-use.
This commit is contained in:
Родитель
7fa9c8d1e1
Коммит
83c166f883
|
@ -1,3 +1,7 @@
|
|||
Tracking Breaking changes in 0.13.0
|
||||
|
||||
* Modified the setters of most classes that represent API call result from `public` to `protected` to avoid unwanted corruption of SDK constructed data. If the user is using the setters prior to the release there could be a breaking change.
|
||||
|
||||
Tracking Breaking changes in 0.12.0
|
||||
|
||||
* Moved `getMetadataArray` and `validateMetadata` from ServiceRestProxy.php to Utilities.php
|
||||
|
|
|
@ -2957,9 +2957,8 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
|
|||
stream_get_contents($content, Resources::MB_IN_BYTES_4)
|
||||
);
|
||||
}
|
||||
//response body has already been set to file. Set the stream of the
|
||||
//response body to be null, then close the file.
|
||||
$result->setContentStream(null);
|
||||
|
||||
$content = null;
|
||||
fclose($resource);
|
||||
|
||||
return $result;
|
||||
|
|
|
@ -80,7 +80,7 @@ class BreakLeaseResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLeaseTime($leaseTime)
|
||||
protected function setLeaseTime($leaseTime)
|
||||
{
|
||||
$this->_leaseTime = $leaseTime;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ class CopyBlobResult
|
|||
*
|
||||
* @return CopyBlobResult
|
||||
*/
|
||||
public static function create($headers)
|
||||
public static function create(array $headers)
|
||||
{
|
||||
$result = new CopyBlobResult();
|
||||
$result->setETag(
|
||||
|
@ -94,7 +94,7 @@ class CopyBlobResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setETag($etag)
|
||||
protected function setETag($etag)
|
||||
{
|
||||
$this->_etag = $etag;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ class CopyBlobResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLastModified(\DateTime $lastModified)
|
||||
protected function setLastModified(\DateTime $lastModified)
|
||||
{
|
||||
$this->_lastModified = $lastModified;
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ class CreateBlobPagesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLastModified($lastModified)
|
||||
protected function setLastModified($lastModified)
|
||||
{
|
||||
Validate::isDate($lastModified);
|
||||
$this->_lastModified = $lastModified;
|
||||
|
@ -130,7 +130,7 @@ class CreateBlobPagesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setETag($etag)
|
||||
protected function setETag($etag)
|
||||
{
|
||||
Validate::isString($etag, 'etag');
|
||||
$this->_etag = $etag;
|
||||
|
@ -153,7 +153,7 @@ class CreateBlobPagesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentMD5($contentMD5)
|
||||
protected function setContentMD5($contentMD5)
|
||||
{
|
||||
$this->_contentMD5 = $contentMD5;
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ class CreateBlobPagesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSequenceNumber($sequenceNumber)
|
||||
protected function setSequenceNumber($sequenceNumber)
|
||||
{
|
||||
Validate::isInteger($sequenceNumber, 'sequenceNumber');
|
||||
$this->_sequenceNumber = $sequenceNumber;
|
||||
|
|
|
@ -102,7 +102,7 @@ class CreateBlobSnapshotResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSnapshot($snapshot)
|
||||
protected function setSnapshot($snapshot)
|
||||
{
|
||||
$this->_snapshot = $snapshot;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ class CreateBlobSnapshotResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setETag($etag)
|
||||
protected function setETag($etag)
|
||||
{
|
||||
$this->_etag = $etag;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ class CreateBlobSnapshotResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLastModified($lastModified)
|
||||
protected function setLastModified($lastModified)
|
||||
{
|
||||
$this->_lastModified = $lastModified;
|
||||
}
|
||||
|
|
|
@ -65,12 +65,18 @@ class GetBlobMetadataResult
|
|||
*
|
||||
* @return GetBlobMetadataResult
|
||||
*/
|
||||
public static function create($headers, $metadata)
|
||||
public static function create(array $headers, array $metadata)
|
||||
{
|
||||
$result = new GetBlobMetadataResult();
|
||||
$date = $headers[Resources::LAST_MODIFIED];
|
||||
$date = Utilities::tryGetValueInsensitive(
|
||||
Resources::LAST_MODIFIED,
|
||||
$headers
|
||||
);
|
||||
$result->setLastModified(Utilities::rfc1123ToDateTime($date));
|
||||
$result->setETag($headers[Resources::ETAG]);
|
||||
$result->setETag(Utilities::tryGetValueInsensitive(
|
||||
Resources::ETAG,
|
||||
$headers
|
||||
));
|
||||
$result->setMetadata(is_null($metadata) ? array() : $metadata);
|
||||
|
||||
return $result;
|
||||
|
@ -93,7 +99,7 @@ class GetBlobMetadataResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLastModified($lastModified)
|
||||
protected function setLastModified($lastModified)
|
||||
{
|
||||
Validate::isDate($lastModified);
|
||||
$this->_lastModified = $lastModified;
|
||||
|
@ -116,7 +122,7 @@ class GetBlobMetadataResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setETag($etag)
|
||||
protected function setETag($etag)
|
||||
{
|
||||
Validate::isString($etag, 'etag');
|
||||
$this->_etag = $etag;
|
||||
|
@ -139,7 +145,7 @@ class GetBlobMetadataResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMetadata($metadata)
|
||||
protected function setMetadata($metadata)
|
||||
{
|
||||
$this->_metadata = $metadata;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ class GetBlobPropertiesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMetadata(array $metadata)
|
||||
protected function setMetadata(array $metadata)
|
||||
{
|
||||
$this->_metadata = $metadata;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ class GetBlobPropertiesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setProperties($properties)
|
||||
protected function setProperties($properties)
|
||||
{
|
||||
$this->_properties = $properties;
|
||||
}
|
||||
|
@ -106,16 +106,48 @@ class GetBlobPropertiesResult
|
|||
{
|
||||
$result = new GetBlobPropertiesResult();
|
||||
$properties = new BlobProperties();
|
||||
$lastModified = $headers[Resources::LAST_MODIFIED];
|
||||
$blobType = $headers[Resources::X_MS_BLOB_TYPE];
|
||||
$contentLength = intval($headers[Resources::CONTENT_LENGTH]);
|
||||
$leaseStatus = Utilities::tryGetValue($headers, Resources::X_MS_LEASE_STATUS);
|
||||
$contentType = Utilities::tryGetValue($headers, Resources::CONTENT_TYPE);
|
||||
$contentMD5 = Utilities::tryGetValue($headers, Resources::CONTENT_MD5);
|
||||
$contentEncoding = Utilities::tryGetValue($headers, Resources::CONTENT_ENCODING);
|
||||
$contentLanguage = Utilities::tryGetValue($headers, Resources::CONTENT_LANGUAGE);
|
||||
$cacheControl = Utilities::tryGetValue($headers, Resources::CACHE_CONTROL);
|
||||
$etag = $headers[Resources::ETAG];
|
||||
$lastModified = Utilities::tryGetValueInsensitive(
|
||||
Resources::LAST_MODIFIED,
|
||||
$headers
|
||||
);
|
||||
$blobType = Utilities::tryGetValueInsensitive(
|
||||
Resources::X_MS_BLOB_TYPE,
|
||||
$headers
|
||||
);
|
||||
$contentLength = intval(Utilities::tryGetValueInsensitive(
|
||||
Resources::CONTENT_LENGTH,
|
||||
$headers
|
||||
));
|
||||
|
||||
$leaseStatus = Utilities::tryGetValueInsensitive(
|
||||
Resources::X_MS_LEASE_STATUS,
|
||||
$headers
|
||||
);
|
||||
$contentType = Utilities::tryGetValueInsensitive(
|
||||
Resources::CONTENT_TYPE,
|
||||
$headers
|
||||
);
|
||||
$contentMD5 = Utilities::tryGetValueInsensitive(
|
||||
Resources::CONTENT_MD5,
|
||||
$headers
|
||||
);
|
||||
$contentEncoding = Utilities::tryGetValueInsensitive(
|
||||
Resources::CONTENT_ENCODING,
|
||||
$headers
|
||||
);
|
||||
$contentLanguage = Utilities::tryGetValueInsensitive(
|
||||
Resources::CONTENT_LANGUAGE,
|
||||
$headers
|
||||
);
|
||||
$cacheControl = Utilities::tryGetValueInsensitive(
|
||||
Resources::CACHE_CONTROL,
|
||||
$headers
|
||||
);
|
||||
|
||||
$etag = Utilities::tryGetValueInsensitive(
|
||||
Resources::ETAG,
|
||||
$headers
|
||||
);
|
||||
$metadata = Utilities::getMetadataArray($headers);
|
||||
|
||||
if (array_key_exists(Resources::X_MS_BLOB_SEQUENCE_NUMBER, $headers)) {
|
||||
|
|
|
@ -95,7 +95,7 @@ class GetBlobResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMetadata(array $metadata)
|
||||
protected function setMetadata(array $metadata)
|
||||
{
|
||||
$this->_metadata = $metadata;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ class GetBlobResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setProperties(BlobProperties $properties)
|
||||
protected function setProperties(BlobProperties $properties)
|
||||
{
|
||||
$this->_properties = $properties;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ class GetBlobResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentStream($contentStream)
|
||||
protected function setContentStream($contentStream)
|
||||
{
|
||||
$this->_contentStream = $contentStream;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ class GetContainerACLResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContainerAcl(ContainerACL $containerACL)
|
||||
protected function setContainerAcl(ContainerACL $containerACL)
|
||||
{
|
||||
$this->_containerACL = $containerACL;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ class GetContainerACLResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLastModified(\DateTime $lastModified)
|
||||
protected function setLastModified(\DateTime $lastModified)
|
||||
{
|
||||
$this->_lastModified = $lastModified;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ class GetContainerACLResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setETag($etag)
|
||||
protected function setETag($etag)
|
||||
{
|
||||
$this->_etag = $etag;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ class GetContainerPropertiesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLastModified(\DateTime $lastModified)
|
||||
protected function setLastModified(\DateTime $lastModified)
|
||||
{
|
||||
$this->_lastModified = $lastModified;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ class GetContainerPropertiesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setETag($etag)
|
||||
protected function setETag($etag)
|
||||
{
|
||||
$this->_etag = $etag;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ class GetContainerPropertiesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMetadata(array $metadata)
|
||||
protected function setMetadata(array $metadata)
|
||||
{
|
||||
$this->_metadata = $metadata;
|
||||
}
|
||||
|
@ -137,12 +137,15 @@ class GetContainerPropertiesResult
|
|||
{
|
||||
$result = new GetContainerPropertiesResult();
|
||||
$metadata = Utilities::getMetadataArray($responseHeaders);
|
||||
$date = Utilities::tryGetValue(
|
||||
$responseHeaders,
|
||||
Resources::LAST_MODIFIED
|
||||
$date = Utilities::tryGetValueInsensitive(
|
||||
Resources::LAST_MODIFIED,
|
||||
$responseHeaders
|
||||
);
|
||||
$date = Utilities::rfc1123ToDateTime($date);
|
||||
$result->setETag(Utilities::tryGetValue($responseHeaders, Resources::ETAG));
|
||||
$result->setETag(Utilities::tryGetValueInsensitive(
|
||||
Resources::ETAG,
|
||||
$responseHeaders
|
||||
));
|
||||
$result->setMetadata($metadata);
|
||||
$result->setLastModified($date);
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ class LeaseBlobResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLeaseId($leaseId)
|
||||
protected function setLeaseId($leaseId)
|
||||
{
|
||||
$this->_leaseId = $leaseId;
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ class ListBlobBlocksResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLastModified(\DateTime $lastModified)
|
||||
protected function setLastModified(\DateTime $lastModified)
|
||||
{
|
||||
Validate::isDate($lastModified);
|
||||
$this->_lastModified = $lastModified;
|
||||
|
@ -178,7 +178,7 @@ class ListBlobBlocksResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setETag($etag)
|
||||
protected function setETag($etag)
|
||||
{
|
||||
$this->_etag = $etag;
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ class ListBlobBlocksResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentType($contentType)
|
||||
protected function setContentType($contentType)
|
||||
{
|
||||
$this->_contentType = $contentType;
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ class ListBlobBlocksResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentLength($contentLength)
|
||||
protected function setContentLength($contentLength)
|
||||
{
|
||||
Validate::isInteger($contentLength, 'contentLength');
|
||||
$this->_contentLength = $contentLength;
|
||||
|
@ -245,7 +245,7 @@ class ListBlobBlocksResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUncommittedBlocks(array $uncommittedBlocks)
|
||||
protected function setUncommittedBlocks(array $uncommittedBlocks)
|
||||
{
|
||||
$this->_uncommittedBlocks = $uncommittedBlocks;
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ class ListBlobBlocksResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setCommittedBlocks(array $committedBlocks)
|
||||
protected function setCommittedBlocks(array $committedBlocks)
|
||||
{
|
||||
$this->_committedBlocks = $committedBlocks;
|
||||
}
|
||||
|
|
|
@ -102,28 +102,28 @@ class ListBlobsResult
|
|||
Resources::XTAG_ATTRIBUTES,
|
||||
Resources::XTAG_CONTAINER_NAME
|
||||
);
|
||||
$result->_containerName = $containerName;
|
||||
$result->_prefix = Utilities::tryGetValue(
|
||||
$result->setContainerName($containerName);
|
||||
$result->setPrefix(Utilities::tryGetValue(
|
||||
$parsed,
|
||||
Resources::QP_PREFIX
|
||||
);
|
||||
$result->_marker = Utilities::tryGetValue(
|
||||
));
|
||||
$result->setMarker(Utilities::tryGetValue(
|
||||
$parsed,
|
||||
Resources::QP_MARKER
|
||||
);
|
||||
$result->_nextMarker = Utilities::tryGetValue(
|
||||
));
|
||||
$result->setNextMarker(Utilities::tryGetValue(
|
||||
$parsed,
|
||||
Resources::QP_NEXT_MARKER
|
||||
);
|
||||
$result->_maxResults = intval(
|
||||
));
|
||||
$result->setMaxResults(intval(
|
||||
Utilities::tryGetValue($parsed, Resources::QP_MAX_RESULTS, 0)
|
||||
);
|
||||
$result->_delimiter = Utilities::tryGetValue(
|
||||
));
|
||||
$result->setDelimiter(Utilities::tryGetValue(
|
||||
$parsed,
|
||||
Resources::QP_DELIMITER
|
||||
);
|
||||
$result->_blobs = array();
|
||||
$result->_blobPrefixes = array();
|
||||
));
|
||||
$blobs = array();
|
||||
$blobPrefixes = array();
|
||||
$rawBlobs = array();
|
||||
$rawBlobPrefixes = array();
|
||||
|
||||
|
@ -147,7 +147,7 @@ class ListBlobsResult
|
|||
Utilities::tryGetValue($value, Resources::QP_METADATA, array())
|
||||
);
|
||||
|
||||
$result->_blobs[] = $blob;
|
||||
$blobs[] = $blob;
|
||||
}
|
||||
|
||||
if (is_array($parsed['Blobs'])
|
||||
|
@ -160,9 +160,12 @@ class ListBlobsResult
|
|||
$blobPrefix = new BlobPrefix();
|
||||
$blobPrefix->setName($value['Name']);
|
||||
|
||||
$result->_blobPrefixes[] = $blobPrefix;
|
||||
$blobPrefixes[] = $blobPrefix;
|
||||
}
|
||||
|
||||
$result->setBlobs($blobs);
|
||||
$result->setBlobPrefixes($blobPrefixes);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -183,7 +186,7 @@ class ListBlobsResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setBlobs(array $blobs)
|
||||
protected function setBlobs(array $blobs)
|
||||
{
|
||||
$this->_blobs = array();
|
||||
foreach ($blobs as $blob) {
|
||||
|
@ -208,7 +211,7 @@ class ListBlobsResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setBlobPrefixes(array $blobPrefixes)
|
||||
protected function setBlobPrefixes(array $blobPrefixes)
|
||||
{
|
||||
$this->_blobPrefixes = array();
|
||||
foreach ($blobPrefixes as $blob) {
|
||||
|
@ -233,7 +236,7 @@ class ListBlobsResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPrefix($prefix)
|
||||
protected function setPrefix($prefix)
|
||||
{
|
||||
$this->_prefix = $prefix;
|
||||
}
|
||||
|
@ -255,7 +258,7 @@ class ListBlobsResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setDelimiter($delimiter)
|
||||
protected function setDelimiter($delimiter)
|
||||
{
|
||||
$this->_delimiter = $delimiter;
|
||||
}
|
||||
|
@ -277,7 +280,7 @@ class ListBlobsResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMarker($marker)
|
||||
protected function setMarker($marker)
|
||||
{
|
||||
$this->_marker = $marker;
|
||||
}
|
||||
|
@ -299,7 +302,7 @@ class ListBlobsResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMaxResults($maxResults)
|
||||
protected function setMaxResults($maxResults)
|
||||
{
|
||||
$this->_maxResults = $maxResults;
|
||||
}
|
||||
|
@ -321,7 +324,7 @@ class ListBlobsResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setNextMarker($nextMarker)
|
||||
protected function setNextMarker($nextMarker)
|
||||
{
|
||||
$this->_nextMarker = $nextMarker;
|
||||
}
|
||||
|
@ -343,7 +346,7 @@ class ListBlobsResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContainerName($containerName)
|
||||
protected function setContainerName($containerName)
|
||||
{
|
||||
$this->_containerName = $containerName;
|
||||
}
|
||||
|
|
|
@ -87,26 +87,26 @@ class ListContainersResult
|
|||
Resources::XTAG_ATTRIBUTES,
|
||||
Resources::XTAG_SERVICE_ENDPOINT
|
||||
);
|
||||
$result->_accountName = Utilities::tryParseAccountNameFromUrl(
|
||||
$result->setAccountName(Utilities::tryParseAccountNameFromUrl(
|
||||
$serviceEndpoint
|
||||
);
|
||||
$result->_prefix = Utilities::tryGetValue(
|
||||
));
|
||||
$result->setPrefix(Utilities::tryGetValue(
|
||||
$parsedResponse,
|
||||
Resources::QP_PREFIX
|
||||
);
|
||||
$result->_marker = Utilities::tryGetValue(
|
||||
));
|
||||
$result->setMarker(Utilities::tryGetValue(
|
||||
$parsedResponse,
|
||||
Resources::QP_MARKER
|
||||
);
|
||||
$result->_nextMarker = Utilities::tryGetValue(
|
||||
));
|
||||
$result->setNextMarker(Utilities::tryGetValue(
|
||||
$parsedResponse,
|
||||
Resources::QP_NEXT_MARKER
|
||||
);
|
||||
$result->_maxResults = Utilities::tryGetValue(
|
||||
));
|
||||
$result->setMaxResults(Utilities::tryGetValue(
|
||||
$parsedResponse,
|
||||
Resources::QP_MAX_RESULTS
|
||||
);
|
||||
$result->_containers = array();
|
||||
));
|
||||
$containers = array();
|
||||
$rawContainer = array();
|
||||
|
||||
if (!empty($parsedResponse['Containers'])) {
|
||||
|
@ -127,9 +127,9 @@ class ListContainersResult
|
|||
$properties->setLastModified($date);
|
||||
$properties->setETag($value['Properties']['Etag']);
|
||||
$container->setProperties($properties);
|
||||
$result->_containers[] = $container;
|
||||
$containers[] = $container;
|
||||
}
|
||||
|
||||
$result->setContainers($containers);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ class ListContainersResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContainers(array $containers)
|
||||
protected function setContainers(array $containers)
|
||||
{
|
||||
$this->_containers = array();
|
||||
foreach ($containers as $container) {
|
||||
|
@ -175,7 +175,7 @@ class ListContainersResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPrefix($prefix)
|
||||
protected function setPrefix($prefix)
|
||||
{
|
||||
$this->_prefix = $prefix;
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ class ListContainersResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMarker($marker)
|
||||
protected function setMarker($marker)
|
||||
{
|
||||
$this->_marker = $marker;
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ class ListContainersResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMaxResults($maxResults)
|
||||
protected function setMaxResults($maxResults)
|
||||
{
|
||||
$this->_maxResults = $maxResults;
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ class ListContainersResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setNextMarker($nextMarker)
|
||||
protected function setNextMarker($nextMarker)
|
||||
{
|
||||
$this->_nextMarker = $nextMarker;
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ class ListContainersResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAccountName($accountName)
|
||||
protected function setAccountName($accountName)
|
||||
{
|
||||
$this->_accountName = $accountName;
|
||||
}
|
||||
|
|
|
@ -85,14 +85,14 @@ class ListPageBlobRangesResult
|
|||
$rawPageRanges = Utilities::getArray($parsed['pagerange']);
|
||||
}
|
||||
|
||||
$result->_pageRanges = array();
|
||||
$pageRanges = array();
|
||||
foreach ($rawPageRanges as $value) {
|
||||
$result->_pageRanges[] = new PageRange(
|
||||
$pageRanges[] = new PageRange(
|
||||
intval($value['Start']),
|
||||
intval($value['End'])
|
||||
);
|
||||
}
|
||||
|
||||
$result->setPageRanges($pageRanges);
|
||||
$result->setContentLength($blobLength);
|
||||
$result->setETag($headers[Resources::ETAG]);
|
||||
$result->setLastModified($date);
|
||||
|
@ -117,7 +117,7 @@ class ListPageBlobRangesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLastModified(\DateTime $lastModified)
|
||||
protected function setLastModified(\DateTime $lastModified)
|
||||
{
|
||||
Validate::isDate($lastModified);
|
||||
$this->_lastModified = $lastModified;
|
||||
|
@ -140,7 +140,7 @@ class ListPageBlobRangesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setETag($etag)
|
||||
protected function setETag($etag)
|
||||
{
|
||||
Validate::isString($etag, 'etag');
|
||||
$this->_etag = $etag;
|
||||
|
@ -163,7 +163,7 @@ class ListPageBlobRangesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentLength($contentLength)
|
||||
protected function setContentLength($contentLength)
|
||||
{
|
||||
Validate::isInteger($contentLength, 'contentLength');
|
||||
$this->_contentLength = $contentLength;
|
||||
|
@ -186,7 +186,7 @@ class ListPageBlobRangesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPageRanges(array $pageRanges)
|
||||
protected function setPageRanges(array $pageRanges)
|
||||
{
|
||||
$this->_pageRanges = array();
|
||||
foreach ($pageRanges as $pageRange) {
|
||||
|
|
|
@ -111,7 +111,7 @@ class PutBlobResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setETag($etag)
|
||||
protected function setETag($etag)
|
||||
{
|
||||
$this->_etag = $etag;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ class PutBlobResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLastModified(\DateTime $lastModified)
|
||||
protected function setLastModified(\DateTime $lastModified)
|
||||
{
|
||||
$this->_lastModified = $lastModified;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ class PutBlobResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentMD5($contentMD5)
|
||||
protected function setContentMD5($contentMD5)
|
||||
{
|
||||
$this->_contentMD5 = $contentMD5;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ class PutBlockResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentMD5($contentMD5)
|
||||
protected function setContentMD5($contentMD5)
|
||||
{
|
||||
$this->_contentMD5 = $contentMD5;
|
||||
}
|
||||
|
|
|
@ -62,9 +62,15 @@ class SetBlobMetadataResult
|
|||
public static function create(array $headers)
|
||||
{
|
||||
$result = new SetBlobMetadataResult();
|
||||
$date = $headers[Resources::LAST_MODIFIED];
|
||||
$date = Utilities::tryGetValueInsensitive(
|
||||
Resources::LAST_MODIFIED,
|
||||
$headers
|
||||
);
|
||||
$result->setLastModified(Utilities::rfc1123ToDateTime($date));
|
||||
$result->setETag($headers[Resources::ETAG]);
|
||||
$result->setETag(Utilities::tryGetValueInsensitive(
|
||||
Resources::ETAG,
|
||||
$headers
|
||||
));
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
@ -86,7 +92,7 @@ class SetBlobMetadataResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLastModified(\DateTime $lastModified)
|
||||
protected function setLastModified(\DateTime $lastModified)
|
||||
{
|
||||
Validate::isDate($lastModified);
|
||||
$this->_lastModified = $lastModified;
|
||||
|
@ -109,7 +115,7 @@ class SetBlobMetadataResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setETag($etag)
|
||||
protected function setETag($etag)
|
||||
{
|
||||
Validate::isString($etag, 'etag');
|
||||
$this->_etag = $etag;
|
||||
|
|
|
@ -66,13 +66,19 @@ class SetBlobPropertiesResult
|
|||
public static function create(array $headers)
|
||||
{
|
||||
$result = new SetBlobPropertiesResult();
|
||||
$date = $headers[Resources::LAST_MODIFIED];
|
||||
$date = Utilities::tryGetValueInsensitive(
|
||||
Resources::LAST_MODIFIED,
|
||||
$headers
|
||||
);
|
||||
$result->setLastModified(Utilities::rfc1123ToDateTime($date));
|
||||
$result->setETag($headers[Resources::ETAG]);
|
||||
if (array_key_exists(Resources::X_MS_BLOB_SEQUENCE_NUMBER, $headers)) {
|
||||
$sNumber = $headers[Resources::X_MS_BLOB_SEQUENCE_NUMBER];
|
||||
$result->setSequenceNumber(intval($sNumber));
|
||||
}
|
||||
$result->setETag(Utilities::tryGetValueInsensitive(
|
||||
Resources::ETAG,
|
||||
$headers
|
||||
));
|
||||
$result->setSequenceNumber(Utilities::tryGetValueInsensitive(
|
||||
Resources::X_MS_BLOB_SEQUENCE_NUMBER,
|
||||
$headers
|
||||
));
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
@ -94,7 +100,7 @@ class SetBlobPropertiesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLastModified(\DateTime $lastModified)
|
||||
protected function setLastModified(\DateTime $lastModified)
|
||||
{
|
||||
Validate::isDate($lastModified);
|
||||
$this->_lastModified = $lastModified;
|
||||
|
@ -117,7 +123,7 @@ class SetBlobPropertiesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setETag($etag)
|
||||
protected function setETag($etag)
|
||||
{
|
||||
Validate::isString($etag, 'etag');
|
||||
$this->_etag = $etag;
|
||||
|
@ -140,7 +146,7 @@ class SetBlobPropertiesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSequenceNumber($sequenceNumber)
|
||||
protected function setSequenceNumber($sequenceNumber)
|
||||
{
|
||||
Validate::isInteger($sequenceNumber, 'sequenceNumber');
|
||||
$this->_sequenceNumber = $sequenceNumber;
|
||||
|
|
|
@ -278,6 +278,7 @@ class Resources
|
|||
const QP_NEXT_RK = 'NextRowKey';
|
||||
const QP_ACTION = 'action';
|
||||
const QP_EMBED_DETAIL = 'embed-detail';
|
||||
const QP_QUEUE_MESSAGE = 'QueueMessage';
|
||||
|
||||
// Query parameter values
|
||||
const QPV_REGENERATE = 'regenerate';
|
||||
|
|
|
@ -836,4 +836,19 @@ class Utilities
|
|||
Validate::isString($value, 'metadata value');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Append the content to file.
|
||||
* @param string $path The file to append to.
|
||||
* @param string $content The content to append.
|
||||
* @return void
|
||||
*/
|
||||
public static function appendToFile($path, $content)
|
||||
{
|
||||
$resource = @fopen($path, 'a+');
|
||||
if ($resource != null) {
|
||||
fwrite($resource, $content);
|
||||
fclose($resource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ class GetServicePropertiesResult
|
|||
public static function create(array $parsedResponse)
|
||||
{
|
||||
$result = new GetServicePropertiesResult();
|
||||
$result->_serviceProperties = ServiceProperties::create($parsedResponse);
|
||||
$result->setValue(ServiceProperties::create($parsedResponse));
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ class GetServicePropertiesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setValue($serviceProperties)
|
||||
protected function setValue($serviceProperties)
|
||||
{
|
||||
$this->_serviceProperties = clone $serviceProperties;
|
||||
}
|
||||
|
|
|
@ -59,8 +59,8 @@ class GetQueueMetadataResult
|
|||
*/
|
||||
public function __construct($approximateMessageCount, array $metadata)
|
||||
{
|
||||
$this->_approximateMessageCount = $approximateMessageCount;
|
||||
$this->_metadata = is_null($metadata) ? array() : $metadata;
|
||||
$this->setApproximateMessageCount($approximateMessageCount);
|
||||
$this->setMetadata(is_null($metadata) ? array() : $metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,7 +80,7 @@ class GetQueueMetadataResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setApproximateMessageCount($approximateMessageCount)
|
||||
protected function setApproximateMessageCount($approximateMessageCount)
|
||||
{
|
||||
$this->_approximateMessageCount = $approximateMessageCount;
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ class GetQueueMetadataResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMetadata(array $metadata)
|
||||
protected function setMetadata(array $metadata)
|
||||
{
|
||||
$this->_metadata = $metadata;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ class ListMessagesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setQueueMessages($queueMessages)
|
||||
protected function setQueueMessages($queueMessages)
|
||||
{
|
||||
$this->_queueMessages = array();
|
||||
|
||||
|
|
|
@ -63,26 +63,26 @@ class ListQueuesResult
|
|||
Resources::XTAG_ATTRIBUTES,
|
||||
Resources::XTAG_SERVICE_ENDPOINT
|
||||
);
|
||||
$result->_accountName = Utilities::tryParseAccountNameFromUrl(
|
||||
$result->setAccountName(Utilities::tryParseAccountNameFromUrl(
|
||||
$serviceEndpoint
|
||||
);
|
||||
$result->_prefix = Utilities::tryGetValue(
|
||||
));
|
||||
$result->setPrefix(Utilities::tryGetValue(
|
||||
$parsedResponse,
|
||||
Resources::QP_PREFIX
|
||||
);
|
||||
$result->_marker = Utilities::tryGetValue(
|
||||
));
|
||||
$result->setMarker(Utilities::tryGetValue(
|
||||
$parsedResponse,
|
||||
Resources::QP_MARKER
|
||||
);
|
||||
$result->_nextMarker = Utilities::tryGetValue(
|
||||
));
|
||||
$result->setNextMarker(Utilities::tryGetValue(
|
||||
$parsedResponse,
|
||||
Resources::QP_NEXT_MARKER
|
||||
);
|
||||
$result->_maxResults = Utilities::tryGetValue(
|
||||
));
|
||||
$result->setMaxResults(Utilities::tryGetValue(
|
||||
$parsedResponse,
|
||||
Resources::QP_MAX_RESULTS
|
||||
);
|
||||
$result->_queues = array();
|
||||
));
|
||||
$queues = array();
|
||||
$rawQueues = array();
|
||||
|
||||
if (!empty($parsedResponse['Queues'])) {
|
||||
|
@ -93,9 +93,9 @@ class ListQueuesResult
|
|||
$queue = new Queue($value['Name'], $serviceEndpoint . $value['Name']);
|
||||
$metadata = Utilities::tryGetValue($value, Resources::QP_METADATA);
|
||||
$queue->setMetadata(is_null($metadata) ? array() : $metadata);
|
||||
$result->_queues[] = $queue;
|
||||
$queues[] = $queue;
|
||||
}
|
||||
|
||||
$result->setQueues($queues);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ class ListQueuesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setQueues(array $queues)
|
||||
protected function setQueues(array $queues)
|
||||
{
|
||||
$this->_queues = array();
|
||||
foreach ($queues as $queue) {
|
||||
|
@ -141,7 +141,7 @@ class ListQueuesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPrefix($prefix)
|
||||
protected function setPrefix($prefix)
|
||||
{
|
||||
$this->_prefix = $prefix;
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ class ListQueuesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMarker($marker)
|
||||
protected function setMarker($marker)
|
||||
{
|
||||
$this->_marker = $marker;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ class ListQueuesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMaxResults($maxResults)
|
||||
protected function setMaxResults($maxResults)
|
||||
{
|
||||
$this->_maxResults = $maxResults;
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ class ListQueuesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setNextMarker($nextMarker)
|
||||
protected function setNextMarker($nextMarker)
|
||||
{
|
||||
$this->_nextMarker = $nextMarker;
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ class ListQueuesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAccountName($accountName)
|
||||
protected function setAccountName($accountName)
|
||||
{
|
||||
$this->_accountName = $accountName;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace MicrosoftAzure\Storage\Queue\Models;
|
|||
|
||||
use MicrosoftAzure\Storage\Queue\Models\MicrosoftAzureQueueMessage;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Resources;
|
||||
|
||||
/**
|
||||
* Holds results of listMessages wrapper.
|
||||
|
@ -60,7 +61,9 @@ class PeekMessagesResult
|
|||
$queueMessages = array();
|
||||
|
||||
if (!empty($parsedResponse)) {
|
||||
$rawMessages = Utilities::getArray($parsedResponse['QueueMessage']);
|
||||
$rawMessages = Utilities::getArray(
|
||||
$parsedResponse[Resources::QP_QUEUE_MESSAGE]
|
||||
);
|
||||
foreach ($rawMessages as $value) {
|
||||
$message = MicrosoftAzureQueueMessage::createFromPeekMessages($value);
|
||||
|
||||
|
@ -95,7 +98,7 @@ class PeekMessagesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setQueueMessages($queueMessages)
|
||||
protected function setQueueMessages($queueMessages)
|
||||
{
|
||||
$this->_queueMessages = $queueMessages;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
namespace MicrosoftAzure\Storage\Queue\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\Internal\Validate;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Resources;
|
||||
|
||||
/**
|
||||
* Holds results of updateMessage wrapper.
|
||||
|
@ -55,6 +57,30 @@ class UpdateMessageResult
|
|||
*/
|
||||
private $_timeNextVisible;
|
||||
|
||||
/**
|
||||
* Creates an instance with the given response headers.
|
||||
*
|
||||
* @param array $headers The response headers used to create the instance.
|
||||
*
|
||||
* @return UpdateMessageResult
|
||||
*/
|
||||
public static function create(array $headers)
|
||||
{
|
||||
$result = new UpdateMessageResult();
|
||||
$result->setPopReceipt(Utilities::tryGetValueInsensitive(
|
||||
Resources::X_MS_POPRECEIPT,
|
||||
$headers
|
||||
));
|
||||
$timeNextVisible = Utilities::tryGetValueInsensitive(
|
||||
Resources::X_MS_TIME_NEXT_VISIBLE,
|
||||
$headers
|
||||
);
|
||||
$date = Utilities::rfc1123ToDateTime($timeNextVisible);
|
||||
$result->setTimeNextVisible($date);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets timeNextVisible field.
|
||||
*
|
||||
|
@ -73,7 +99,7 @@ class UpdateMessageResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setTimeNextVisible(\DateTime $timeNextVisible)
|
||||
protected function setTimeNextVisible(\DateTime $timeNextVisible)
|
||||
{
|
||||
Validate::isDate($timeNextVisible);
|
||||
|
||||
|
@ -97,7 +123,7 @@ class UpdateMessageResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPopReceipt($popReceipt)
|
||||
protected function setPopReceipt($popReceipt)
|
||||
{
|
||||
Validate::isString($popReceipt, 'popReceipt');
|
||||
$this->_popReceipt = $popReceipt;
|
||||
|
|
|
@ -1035,22 +1035,7 @@ class QueueRestProxy extends ServiceRestProxy implements IQueue
|
|||
$options->getRequestOptions()
|
||||
)->then(function ($response) {
|
||||
$responseHeaders = HttpFormatter::formatHeaders($response->getHeaders());
|
||||
|
||||
$popReceipt = Utilities::tryGetValue(
|
||||
$responseHeaders,
|
||||
Resources::X_MS_POPRECEIPT
|
||||
);
|
||||
$timeNextVisible = Utilities::tryGetValue(
|
||||
$responseHeaders,
|
||||
Resources::X_MS_TIME_NEXT_VISIBLE
|
||||
);
|
||||
|
||||
$date = Utilities::rfc1123ToDateTime($timeNextVisible);
|
||||
$result = new UpdateMessageResult();
|
||||
$result->setPopReceipt($popReceipt);
|
||||
$result->setTimeNextVisible($date);
|
||||
|
||||
return $result;
|
||||
return UpdateMessageResult::create($responseHeaders);
|
||||
}, null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ class BatchOperations
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setOperations($operations)
|
||||
public function setOperations(array $operations)
|
||||
{
|
||||
$this->_operations = array();
|
||||
foreach ($operations as $operation) {
|
||||
|
|
|
@ -192,6 +192,7 @@ class BatchResult
|
|||
$entries[] = BatchError::create($e, $response->headers);
|
||||
}
|
||||
}
|
||||
|
||||
$result->setEntries($entries);
|
||||
|
||||
return $result;
|
||||
|
@ -214,7 +215,7 @@ class BatchResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setEntries(array $entries)
|
||||
protected function setEntries(array $entries)
|
||||
{
|
||||
$this->_entries = $entries;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
namespace MicrosoftAzure\Storage\Table\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Table\Internal\IAtomReaderWriter;
|
||||
|
||||
/**
|
||||
* Holds result of calling getEntity wrapper.
|
||||
*
|
||||
|
@ -59,8 +61,16 @@ class GetEntityResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setEntity($entity)
|
||||
protected function setEntity($entity)
|
||||
{
|
||||
$this->_entity = $entity;
|
||||
}
|
||||
|
||||
public static function create($body, IAtomReaderWriter $serializer)
|
||||
{
|
||||
$result = new GetEntityResult();
|
||||
$result->setEntity($serializer->parseEntity($body));
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,6 @@ class GetTableResult
|
|||
public static function create($body, $atomSerializer)
|
||||
{
|
||||
$result = new GetTableResult();
|
||||
|
||||
$name = $atomSerializer->parseTable($body);
|
||||
$result->setName($name);
|
||||
|
||||
|
@ -80,7 +79,7 @@ class GetTableResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setName($name)
|
||||
protected function setName($name)
|
||||
{
|
||||
$this->_name = $name;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ class InsertEntityResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setEntity($entity)
|
||||
protected function setEntity($entity)
|
||||
{
|
||||
$this->_entity = $entity;
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ class QueryEntitiesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setEntities(array $entities)
|
||||
protected function setEntities(array $entities)
|
||||
{
|
||||
$this->_entities = $entities;
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ class QueryEntitiesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setNextPartitionKey($nextPartitionKey)
|
||||
protected function setNextPartitionKey($nextPartitionKey)
|
||||
{
|
||||
$this->_nextPartitionKey = $nextPartitionKey;
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ class QueryEntitiesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setNextRowKey($nextRowKey)
|
||||
protected function setNextRowKey($nextRowKey)
|
||||
{
|
||||
$this->_nextRowKey = $nextRowKey;
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ class QueryTablesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setNextTableName($nextTableName)
|
||||
protected function setNextTableName($nextTableName)
|
||||
{
|
||||
$this->_nextTableName = $nextTableName;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ class QueryTablesResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setTables(array $tables)
|
||||
protected function setTables(array $tables)
|
||||
{
|
||||
$this->_tables = $tables;
|
||||
}
|
||||
|
|
|
@ -55,8 +55,9 @@ class UpdateEntityResult
|
|||
public static function create(array $headers)
|
||||
{
|
||||
$result = new UpdateEntityResult();
|
||||
$clean = array_change_key_case($headers);
|
||||
$result->setETag($clean[Resources::ETAG]);
|
||||
$result->setETag(
|
||||
Utilities::tryGetValueInsensitive(Resources::ETAG, $headers)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
@ -78,7 +79,7 @@ class UpdateEntityResult
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setETag($etag)
|
||||
protected function setETag($etag)
|
||||
{
|
||||
$this->_etag = $etag;
|
||||
}
|
||||
|
|
|
@ -921,7 +921,6 @@ class TableRestProxy extends ServiceRestProxy implements ITable
|
|||
$options->getRequestOptions()
|
||||
)->then(function ($response) use ($atomSerializer) {
|
||||
$tables = $atomSerializer->parseTableEntries($response->getBody());
|
||||
|
||||
return QueryTablesResult::create(
|
||||
HttpFormatter::formatHeaders($response->getHeaders()),
|
||||
$tables
|
||||
|
@ -1273,7 +1272,6 @@ class TableRestProxy extends ServiceRestProxy implements ITable
|
|||
function ($response) use ($atomSerializer) {
|
||||
$body = $response->getBody();
|
||||
$headers = HttpFormatter::formatHeaders($response->getHeaders());
|
||||
|
||||
return InsertEntityResult::create(
|
||||
$body,
|
||||
$headers,
|
||||
|
@ -1602,10 +1600,10 @@ class TableRestProxy extends ServiceRestProxy implements ITable
|
|||
|
||||
return $this->sendContextAsync($context)->then(
|
||||
function ($response) use ($atomSerializer) {
|
||||
$entity = $atomSerializer->parseEntity($response->getBody());
|
||||
$result = new GetEntityResult();
|
||||
$result->setEntity($entity);
|
||||
return $result;
|
||||
return GetEntityResult::create(
|
||||
$response->getBody(),
|
||||
$atomSerializer
|
||||
);
|
||||
},
|
||||
null
|
||||
);
|
||||
|
|
|
@ -28,6 +28,10 @@ use MicrosoftAzure\Storage\Table\Models\EdmType;
|
|||
use MicrosoftAzure\Storage\Table\Models\Entity;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Http\HttpCallContext;
|
||||
use MicrosoftAzure\Storage\Table\Models\BatchOperation;
|
||||
use MicrosoftAzure\Storage\Table\Models\BatchOperationType;
|
||||
use MicrosoftAzure\Storage\Table\Models\UpdateEntityResult;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
|
||||
/**
|
||||
|
@ -323,6 +327,8 @@ class TestResources
|
|||
$sample = array();
|
||||
$sample['@attributes']['ServiceEndpoint'] = 'http://myaccount.blob.core.windows.net/';
|
||||
$sample['MaxResults'] = '2';
|
||||
$sample['Prefix'] = 'myprefix';
|
||||
$sample['Account'] = 'myaccount';
|
||||
$sample['Queues'] = array('Queue' => array(
|
||||
0 => array('Name' => 'myqueue1'),
|
||||
1 => array('Name' => 'myqueue2')
|
||||
|
@ -364,6 +370,8 @@ class TestResources
|
|||
$sample = array();
|
||||
$sample['@attributes']['ServiceEndpoint'] = 'http://myaccount.blob.core.windows.net/';
|
||||
$sample['MaxResults'] = '3';
|
||||
$sample['account'] = 'myaccount';
|
||||
$sample['Prefix'] = 'myprefix';
|
||||
$sample['Containers'] = array('Container' => array(
|
||||
0 => array(
|
||||
'Name' => 'audio',
|
||||
|
@ -431,6 +439,7 @@ class TestResources
|
|||
{
|
||||
$sample = array();
|
||||
$sample['@attributes']['ServiceEndpoint'] = 'http://myaccount.blob.core.windows.net/';
|
||||
$sample['@attributes']['ContainerName'] = 'mycontainer';
|
||||
$sample['Marker'] = '/account/listblobswithnextmarker3';
|
||||
$sample['MaxResults'] = '2';
|
||||
$sample['Delimiter'] = 'mydelimiter';
|
||||
|
@ -451,8 +460,8 @@ class TestResources
|
|||
'Content-MD5' => 'md5',
|
||||
'Cache-Control' => 'cachecontrol',
|
||||
'x-ms-blob-sequence-number' => '0',
|
||||
'BlobType' => 'BlockBlob',
|
||||
'LeaseStatus' => 'locked'
|
||||
'x-ms-blob-type' => 'BlockBlob',
|
||||
'x-ms-lease-status' => 'locked'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@ -466,6 +475,7 @@ class TestResources
|
|||
{
|
||||
$sample = array();
|
||||
$sample['@attributes']['ServiceEndpoint'] = 'http://myaccount.blob.core.windows.net/';
|
||||
$sample['@attributes']['ContainerName'] = 'mycontainer';
|
||||
$sample['Marker'] = '/account/listblobswithnextmarker3';
|
||||
$sample['MaxResults'] = '2';
|
||||
$sample['Blobs'] = array(
|
||||
|
@ -515,6 +525,72 @@ class TestResources
|
|||
return $sample;
|
||||
}
|
||||
|
||||
public static function listBlocksMultipleEntriesHeaders()
|
||||
{
|
||||
$sample = array(
|
||||
'Last-Modified' => 'Sat, 04 Sep 2011 12:43:08 GMT',
|
||||
'Etag' => '0x8CAFB82EFF70C46',
|
||||
'x-ms-blob-content-length' => '13606912',
|
||||
'Content-Type' => 'type',
|
||||
'Content-Encoding' => 'encoding',
|
||||
'Content-Language' => 'language',
|
||||
'Content-MD5' => 'md5',
|
||||
'Cache-Control' => 'cachecontrol',
|
||||
'x-ms-blob-sequence-number' => '0',
|
||||
'BlobType' => 'BlockBlob',
|
||||
'LeaseStatus' => 'locked'
|
||||
);
|
||||
|
||||
return $sample;
|
||||
}
|
||||
|
||||
public static function listBlocksMultipleEntriesBody()
|
||||
{
|
||||
$sample = array();
|
||||
$sample['CommittedBlocks'] = array('Block' => array(
|
||||
0 => array('Name' => 'BlockId001', 'Size' => '4194304'),
|
||||
1 => array('Name' => 'BlockId002', 'Size' => '4194304')
|
||||
));
|
||||
|
||||
$sample['UncommittedBlocks'] = array('Block' => array(
|
||||
0 => array('Name' => 'BlockId003', 'Size' => '4194304'),
|
||||
1 => array('Name' => 'BlockId004', 'Size' => '1024000')
|
||||
));
|
||||
|
||||
return $sample;
|
||||
}
|
||||
|
||||
public static function listPageRangeHeaders()
|
||||
{
|
||||
$sample = array(
|
||||
'Last-Modified' => 'Sat, 04 Sep 2011 12:43:08 GMT',
|
||||
'Etag' => '0x8CAFB82EFF70C46',
|
||||
'x-ms-blob-content-length' => '13606912',
|
||||
);
|
||||
|
||||
return $sample;
|
||||
}
|
||||
|
||||
public static function listPageRangeBodyInArray()
|
||||
{
|
||||
return array('PageRange' => array(
|
||||
0 => array('Start' => '0', 'End' => '4194303'),
|
||||
1 => array('Start' => '4194304', 'End' => '8388607'),
|
||||
2 => array('Start' => '8388608', 'End' => '12582911'),
|
||||
3 => array('Start' => '12582911', 'End' => '13606911'),
|
||||
));
|
||||
}
|
||||
|
||||
public static function getUpdateMessageResultSampleHeaders()
|
||||
{
|
||||
return array(
|
||||
Resources::X_MS_POPRECEIPT =>
|
||||
'YzQ4Yzg1MDItYTc0Ny00OWNjLTkxYTUtZGM0MDFiZDAwYzEw',
|
||||
Resources::X_MS_TIME_NEXT_VISIBLE =>
|
||||
'Fri, 09 Oct 2009 23:29:20 GMT'
|
||||
);
|
||||
}
|
||||
|
||||
public static function getTestEntity($partitionKey, $rowKey)
|
||||
{
|
||||
$entity = new Entity();
|
||||
|
@ -553,4 +629,184 @@ class TestResources
|
|||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function getBatchResponseHeaders()
|
||||
{
|
||||
return array(
|
||||
'Cache-Control' => array('no-cache'),
|
||||
'Transfer-Encoding' => array('chunked'),
|
||||
'Content_Type' => array('multipart/mixed; boundary=batchresponse_e899556e-c637-4b2d-8cd1-63edb03dd6fe'),
|
||||
'Server' => array('Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0'),
|
||||
'x-ms-request-id' => array('b3818f44-0002-001d-01fe-872339000000'),
|
||||
'x-ms-version' => array('2015-04-05'),
|
||||
'X-Content-Type-Options' => array('nosniff'),
|
||||
'Date' => array('Thu, 16 Feb 2017 02:46:47 GMT')
|
||||
);
|
||||
}
|
||||
|
||||
public static function getBatchContexts()
|
||||
{
|
||||
$contexts = array();
|
||||
for ($i = 0; $i < 6; ++$i) {
|
||||
$context = new HttpCallContext();
|
||||
$context->setStatusCodes([204]);
|
||||
$contexts[] = $context;
|
||||
}
|
||||
return $contexts;
|
||||
}
|
||||
|
||||
public static function getBatchOperations()
|
||||
{
|
||||
$operations = array();
|
||||
$operation1 = new BatchOperation();
|
||||
$operation2 = new BatchOperation();
|
||||
$operation3 = new BatchOperation();
|
||||
$operation4 = new BatchOperation();
|
||||
$operation5 = new BatchOperation();
|
||||
$operation6 = new BatchOperation();
|
||||
$operation1->setType(BatchOperationType::DELETE_ENTITY_OPERATION);
|
||||
$operation2->setType(BatchOperationType::MERGE_ENTITY_OPERATION);
|
||||
$operation3->setType(BatchOperationType::INSERT_MERGE_ENTITY_OPERATION);
|
||||
$operation4->setType(BatchOperationType::INSERT_MERGE_ENTITY_OPERATION);
|
||||
$operation5->setType(BatchOperationType::DELETE_ENTITY_OPERATION);
|
||||
$operation6->setType(BatchOperationType::DELETE_ENTITY_OPERATION);
|
||||
$operations[] = $operation1;
|
||||
$operations[] = $operation2;
|
||||
$operations[] = $operation3;
|
||||
$operations[] = $operation4;
|
||||
$operations[] = $operation5;
|
||||
$operations[] = $operation6;
|
||||
|
||||
return $operations;
|
||||
}
|
||||
|
||||
public static function getExpectedBatchResultEntries()
|
||||
{
|
||||
$entityResult1 = UpdateEntityResult::create(
|
||||
array(Resources::ETAG => 'W/"datetime\'2017-02-16T02%3A46%3A47.89766Z\'"')
|
||||
);
|
||||
$entityResult2 = UpdateEntityResult::create(
|
||||
array(Resources::ETAG => 'W/"datetime\'2017-02-16T02%3A46%3A47.89766Z\'"')
|
||||
);
|
||||
$entityResult3 = UpdateEntityResult::create(
|
||||
array(Resources::ETAG => 'W/"datetime\'2017-02-16T02%3A46%3A47.89766Z\'"')
|
||||
);
|
||||
return [
|
||||
'The entity was deleted successfully.',
|
||||
$entityResult1,
|
||||
$entityResult2,
|
||||
$entityResult3,
|
||||
'The entity was deleted successfully.',
|
||||
'The entity was deleted successfully.',
|
||||
];
|
||||
}
|
||||
|
||||
public static function getBatchResponseBody()
|
||||
{
|
||||
return '--batchresponse_e899556e-c637-4b2d-8cd1-63edb03dd6fe
|
||||
Content-Type: multipart/mixed; boundary=changesetresponse_2918827d-ca4b-4da7-8ff2-5e205df53ac9
|
||||
|
||||
--changesetresponse_2918827d-ca4b-4da7-8ff2-5e205df53ac9
|
||||
Content-Type: application/http
|
||||
Content-Transfer-Encoding: binary
|
||||
|
||||
HTTP/1.1 204 No Content
|
||||
Content-ID: 1
|
||||
X-Content-Type-Options: nosniff
|
||||
Cache-Control: no-cache
|
||||
DataServiceVersion: 1.0;
|
||||
|
||||
|
||||
--changesetresponse_2918827d-ca4b-4da7-8ff2-5e205df53ac9
|
||||
Content-Type: application/http
|
||||
Content-Transfer-Encoding: binary
|
||||
|
||||
HTTP/1.1 204 No Content
|
||||
Content-ID: 2
|
||||
X-Content-Type-Options: nosniff
|
||||
Cache-Control: no-cache
|
||||
DataServiceVersion: 1.0;
|
||||
ETag: W/"datetime\'2017-02-16T02%3A46%3A47.89766Z\'"
|
||||
|
||||
|
||||
--changesetresponse_2918827d-ca4b-4da7-8ff2-5e205df53ac9
|
||||
Content-Type: application/http
|
||||
Content-Transfer-Encoding: binary
|
||||
|
||||
HTTP/1.1 204 No Content
|
||||
Content-ID: 3
|
||||
X-Content-Type-Options: nosniff
|
||||
Cache-Control: no-cache
|
||||
DataServiceVersion: 1.0;
|
||||
ETag: W/"datetime\'2017-02-16T02%3A46%3A47.89766Z\'"
|
||||
|
||||
|
||||
--changesetresponse_2918827d-ca4b-4da7-8ff2-5e205df53ac9
|
||||
Content-Type: application/http
|
||||
Content-Transfer-Encoding: binary
|
||||
|
||||
HTTP/1.1 204 No Content
|
||||
Content-ID: 4
|
||||
X-Content-Type-Options: nosniff
|
||||
Cache-Control: no-cache
|
||||
DataServiceVersion: 1.0;
|
||||
ETag: W/"datetime\'2017-02-16T02%3A46%3A47.89766Z\'"
|
||||
|
||||
|
||||
--changesetresponse_2918827d-ca4b-4da7-8ff2-5e205df53ac9
|
||||
Content-Type: application/http
|
||||
Content-Transfer-Encoding: binary
|
||||
|
||||
HTTP/1.1 204 No Content
|
||||
Content-ID: 5
|
||||
X-Content-Type-Options: nosniff
|
||||
Cache-Control: no-cache
|
||||
DataServiceVersion: 1.0;
|
||||
|
||||
|
||||
--changesetresponse_2918827d-ca4b-4da7-8ff2-5e205df53ac9
|
||||
Content-Type: application/http
|
||||
Content-Transfer-Encoding: binary
|
||||
|
||||
HTTP/1.1 204 No Content
|
||||
Content-ID: 6
|
||||
X-Content-Type-Options: nosniff
|
||||
Cache-Control: no-cache
|
||||
DataServiceVersion: 1.0;
|
||||
|
||||
|
||||
--changesetresponse_2918827d-ca4b-4da7-8ff2-5e205df53ac9--
|
||||
--batchresponse_e899556e-c637-4b2d-8cd1-63edb03dd6fe--';
|
||||
}
|
||||
|
||||
public static function getEntitySampleBody()
|
||||
{
|
||||
return '<?xml version="1.0" encoding="utf-8"?><entry xml:base="https://phput.table.core.windows.net/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:etag="W/"datetime\'2017-02-16T03%3A39%3A51.7780193Z\'""><id>https://phput.table.core.windows.net/getentity(PartitionKey=\'123\',RowKey=\'456\')</id><category term="phput.getentity" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="getentity" href="getentity(PartitionKey=\'123\',RowKey=\'456\')" /><title /><updated>2017-02-16T03:39:52Z</updated><author><name /></author><content type="application/xml"><m:properties><d:PartitionKey>123</d:PartitionKey><d:RowKey>456</d:RowKey><d:Timestamp m:type="Edm.DateTime">2017-02-16T03:39:51.7780193Z</d:Timestamp><d:CustomerId m:type="Edm.Int32">890</d:CustomerId><d:CustomerName>John</d:CustomerName><d:IsNew m:type="Edm.Boolean">true</d:IsNew><d:JoinDate m:type="Edm.DateTime">2012-01-26T18:26:19.000047Z</d:JoinDate></m:properties></content></entry>';
|
||||
}
|
||||
|
||||
public static function getTableSampleBody()
|
||||
{
|
||||
return '<?xml version="1.0" encoding="utf-8"?><entry xml:base="https://phput.table.core.windows.net/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><id>https://phput.table.core.windows.net/Tables(\'gettable\')</id><category term="phput.Tables" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Tables" href="Tables(\'gettable\')" /><title /><updated>2017-02-16T03:48:16Z</updated><author><name /></author><content type="application/xml"><m:properties><d:TableName>gettable</d:TableName></m:properties></content></entry>';
|
||||
}
|
||||
|
||||
public static function getInsertEntitySampleBody()
|
||||
{
|
||||
return '<?xml version="1.0" encoding="utf-8"?><entry xml:base="https://phput.table.core.windows.net/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:etag="W/"datetime\'2017-02-16T06%3A47%3A05.1541526Z\'""><id>https://phput.table.core.windows.net/insertentity(PartitionKey=\'123\',RowKey=\'456\')</id><category term="phput.insertentity" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="insertentity" href="insertentity(PartitionKey=\'123\',RowKey=\'456\')" /><title /><updated>2017-02-16T06:47:05Z</updated><author><name /></author><content type="application/xml"><m:properties><d:PartitionKey>123</d:PartitionKey><d:RowKey>456</d:RowKey><d:Timestamp m:type="Edm.DateTime">2017-02-16T06:47:05.1541526Z</d:Timestamp><d:CustomerId m:type="Edm.Int32">890</d:CustomerId><d:CustomerName>John</d:CustomerName><d:IsNew m:type="Edm.Boolean">true</d:IsNew><d:JoinDate m:type="Edm.DateTime">2012-01-26T18:26:19.000047Z</d:JoinDate></m:properties></content></entry>';
|
||||
}
|
||||
|
||||
public static function getInsertEntitySampleHeaders()
|
||||
{
|
||||
return array(
|
||||
'cache-control' => 'no-cache',
|
||||
'transfer-encoding' => 'chunked',
|
||||
'content-type' => 'application/atom+xml;type=entry;charset=utf-8',
|
||||
'etag' => 'W/"datetime\'2017-02-16T06%3A47%3A05.1541526Z\'"',
|
||||
'location' => 'https://phput.table.core.windows.net/insertentity(PartitionKey=\'123\',RowKey=\'456\')',
|
||||
'server' => 'Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0',
|
||||
'x-ms-request-id' => '28adeb0c-0002-00b6-5320-88f42b000000',
|
||||
'x-ms-version' => '2015-04-05',
|
||||
'x-content-type-options' => 'nosniff',
|
||||
'date' => 'Thu, 16 Feb 2017 06:47:04 GMT'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,8 +63,8 @@ class BlobPropertiesTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals($expected['Content-MD5'], $actual->getContentMD5());
|
||||
$this->assertEquals($expected['Cache-Control'], $actual->getCacheControl());
|
||||
$this->assertEquals(intval($expected['x-ms-blob-sequence-number']), $actual->getSequenceNumber());
|
||||
$this->assertEquals($expected['BlobType'], $actual->getBlobType());
|
||||
$this->assertEquals($expected['LeaseStatus'], $actual->getLeaseStatus());
|
||||
$this->assertEquals($expected['x-ms-blob-type'], $actual->getBlobType());
|
||||
$this->assertEquals($expected['x-ms-lease-status'], $actual->getLeaseStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,6 +40,8 @@ class BreakLeaseResultTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\BreakLeaseResult::create
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\BreakLeaseResult::setLeaseTime
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\BreakLeaseResult::getLeaseTime
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
|
@ -53,22 +55,4 @@ class BreakLeaseResultTest extends \PHPUnit_Framework_TestCase
|
|||
// Assert
|
||||
$this->assertEquals($expected, $result->getLeaseTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\BreakLeaseResult::setLeaseTime
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\BreakLeaseResult::getLeaseTime
|
||||
*/
|
||||
public function testSetLeaseTime()
|
||||
{
|
||||
// Setup
|
||||
$expected = '0x8CAFB82EFF70C46';
|
||||
$result = new BreakLeaseResult();
|
||||
$result->setLeaseTime($expected);
|
||||
|
||||
// Test
|
||||
$result->setLeaseTime($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getLeaseTime());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace MicrosoftAzure\Storage\Tests\unit\Blob\Models;
|
|||
use MicrosoftAzure\Storage\Tests\Framework\TestResources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
use MicrosoftAzure\Storage\Blob\Models\CopyBlobResult;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Resources;
|
||||
|
||||
/**
|
||||
* Unit tests for class SnapshotBlobResult
|
||||
|
@ -43,32 +44,29 @@ class CopyBlobResultTest extends \PHPUnit_Framework_TestCase
|
|||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CopyBlobResult::getETag
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CopyBlobResult::setETag
|
||||
*/
|
||||
public function testSetETag()
|
||||
{
|
||||
$createBlobSnapshotResult = new CopyBlobResult();
|
||||
$expected = "12345678";
|
||||
$createBlobSnapshotResult->setETag($expected);
|
||||
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
$createBlobSnapshotResult->getETag()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CopyBlobResult::getLastModified
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CopyBlobResult::setLastModified
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CopyBlobResult::create
|
||||
*/
|
||||
public function testSetLastModified()
|
||||
public function testCreate()
|
||||
{
|
||||
$createBlobSnapshotResult = new CopyBlobResult();
|
||||
$expected = new \DateTime("2008-8-8");
|
||||
$createBlobSnapshotResult->setLastModified($expected);
|
||||
$expectedEtag = "12345678";
|
||||
$expectedLastModified = 'Fri, 16 Oct 2009 21:04:30 GMT';
|
||||
$headers = [
|
||||
Resources::ETAG => $expectedEtag,
|
||||
Resources::LAST_MODIFIED => $expectedLastModified
|
||||
];
|
||||
|
||||
$result = CopyBlobResult::create($headers);
|
||||
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
$createBlobSnapshotResult->getLastModified()
|
||||
$expectedEtag,
|
||||
$result->getETag()
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
Utilities::rfc1123ToDateTime($expectedLastModified),
|
||||
$result->getLastModified()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,14 @@ class CreateBlobPagesResultTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesResult::create
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesResult::setLastModified
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesResult::getLastModified
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesResult::setETag
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesResult::getETag
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesResult::setContentMD5
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesResult::getContentMD5
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesResult::setSequenceNumber
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesResult::getSequenceNumber
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
|
@ -59,76 +67,4 @@ class CreateBlobPagesResultTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals($expected['Content-MD5'], $actual->getContentMD5());
|
||||
$this->assertEquals(intval($expected['x-ms-blob-sequence-number']), $actual->getSequenceNumber());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesResult::setLastModified
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesResult::getLastModified
|
||||
*/
|
||||
public function testSetLastModified()
|
||||
{
|
||||
// Setup
|
||||
$expected = Utilities::rfc1123ToDateTime('Sun, 25 Sep 2011 19:42:18 GMT');
|
||||
$options = new CreateBlobPagesResult();
|
||||
$options->setLastModified($expected);
|
||||
|
||||
// Test
|
||||
$options->setLastModified($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $options->getLastModified());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesResult::setETag
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesResult::getETag
|
||||
*/
|
||||
public function testSetETag()
|
||||
{
|
||||
// Setup
|
||||
$expected = '0x8CAFB82EFF70C46';
|
||||
$options = new CreateBlobPagesResult();
|
||||
$options->setETag($expected);
|
||||
|
||||
// Test
|
||||
$options->setETag($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $options->getETag());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesResult::setContentMD5
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesResult::getContentMD5
|
||||
*/
|
||||
public function testSetContentMD5()
|
||||
{
|
||||
// Setup
|
||||
$expected = '0x8CAFB82EFF70C46';
|
||||
$options = new CreateBlobPagesResult();
|
||||
$options->setContentMD5($expected);
|
||||
|
||||
// Test
|
||||
$options->setContentMD5($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $options->getContentMD5());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesResult::setSequenceNumber
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesResult::getSequenceNumber
|
||||
*/
|
||||
public function testSetSequenceNumber()
|
||||
{
|
||||
// Setup
|
||||
$expected = 123;
|
||||
$options = new CreateBlobPagesResult();
|
||||
$options->setSequenceNumber($expected);
|
||||
|
||||
// Test
|
||||
$options->setSequenceNumber($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $options->getSequenceNumber());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ namespace MicrosoftAzure\Storage\Tests\unit\Blob\Models;
|
|||
use MicrosoftAzure\Storage\Tests\Framework\TestResources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
use MicrosoftAzure\Storage\Blob\Models\CreateBlobSnapshotResult;
|
||||
use MicrosoftAzure\Storage\Blob\Models\AccessCondition;
|
||||
|
||||
/**
|
||||
* Unit tests for class SnapshotBlobResult
|
||||
|
@ -44,48 +43,26 @@ class CreateBlobSnapshotResultTest extends \PHPUnit_Framework_TestCase
|
|||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobSnapshotResult::getSnapshot
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobSnapshotResult::setSnapshot
|
||||
*/
|
||||
public function testSetSnapshot()
|
||||
{
|
||||
$createBlobSnapshotResult = new CreateBlobSnapshotResult();
|
||||
$expected = new \DateTime("2008-8-8");
|
||||
$createBlobSnapshotResult->setSnapshot($expected);
|
||||
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
$createBlobSnapshotResult->getSnapshot()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobSnapshotResult::getETag
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobSnapshotResult::setETag
|
||||
*/
|
||||
public function testSetETag()
|
||||
{
|
||||
$createBlobSnapshotResult = new CreateBlobSnapshotResult();
|
||||
$expected = "12345678";
|
||||
$createBlobSnapshotResult->setETag($expected);
|
||||
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
$createBlobSnapshotResult->getETag()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobSnapshotResult::getLastModified
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobSnapshotResult::setLastModified
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobSnapshotResult::create
|
||||
*/
|
||||
public function testSetLastModified()
|
||||
public function testCreate()
|
||||
{
|
||||
$createBlobSnapshotResult = new CreateBlobSnapshotResult();
|
||||
$expected = new \DateTime("2008-8-8");
|
||||
$createBlobSnapshotResult->setLastModified($expected);
|
||||
// Setup
|
||||
$sample = TestResources::listBlobsOneEntry();
|
||||
$expected = $sample['Blobs']['Blob']['Properties'];
|
||||
$expected['x-ms-snapshot'] = $sample['Blobs']['Blob']['Snapshot'];
|
||||
$expectedDate = Utilities::rfc1123ToDateTime($expected['Last-Modified']);
|
||||
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
$createBlobSnapshotResult->getLastModified()
|
||||
);
|
||||
// Test
|
||||
$actual = CreateBlobSnapshotResult::create($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expectedDate, $actual->getLastModified());
|
||||
$this->assertEquals($expected['Etag'], $actual->getETag());
|
||||
$this->assertEquals($expected['x-ms-snapshot'], $actual->getSnapshot());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
namespace MicrosoftAzure\Storage\Tests\unit\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
use MicrosoftAzure\Storage\Tests\Framework\TestResources;
|
||||
use MicrosoftAzure\Storage\Blob\Models\GetBlobMetadataResult;
|
||||
|
||||
/**
|
||||
|
@ -41,102 +42,27 @@ class GetBlobMetadataResultTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobMetadataResult::getETag
|
||||
*/
|
||||
public function testGetETag()
|
||||
{
|
||||
// Setup
|
||||
$getBlobMetadataResult = new GetBlobMetadataResult();
|
||||
$expected = '0x8CACB9BD7C6B1B2';
|
||||
$getBlobMetadataResult->setETag($expected);
|
||||
|
||||
// Test
|
||||
$actual = $getBlobMetadataResult->getETag();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobMetadataResult::setETag
|
||||
*/
|
||||
public function testSetETag()
|
||||
{
|
||||
// Setup
|
||||
$getBlobMetadataResult = new GetBlobMetadataResult();
|
||||
$expected = '0x8CACB9BD7C6B1B2';
|
||||
|
||||
// Test
|
||||
$getBlobMetadataResult->setETag($expected);
|
||||
|
||||
// Assert
|
||||
$actual = $getBlobMetadataResult->getETag();
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobMetadataResult::getLastModified
|
||||
*/
|
||||
public function testGetLastModified()
|
||||
{
|
||||
// Setup
|
||||
$getBlobMetadataResult = new GetBlobMetadataResult();
|
||||
$expected = Utilities::rfc1123ToDateTime('Fri, 09 Oct 2009 21:04:30 GMT');
|
||||
$getBlobMetadataResult->setLastModified($expected);
|
||||
|
||||
// Test
|
||||
$actual = $getBlobMetadataResult->getLastModified();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobMetadataResult::setLastModified
|
||||
*/
|
||||
public function testSetLastModified()
|
||||
{
|
||||
// Setup
|
||||
$getBlobMetadataResult = new GetBlobMetadataResult();
|
||||
$expected = Utilities::rfc1123ToDateTime('Fri, 09 Oct 2009 21:04:30 GMT');
|
||||
|
||||
// Test
|
||||
$getBlobMetadataResult->setLastModified($expected);
|
||||
|
||||
// Assert
|
||||
$actual = $getBlobMetadataResult->getLastModified();
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobMetadataResult::setMetadata
|
||||
*/
|
||||
public function testSetMetadata()
|
||||
{
|
||||
// Setup
|
||||
$container = new GetBlobMetadataResult();
|
||||
$expected = array('key1' => 'value1', 'key2' => 'value2');
|
||||
|
||||
// Test
|
||||
$container->setMetadata($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $container->getMetadata());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobMetadataResult::getMetadata
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobMetadataResult::create
|
||||
*/
|
||||
public function testGetMetadata()
|
||||
public function testCreate()
|
||||
{
|
||||
// Setup
|
||||
$container = new GetBlobMetadataResult();
|
||||
$expected = array('key1' => 'value1', 'key2' => 'value2');
|
||||
$container->setMetadata($expected);
|
||||
$sample = TestResources::listBlobsOneEntry();
|
||||
$expectedProperties = $sample['Blobs']['Blob']['Properties'];
|
||||
$expectedDate = Utilities::rfc1123ToDateTime($expectedProperties['Last-Modified']);
|
||||
$expectedMetadata = $sample['Blobs']['Blob']['Metadata'];
|
||||
|
||||
// Test
|
||||
$actual = $container->getMetadata();
|
||||
$actual = GetBlobMetadataResult::create($expectedProperties, $expectedMetadata);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
$this->assertEquals($expectedDate, $actual->getLastModified());
|
||||
$this->assertEquals($expectedProperties['Etag'], $actual->getETag());
|
||||
$this->assertEquals($expectedMetadata, $actual->getMetadata());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
namespace MicrosoftAzure\Storage\Tests\unit\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Models\GetBlobPropertiesResult;
|
||||
use MicrosoftAzure\Storage\Tests\Framework\TestResources;
|
||||
use MicrosoftAzure\Storage\Blob\Models\BlobProperties;
|
||||
|
||||
/**
|
||||
|
@ -41,67 +42,24 @@ class GetBlobPropertiesResultTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobPropertiesResult::setMetadata
|
||||
*/
|
||||
public function testSetMetadata()
|
||||
{
|
||||
// Setup
|
||||
$properties = new GetBlobPropertiesResult();
|
||||
$expected = array('key1' => 'value1', 'key2' => 'value2');
|
||||
|
||||
// Test
|
||||
$properties->setMetadata($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $properties->getMetadata());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobPropertiesResult::getMetadata
|
||||
*/
|
||||
public function testGetMetadata()
|
||||
{
|
||||
// Setup
|
||||
$properties = new GetBlobPropertiesResult();
|
||||
$expected = array('key1' => 'value1', 'key2' => 'value2');
|
||||
$properties->setMetadata($expected);
|
||||
|
||||
// Test
|
||||
$actual = $properties->getMetadata();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobPropertiesResult::setProperties
|
||||
*/
|
||||
public function testSetProperties()
|
||||
{
|
||||
// Setup
|
||||
$properties = new GetBlobPropertiesResult();
|
||||
$expected = new BlobProperties();
|
||||
|
||||
// Test
|
||||
$properties->setProperties($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $properties->getProperties());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobPropertiesResult::getProperties
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobPropertiesResult::create
|
||||
*/
|
||||
public function testGetProperties()
|
||||
public function testCreate()
|
||||
{
|
||||
// Setup
|
||||
$properties = new GetBlobPropertiesResult();
|
||||
$expected = new BlobProperties();
|
||||
$properties->setProperties($expected);
|
||||
$sample = TestResources::listBlobsOneEntry();
|
||||
$expected = $sample['Blobs']['Blob']['Properties'];
|
||||
$expectedProperties = BlobProperties::create($expected);
|
||||
$expected['x-ms-meta-'] = $sample['Blobs']['Blob']['Metadata'];
|
||||
|
||||
// Test
|
||||
$actual = $properties->getProperties();
|
||||
$actual = GetBlobPropertiesResult::create($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
$this->assertEquals($expectedProperties, $actual->getProperties());
|
||||
$this->assertEquals(array('' => $expected['x-ms-meta-']), $actual->getMetadata());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ namespace MicrosoftAzure\Storage\Tests\unit\Blob\Models;
|
|||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
use MicrosoftAzure\Storage\Blob\Models\GetBlobResult;
|
||||
use MicrosoftAzure\Storage\Blob\Models\BlobProperties;
|
||||
use MicrosoftAzure\Storage\Tests\Framework\TestResources;
|
||||
use GuzzleHttp\Psr7;
|
||||
|
||||
/**
|
||||
* Unit tests for class GetBlobResult
|
||||
|
@ -40,86 +42,36 @@ use MicrosoftAzure\Storage\Blob\Models\BlobProperties;
|
|||
*/
|
||||
class GetBlobResultTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobResult::setMetadata
|
||||
*/
|
||||
public function testSetMetadata()
|
||||
{
|
||||
// Setup
|
||||
$properties = new GetBlobResult();
|
||||
$expected = array('key1' => 'value1', 'key2' => 'value2');
|
||||
|
||||
// Test
|
||||
$properties->setMetadata($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $properties->getMetadata());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobResult::getMetadata
|
||||
*/
|
||||
public function testGetMetadata()
|
||||
{
|
||||
// Setup
|
||||
$properties = new GetBlobResult();
|
||||
$expected = array('key1' => 'value1', 'key2' => 'value2');
|
||||
$properties->setMetadata($expected);
|
||||
|
||||
// Test
|
||||
$actual = $properties->getMetadata();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobResult::setProperties
|
||||
*/
|
||||
public function testSetProperties()
|
||||
{
|
||||
// Setup
|
||||
$properties = new GetBlobResult();
|
||||
$expected = new BlobProperties();
|
||||
|
||||
// Test
|
||||
$properties->setProperties($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $properties->getProperties());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobResult::getProperties
|
||||
*/
|
||||
public function testGetProperties()
|
||||
{
|
||||
// Setup
|
||||
$properties = new GetBlobResult();
|
||||
$expected = new BlobProperties();
|
||||
$properties->setProperties($expected);
|
||||
|
||||
// Test
|
||||
$actual = $properties->getProperties();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobResult::setContentStream
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobResult::getContentStream
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobResult::create
|
||||
*/
|
||||
public function testSetContentStream()
|
||||
public function testCreate()
|
||||
{
|
||||
// Setup
|
||||
$expected = Utilities::stringToStream('0x8CAFB82EFF70C46');
|
||||
$result = new GetBlobResult();
|
||||
$sample = TestResources::listBlobsOneEntry();
|
||||
$expected = $sample['Blobs']['Blob']['Properties'];
|
||||
$expectedProperties = BlobProperties::create($expected);
|
||||
$expectedMetadata = $sample['Blobs']['Blob']['Metadata'];
|
||||
$expectedBody = 'test data';
|
||||
|
||||
// Test
|
||||
$result->setContentStream($expected);
|
||||
$actual = GetBlobResult::create(
|
||||
$expected,
|
||||
Psr7\stream_for($expectedBody),
|
||||
$expectedMetadata
|
||||
);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getContentStream());
|
||||
$this->assertEquals($expectedProperties, $actual->getProperties());
|
||||
$this->assertEquals($expectedMetadata, $actual->getMetadata());
|
||||
$actualContent = stream_get_contents($actual->getContentStream());
|
||||
$this->assertEquals($expectedBody, $actualContent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,14 +23,14 @@
|
|||
*/
|
||||
namespace MicrosoftAzure\Storage\Tests\unit\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Models\GetContainerAclResult;
|
||||
use MicrosoftAzure\Storage\Blob\Models\ContainerAcl;
|
||||
use MicrosoftAzure\Storage\Blob\Models\GetContainerACLResult;
|
||||
use MicrosoftAzure\Storage\Blob\Models\ContainerACL;
|
||||
use MicrosoftAzure\Storage\Tests\Framework\TestResources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
|
||||
/**
|
||||
* Unit tests for class GetContainerAclResult
|
||||
* Unit tests for class GetContainerACLResult
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Tests\Unit\Blob\Models
|
||||
|
@ -43,7 +43,13 @@ use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
|||
class GetContainerACLResultTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerAclResult::create
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerACLResult::create
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerACLResult::getContainerAcl
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerACLResult::setContainerAcl
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerACLResult::setLastModified
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerACLResult::getLastModified
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerACLResult::setETag
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerACLResult::getETag
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
|
@ -52,9 +58,10 @@ class GetContainerACLResultTest extends \PHPUnit_Framework_TestCase
|
|||
$expectedETag = '0x8CAFB82EFF70C46';
|
||||
$expectedDate = new \DateTime('Sun, 25 Sep 2011 19:42:18 GMT');
|
||||
$expectedPublicAccess = 'container';
|
||||
$expectedContainerACL = ContainerACL::create($expectedPublicAccess, $sample);
|
||||
|
||||
// Test
|
||||
$result = GetContainerAclResult::create(
|
||||
$result = GetContainerACLResult::create(
|
||||
$expectedPublicAccess,
|
||||
$expectedETag,
|
||||
$expectedDate,
|
||||
|
@ -62,77 +69,8 @@ class GetContainerACLResultTest extends \PHPUnit_Framework_TestCase
|
|||
);
|
||||
|
||||
// Assert
|
||||
$obj = $result->getContainerAcl();
|
||||
$this->assertEquals($expectedPublicAccess, $obj->getPublicAccess());
|
||||
$this->assertCount(0, $obj->getSignedIdentifiers());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerAclResult::getContainerAcl
|
||||
*/
|
||||
public function testGetContainerAcl()
|
||||
{
|
||||
// Setup
|
||||
$expected = new ContainerAcl();
|
||||
$obj = new GetContainerAclResult();
|
||||
|
||||
// Test
|
||||
$obj->setContainerAcl($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertCount(0, $obj->getContainerAcl()->getSignedIdentifiers());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerAclResult::setContainerAcl
|
||||
*/
|
||||
public function testSetContainerAcl()
|
||||
{
|
||||
// Setup
|
||||
$expected = new ContainerAcl();
|
||||
$obj = new GetContainerAclResult();
|
||||
$obj->setContainerAcl($expected);
|
||||
|
||||
// Test
|
||||
$actual = $obj->getContainerAcl();
|
||||
|
||||
// Assert
|
||||
$this->assertCount(0, $actual->getSignedIdentifiers());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerAclResult::setLastModified
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerAclResult::getLastModified
|
||||
*/
|
||||
public function testSetLastModified()
|
||||
{
|
||||
// Setup
|
||||
$expected = new \DateTime('Sun, 25 Sep 2011 19:42:18 GMT');
|
||||
$obj = new GetContainerAclResult();
|
||||
$obj->setLastModified($expected);
|
||||
|
||||
// Test
|
||||
$obj->setLastModified($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $obj->getLastModified());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerAclResult::setETag
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerAclResult::getETag
|
||||
*/
|
||||
public function testSetETag()
|
||||
{
|
||||
// Setup
|
||||
$expected = '0x8CAFB82EFF70C46';
|
||||
$obj = new GetContainerAclResult();
|
||||
$obj->setETag($expected);
|
||||
|
||||
// Test
|
||||
$obj->setETag($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $obj->getETag());
|
||||
$this->assertEquals($expectedContainerACL, $result->getContainerAcl());
|
||||
$this->assertEquals($expectedDate, $result->getLastModified());
|
||||
$this->assertEquals($expectedETag, $result->getETag());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
namespace MicrosoftAzure\Storage\Tests\unit\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Models\GetContainerPropertiesResult;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
use MicrosoftAzure\Storage\Tests\Framework\TestResources;
|
||||
|
||||
/**
|
||||
* Unit tests for class GetContainerPropertiesResult
|
||||
|
@ -40,103 +42,28 @@ use MicrosoftAzure\Storage\Blob\Models\GetContainerPropertiesResult;
|
|||
class GetContainerPropertiesResultTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerPropertiesResult::getETag
|
||||
*/
|
||||
public function testGetETag()
|
||||
{
|
||||
// Setup
|
||||
$properties = new GetContainerPropertiesResult();
|
||||
$expected = '0x8CACB9BD7C6B1B2';
|
||||
$properties->setETag($expected);
|
||||
|
||||
// Test
|
||||
$actual = $properties->getETag();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerPropertiesResult::setETag
|
||||
*/
|
||||
public function testSetETag()
|
||||
{
|
||||
// Setup
|
||||
$properties = new GetContainerPropertiesResult();
|
||||
$expected = '0x8CACB9BD7C6B1B2';
|
||||
|
||||
// Test
|
||||
$properties->setETag($expected);
|
||||
|
||||
// Assert
|
||||
$actual = $properties->getETag();
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerPropertiesResult::getLastModified
|
||||
*/
|
||||
public function testGetLastModified()
|
||||
{
|
||||
// Setup
|
||||
$properties = new GetContainerPropertiesResult();
|
||||
$expected = new \DateTime('Fri, 09 Oct 2009 21:04:30 GMT');
|
||||
$properties->setLastModified($expected);
|
||||
|
||||
// Test
|
||||
$actual = $properties->getLastModified();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerPropertiesResult::create
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerPropertiesResult::setLastModified
|
||||
*/
|
||||
public function testSetLastModified()
|
||||
{
|
||||
// Setup
|
||||
$properties = new GetContainerPropertiesResult();
|
||||
$expected = new \DateTime('Fri, 09 Oct 2009 21:04:30 GMT');
|
||||
|
||||
// Test
|
||||
$properties->setLastModified($expected);
|
||||
|
||||
// Assert
|
||||
$actual = $properties->getLastModified();
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerPropertiesResult::getLastModified
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerPropertiesResult::setETag
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerPropertiesResult::getETag
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerPropertiesResult::setMetadata
|
||||
*/
|
||||
public function testSetMetadata()
|
||||
{
|
||||
// Setup
|
||||
$container = new GetContainerPropertiesResult();
|
||||
$expected = array('key1' => 'value1', 'key2' => 'value2');
|
||||
|
||||
// Test
|
||||
$container->setMetadata($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $container->getMetadata());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\GetContainerPropertiesResult::getMetadata
|
||||
*/
|
||||
public function testGetMetadata()
|
||||
public function testCreate()
|
||||
{
|
||||
// Setup
|
||||
$container = new GetContainerPropertiesResult();
|
||||
$expected = array('key1' => 'value1', 'key2' => 'value2');
|
||||
$container->setMetadata($expected);
|
||||
$sample = TestResources::listBlobsOneEntry();
|
||||
$expectedProperties = $sample['Blobs']['Blob']['Properties'];
|
||||
$expectedDate = Utilities::rfc1123ToDateTime($expectedProperties['Last-Modified']);
|
||||
$expectedProperties['x-ms-meta-'] = $sample['Blobs']['Blob']['Metadata'];
|
||||
|
||||
// Test
|
||||
$actual = $container->getMetadata();
|
||||
$result = GetContainerPropertiesResult::create($expectedProperties);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
$this->assertEquals(array('' => $expectedProperties['x-ms-meta-']), $result->getMetadata());
|
||||
$this->assertEquals($expectedDate, $result->getLastModified());
|
||||
$this->assertEquals($expectedProperties['Etag'], $result->getETag());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,11 +40,13 @@ class LeaseBlobResultTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\LeaseBlobResult::create
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\LeaseBlobResult::setLeaseId
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\LeaseBlobResult::getLeaseId
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
// Setup
|
||||
$expected = '10';
|
||||
$expected = '0x8CAFB82EFF70C46';
|
||||
$headers = array('x-ms-lease-id' => $expected);
|
||||
|
||||
// Test
|
||||
|
@ -53,22 +55,4 @@ class LeaseBlobResultTest extends \PHPUnit_Framework_TestCase
|
|||
// Assert
|
||||
$this->assertEquals($expected, $result->getLeaseId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\LeaseBlobResult::setLeaseId
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\LeaseBlobResult::getLeaseId
|
||||
*/
|
||||
public function testSetLeaseId()
|
||||
{
|
||||
// Setup
|
||||
$expected = '0x8CAFB82EFF70C46';
|
||||
$result = new LeaseBlobResult();
|
||||
$result->setLeaseId($expected);
|
||||
|
||||
// Test
|
||||
$result->setLeaseId($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getLeaseId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
namespace MicrosoftAzure\Storage\Tests\unit\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksResult;
|
||||
use MicrosoftAzure\Storage\Tests\Framework\TestResources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
|
||||
/**
|
||||
|
@ -42,106 +43,48 @@ class ListBlobBlocksResultTest extends \PHPUnit_Framework_TestCase
|
|||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksResult::setLastModified
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksResult::getLastModified
|
||||
*/
|
||||
public function testSetLastModified()
|
||||
{
|
||||
// Setup
|
||||
$expected = Utilities::rfc1123ToDateTime('Sun, 25 Sep 2011 19:42:18 GMT');
|
||||
$result = new ListBlobBlocksResult();
|
||||
$result->setLastModified($expected);
|
||||
|
||||
// Test
|
||||
$result->setLastModified($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getLastModified());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksResult::setETag
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksResult::getETag
|
||||
*/
|
||||
public function testSetETag()
|
||||
{
|
||||
// Setup
|
||||
$expected = '0x8CAFB82EFF70C46';
|
||||
$result = new ListBlobBlocksResult();
|
||||
$result->setETag($expected);
|
||||
|
||||
// Test
|
||||
$result->setETag($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getETag());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksResult::setContentType
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksResult::getContentType
|
||||
*/
|
||||
public function testSetContentType()
|
||||
{
|
||||
// Setup
|
||||
$expected = '0x8CAFB82EFF70C46';
|
||||
$result = new ListBlobBlocksResult();
|
||||
$result->setContentType($expected);
|
||||
|
||||
// Test
|
||||
$result->setContentType($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getContentType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksResult::setContentLength
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksResult::getContentLength
|
||||
*/
|
||||
public function testSetContentLength()
|
||||
{
|
||||
// Setup
|
||||
$expected = 100;
|
||||
$result = new ListBlobBlocksResult();
|
||||
$result->setContentLength($expected);
|
||||
|
||||
// Test
|
||||
$result->setContentLength($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getContentLength());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksResult::setUncommittedBlocks
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksResult::getUncommittedBlocks
|
||||
*/
|
||||
public function testSetUncommittedBlocks()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListBlobBlocksResult();
|
||||
$expected = array('Block1' => 10, 'Block2' => 20, 'Block3' => 30);
|
||||
|
||||
// Test
|
||||
$result->setUncommittedBlocks($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getUncommittedBlocks());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksResult::setCommittedBlocks
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksResult::getCommittedBlocks
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksResult::create
|
||||
*/
|
||||
public function testSetCommittedBlocks()
|
||||
public function testCreate()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListBlobBlocksResult();
|
||||
$expected = array('Block1' => 10, 'Block2' => 20, 'Block3' => 30);
|
||||
$sampleHeaders = TestResources::listBlocksMultipleEntriesHeaders();
|
||||
$sampleBody = TestResources::listBlocksMultipleEntriesBody();
|
||||
$expectedDate = Utilities::rfc1123ToDateTime($sampleHeaders['Last-Modified']);
|
||||
$getEntry = self::getMethod('_getEntries');
|
||||
$uncommittedBlocks = $getEntry->invokeArgs(null, array($sampleBody, 'UncommittedBlocks'));
|
||||
$committedBlocks = $getEntry->invokeArgs(null, array($sampleBody, 'CommittedBlocks'));
|
||||
|
||||
// Test
|
||||
$result->setCommittedBlocks($expected);
|
||||
$actual = ListBlobBlocksResult::create(
|
||||
$sampleHeaders,
|
||||
$sampleBody
|
||||
);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getCommittedBlocks());
|
||||
$this->assertEquals($expectedDate, $actual->getLastModified());
|
||||
$this->assertEquals($sampleHeaders['Etag'], $actual->getETag());
|
||||
$this->assertEquals($sampleHeaders['Content-Type'], $actual->getContentType());
|
||||
$this->assertEquals($sampleHeaders['x-ms-blob-content-length'], $actual->getContentLength());
|
||||
$this->assertEquals($uncommittedBlocks, $actual->getUncommittedBlocks());
|
||||
$this->assertEquals($committedBlocks, $actual->getCommittedBlocks());
|
||||
}
|
||||
|
||||
protected static function getMethod($name)
|
||||
{
|
||||
$class = new \ReflectionClass(new ListBlobBlocksResult());
|
||||
$method = $class->getMethod($name);
|
||||
$method->setAccessible(true);
|
||||
return $method;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,12 @@ class ListBlobsResultTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::create
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getBlobPrefixes
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setBlobPrefixes
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getBlobs
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setBlobs
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setMaxResults
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getMaxResults
|
||||
*/
|
||||
public function testCreateWithEmpty()
|
||||
{
|
||||
|
@ -58,6 +64,22 @@ class ListBlobsResultTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::create
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getBlobPrefixes
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setBlobPrefixes
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getBlobs
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setBlobs
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setPrefix
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getPrefix
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setNextMarker
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getNextMarker
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setMarker
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getMarker
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setMaxResults
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getMaxResults
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setContainerName
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getContainerName
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setDelimiter
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getDelimiter
|
||||
*/
|
||||
public function testCreateWithOneEntry()
|
||||
{
|
||||
|
@ -69,6 +91,7 @@ class ListBlobsResultTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
// Assert
|
||||
$this->assertCount(1, $actual->getBlobs());
|
||||
$this->assertEquals($sample['@attributes']['ContainerName'], $actual->getContainerName());
|
||||
$this->assertCount(1, $actual->getBlobPrefixes());
|
||||
$this->assertEquals($sample['Marker'], $actual->getMarker());
|
||||
$this->assertEquals(intval($sample['MaxResults']), $actual->getMaxResults());
|
||||
|
@ -79,6 +102,18 @@ class ListBlobsResultTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::create
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getBlobPrefixes
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setBlobPrefixes
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getBlobs
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setBlobs
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setNextMarker
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getNextMarker
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setMarker
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getMarker
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setMaxResults
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getMaxResults
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setContainerName
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getContainerName
|
||||
*/
|
||||
public function testCreateWithMultipleEntries()
|
||||
{
|
||||
|
@ -91,272 +126,11 @@ class ListBlobsResultTest extends \PHPUnit_Framework_TestCase
|
|||
// Assert
|
||||
$this->assertCount(2, $actual->getBlobs());
|
||||
$this->assertCount(2, $actual->getBlobPrefixes());
|
||||
$this->assertEquals($sample['@attributes']['ContainerName'], $actual->getContainerName());
|
||||
$this->assertEquals($sample['Marker'], $actual->getMarker());
|
||||
$this->assertEquals(intval($sample['MaxResults']), $actual->getMaxResults());
|
||||
$this->assertEquals($sample['NextMarker'], $actual->getNextMarker());
|
||||
|
||||
return $actual;
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getBlobPrefixes
|
||||
* @depends testCreateWithMultipleEntries
|
||||
*/
|
||||
public function testGetBlobPrefixs($result)
|
||||
{
|
||||
// Test
|
||||
$actual = $result->getBlobPrefixes();
|
||||
|
||||
// Assert
|
||||
$this->assertCount(2, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setBlobPrefixes
|
||||
* @depends testCreateWithMultipleEntries
|
||||
*/
|
||||
public function testSetBlobPrefixs($result)
|
||||
{
|
||||
// Setup
|
||||
$sample = new ListBlobsResult();
|
||||
$expected = $result->getBlobPrefixes();
|
||||
|
||||
// Test
|
||||
$sample->setBlobPrefixes($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $sample->getBlobPrefixes());
|
||||
$expected[0]->setName('test');
|
||||
$this->assertNotEquals($expected, $sample->getBlobPrefixes());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getBlobs
|
||||
* @depends testCreateWithMultipleEntries
|
||||
*/
|
||||
public function testGetBlobs($result)
|
||||
{
|
||||
// Test
|
||||
$actual = $result->getBlobs();
|
||||
|
||||
// Assert
|
||||
$this->assertCount(2, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setBlobs
|
||||
* @depends testCreateWithMultipleEntries
|
||||
*/
|
||||
public function testSetBlobs($result)
|
||||
{
|
||||
// Setup
|
||||
$sample = new ListBlobsResult();
|
||||
$expected = $result->getBlobs();
|
||||
|
||||
// Test
|
||||
$sample->setBlobs($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $sample->getBlobs());
|
||||
$expected[0]->setName('test');
|
||||
$this->assertNotEquals($expected, $sample->getBlobs());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setPrefix
|
||||
*/
|
||||
public function testSetPrefix()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListBlobsResult();
|
||||
$expected = 'myprefix';
|
||||
|
||||
// Test
|
||||
$result->setPrefix($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getPrefix());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getPrefix
|
||||
*/
|
||||
public function testGetPrefix()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListBlobsResult();
|
||||
$expected = 'myprefix';
|
||||
$result->setPrefix($expected);
|
||||
|
||||
// Test
|
||||
$actual = $result->getPrefix();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setNextMarker
|
||||
*/
|
||||
public function testSetNextMarker()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListBlobsResult();
|
||||
$expected = 'mymarker';
|
||||
|
||||
// Test
|
||||
$result->setNextMarker($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getNextMarker());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getNextMarker
|
||||
*/
|
||||
public function testGetNextMarker()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListBlobsResult();
|
||||
$expected = 'mymarker';
|
||||
$result->setNextMarker($expected);
|
||||
|
||||
// Test
|
||||
$actual = $result->getNextMarker();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setMarker
|
||||
*/
|
||||
public function testSetMarker()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListBlobsResult();
|
||||
$expected = 'mymarker';
|
||||
|
||||
// Test
|
||||
$result->setMarker($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getMarker());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getMarker
|
||||
*/
|
||||
public function testGetMarker()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListBlobsResult();
|
||||
$expected = 'mymarker';
|
||||
$result->setMarker($expected);
|
||||
|
||||
// Test
|
||||
$actual = $result->getMarker();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setMaxResults
|
||||
*/
|
||||
public function testSetMaxResults()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListBlobsResult();
|
||||
$expected = 3;
|
||||
|
||||
// Test
|
||||
$result->setMaxResults($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getMaxResults());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getMaxResults
|
||||
*/
|
||||
public function testGetMaxResults()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListBlobsResult();
|
||||
$expected = 3;
|
||||
$result->setMaxResults($expected);
|
||||
|
||||
// Test
|
||||
$actual = $result->getMaxResults();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setContainerName
|
||||
*/
|
||||
public function testSetContainerName()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListBlobsResult();
|
||||
$expected = 'name';
|
||||
|
||||
// Test
|
||||
$result->setContainerName($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getContainerName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getContainerName
|
||||
*/
|
||||
public function testGetContainerName()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListBlobsResult();
|
||||
$expected = 'name';
|
||||
$result->setContainerName($expected);
|
||||
|
||||
// Test
|
||||
$actual = $result->getContainerName();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::setDelimiter
|
||||
*/
|
||||
public function testSetDelimiter()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListBlobsResult();
|
||||
$expected = 'mydelimiter';
|
||||
|
||||
// Test
|
||||
$result->setDelimiter($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getDelimiter());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListBlobsResult::getDelimiter
|
||||
*/
|
||||
public function testGetDelimiter()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListBlobsResult();
|
||||
$expected = 'mydelimiter';
|
||||
$result->setDelimiter($expected);
|
||||
|
||||
// Test
|
||||
$actual = $result->getDelimiter();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,8 @@ class ListContainersResultTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::create
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::getContainers
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::setContainers
|
||||
*/
|
||||
public function testCreateWithEmpty()
|
||||
{
|
||||
|
@ -54,11 +56,18 @@ class ListContainersResultTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
// Assert
|
||||
$this->assertCount(0, $actual->getContainers());
|
||||
$this->assertTrue(empty($sample['NextMarker']));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::create
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::getContainers
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::setContainers
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::setNextMarker
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::getNextMarker
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::setMarker
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::getMarker
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::setMaxResults
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::getMaxResults
|
||||
*/
|
||||
public function testCreateWithOneEntry()
|
||||
{
|
||||
|
@ -94,6 +103,16 @@ class ListContainersResultTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::create
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::getContainers
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::setContainers
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::setPrefix
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::getPrefix
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::setNextMarker
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::getNextMarker
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::setMaxResults
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::getMaxResults
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::setAccountName
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::getAccountName
|
||||
*/
|
||||
public function testCreateWithMultipleEntries()
|
||||
{
|
||||
|
@ -139,204 +158,9 @@ class ListContainersResultTest extends \PHPUnit_Framework_TestCase
|
|||
);
|
||||
$this->assertEquals($sample['MaxResults'], $actual->getMaxResults());
|
||||
$this->assertEquals($sample['NextMarker'], $actual->getNextMarker());
|
||||
$this->assertEquals($sample['Prefix'], $actual->getPrefix());
|
||||
$this->assertEquals($sample['account'], $actual->getAccountName());
|
||||
|
||||
return $actual;
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::getContainers
|
||||
* @depends testCreateWithMultipleEntries
|
||||
*/
|
||||
public function testGetContainers($result)
|
||||
{
|
||||
// Test
|
||||
$actual = $result->getContainers();
|
||||
|
||||
// Assert
|
||||
$this->assertCount(2, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::setContainers
|
||||
* @depends testCreateWithMultipleEntries
|
||||
*/
|
||||
public function testSetContainers($result)
|
||||
{
|
||||
// Setup
|
||||
$sample = new ListContainersResult();
|
||||
$expected = $result->getContainers();
|
||||
|
||||
// Test
|
||||
$sample->setContainers($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $sample->getContainers());
|
||||
$expected[0]->setName('test');
|
||||
$this->assertNotEquals($expected, $sample->getContainers());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::setPrefix
|
||||
*/
|
||||
public function testSetPrefix()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListContainersResult();
|
||||
$expected = 'myprefix';
|
||||
|
||||
// Test
|
||||
$result->setPrefix($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getPrefix());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::getPrefix
|
||||
*/
|
||||
public function testGetPrefix()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListContainersResult();
|
||||
$expected = 'myprefix';
|
||||
$result->setPrefix($expected);
|
||||
|
||||
// Test
|
||||
$actual = $result->getPrefix();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::setNextMarker
|
||||
*/
|
||||
public function testSetNextMarker()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListContainersResult();
|
||||
$expected = 'mymarker';
|
||||
|
||||
// Test
|
||||
$result->setNextMarker($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getNextMarker());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::getNextMarker
|
||||
*/
|
||||
public function testGetNextMarker()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListContainersResult();
|
||||
$expected = 'mymarker';
|
||||
$result->setNextMarker($expected);
|
||||
|
||||
// Test
|
||||
$actual = $result->getNextMarker();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::setMarker
|
||||
*/
|
||||
public function testSetMarker()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListContainersResult();
|
||||
$expected = 'mymarker';
|
||||
|
||||
// Test
|
||||
$result->setMarker($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getMarker());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::getMarker
|
||||
*/
|
||||
public function testGetMarker()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListContainersResult();
|
||||
$expected = 'mymarker';
|
||||
$result->setMarker($expected);
|
||||
|
||||
// Test
|
||||
$actual = $result->getMarker();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::setMaxResults
|
||||
*/
|
||||
public function testSetMaxResults()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListContainersResult();
|
||||
$expected = '3';
|
||||
|
||||
// Test
|
||||
$result->setMaxResults($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getMaxResults());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::getMaxResults
|
||||
*/
|
||||
public function testGetMaxResults()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListContainersResult();
|
||||
$expected = '3';
|
||||
$result->setMaxResults($expected);
|
||||
|
||||
// Test
|
||||
$actual = $result->getMaxResults();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::setAccountName
|
||||
*/
|
||||
public function testSetAccountName()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListContainersResult();
|
||||
$expected = 'name';
|
||||
|
||||
// Test
|
||||
$result->setAccountName($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getAccountName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListContainersResult::getAccountName
|
||||
*/
|
||||
public function testGetAccountName()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListContainersResult();
|
||||
$expected = 'name';
|
||||
$result->setAccountName($expected);
|
||||
|
||||
// Test
|
||||
$actual = $result->getAccountName();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace MicrosoftAzure\Storage\Tests\unit\Blob\Models;
|
|||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
use MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesResult;
|
||||
use MicrosoftAzure\Storage\Blob\Models\PageRange;
|
||||
use MicrosoftAzure\Storage\Tests\Framework\TestResources;
|
||||
|
||||
/**
|
||||
* Unit tests for class ListPageBlobRangesResultTest
|
||||
|
@ -40,74 +41,45 @@ use MicrosoftAzure\Storage\Blob\Models\PageRange;
|
|||
*/
|
||||
class ListPageBlobRangesResultTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesResult::setLastModified
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesResult::getLastModified
|
||||
*/
|
||||
public function testSetLastModified()
|
||||
{
|
||||
// Setup
|
||||
$expected = Utilities::rfc1123ToDateTime('Sun, 25 Sep 2011 19:42:18 GMT');
|
||||
$result = new ListPageBlobRangesResult();
|
||||
$result->setLastModified($expected);
|
||||
|
||||
// Test
|
||||
$result->setLastModified($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getLastModified());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesResult::setETag
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesResult::getETag
|
||||
*/
|
||||
public function testSetETag()
|
||||
{
|
||||
// Setup
|
||||
$expected = '0x8CAFB82EFF70C46';
|
||||
$result = new ListPageBlobRangesResult();
|
||||
$result->setETag($expected);
|
||||
|
||||
// Test
|
||||
$result->setETag($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getETag());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesResult::setContentLength
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesResult::getContentLength
|
||||
*/
|
||||
public function testSetContentLength()
|
||||
{
|
||||
// Setup
|
||||
$expected = 100;
|
||||
$result = new ListPageBlobRangesResult();
|
||||
$result->setContentLength($expected);
|
||||
|
||||
// Test
|
||||
$result->setContentLength($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getContentLength());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesResult::setPageRanges
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesResult::getPageRanges
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesResult::setContentLength
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesResult::getContentLength
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesResult::setETag
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesResult::getETag
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesResult::setLastModified
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesResult::getLastModified
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesResult::create
|
||||
*/
|
||||
public function testSetPageRanges()
|
||||
public function testCreate()
|
||||
{
|
||||
// Setup
|
||||
$expected = array(0 => new PageRange(0, 10), 1 => new PageRange(20, 40));
|
||||
$result = new ListPageBlobRangesResult();
|
||||
$headers = TestResources::listPageRangeHeaders();
|
||||
$bodyArray = TestResources::listPageRangeBodyInArray();
|
||||
// Prepare expected page range
|
||||
$rawPageRanges = array();
|
||||
if (!empty($bodyArray['PageRange'])) {
|
||||
$rawPageRanges = Utilities::getArray($bodyArray['PageRange']);
|
||||
}
|
||||
|
||||
$pageRanges = array();
|
||||
foreach ($rawPageRanges as $value) {
|
||||
$pageRanges[] = new PageRange(
|
||||
intval($value['Start']),
|
||||
intval($value['End'])
|
||||
);
|
||||
}
|
||||
// Prepare expected last modified date
|
||||
$expectedLastModified = Utilities::rfc1123ToDateTime($headers['Last-Modified']);
|
||||
|
||||
// Test
|
||||
$result->setPageRanges($expected);
|
||||
$result = ListPageBlobRangesResult::create($headers, $bodyArray);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getPageRanges());
|
||||
//Assert
|
||||
$this->assertEquals($pageRanges, $result->getPageRanges());
|
||||
$this->assertEquals($expectedLastModified, $result->getLastModified());
|
||||
$this->assertEquals($headers['Etag'], $result->getETag());
|
||||
$this->assertEquals($headers['x-ms-blob-content-length'], $result->getContentLength());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,12 @@ class PutBlobResultTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\PutBlobResult::create
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\PutBlobResult::setLastModified
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\PutBlobResult::getLastModified
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\PutBlobResult::setETag
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\PutBlobResult::getETag
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\PutBlobResult::setContentMD5
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\PutBlobResult::getContentMD5
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
|
@ -58,49 +64,4 @@ class PutBlobResultTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals($expected['Etag'], $actual->getETag());
|
||||
$this->assertEquals($expected['Content-MD5'], $actual->getContentMD5());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\PutBlobResult::setLastModified
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\PutBlobResult::getLastModified
|
||||
*/
|
||||
public function testSetLastModified()
|
||||
{
|
||||
// Setup
|
||||
$expected = Utilities::rfc1123ToDateTime('Sun, 25 Sep 2011 19:42:18 GMT');
|
||||
$result = new PutBlobResult();
|
||||
$result->setLastModified($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getLastModified());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\PutBlobResult::setETag
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\PutBlobResult::getETag
|
||||
*/
|
||||
public function testSetETag()
|
||||
{
|
||||
// Setup
|
||||
$expected = '0x8CAFB82EFF70C46';
|
||||
$result = new PutBlobResult();
|
||||
$result->setETag($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getETag());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\PutBlobResult::setContentMD5
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\PutBlobResult::getContentMD5
|
||||
*/
|
||||
public function testSetContentMD5()
|
||||
{
|
||||
// Setup
|
||||
$expected = '0x8CAFB82EFF70C46';
|
||||
$result = new PutBlobResult();
|
||||
$result->setContentMD5($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getContentMD5());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
namespace MicrosoftAzure\Storage\Tests\unit\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Tests\Framework\TestResources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
use MicrosoftAzure\Storage\Blob\Models\PutBlockResult;
|
||||
|
||||
/**
|
||||
|
@ -42,13 +41,14 @@ class PutBlockResultTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\PutBlockResult::create
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\PutBlockResult::setContentMD5
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\PutBlockResult::getContentMD5
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
// Setup
|
||||
$sample = TestResources::listBlobsOneEntry();
|
||||
$expected = $sample['Blobs']['Blob']['Properties'];
|
||||
$expectedDate = Utilities::rfc1123ToDateTime($expected['Last-Modified']);
|
||||
|
||||
// Test
|
||||
$actual = PutBlockResult::create($expected);
|
||||
|
@ -56,19 +56,4 @@ class PutBlockResultTest extends \PHPUnit_Framework_TestCase
|
|||
// Assert
|
||||
$this->assertEquals($expected['Content-MD5'], $actual->getContentMD5());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\PutBlockResult::setContentMD5
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\PutBlockResult::getContentMD5
|
||||
*/
|
||||
public function testSetContentMD5()
|
||||
{
|
||||
// Setup
|
||||
$expected = '0x8CAFB82EFF70C46';
|
||||
$result = new PutBlockResult();
|
||||
$result->setContentMD5($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getContentMD5());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace MicrosoftAzure\Storage\Tests\unit\Blob\Models;
|
|||
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
use MicrosoftAzure\Storage\Blob\Models\SetBlobMetadataResult;
|
||||
use MicrosoftAzure\Storage\Tests\Framework\TestResources;
|
||||
|
||||
/**
|
||||
* Unit tests for class SetBlobMetadataResult
|
||||
|
@ -39,71 +40,24 @@ use MicrosoftAzure\Storage\Blob\Models\SetBlobMetadataResult;
|
|||
*/
|
||||
class SetBlobMetadataResultTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\SetBlobMetadataResult::getETag
|
||||
*/
|
||||
public function testGetETag()
|
||||
{
|
||||
// Setup
|
||||
$getBlobMetadataResult = new SetBlobMetadataResult();
|
||||
$expected = '0x8CACB9BD7C6B1B2';
|
||||
$getBlobMetadataResult->setETag($expected);
|
||||
|
||||
// Test
|
||||
$actual = $getBlobMetadataResult->getETag();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\SetBlobMetadataResult::setETag
|
||||
*/
|
||||
public function testSetETag()
|
||||
{
|
||||
// Setup
|
||||
$getBlobMetadataResult = new SetBlobMetadataResult();
|
||||
$expected = '0x8CACB9BD7C6B1B2';
|
||||
|
||||
// Test
|
||||
$getBlobMetadataResult->setETag($expected);
|
||||
|
||||
// Assert
|
||||
$actual = $getBlobMetadataResult->getETag();
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\SetBlobMetadataResult::getLastModified
|
||||
*/
|
||||
public function testGetLastModified()
|
||||
{
|
||||
// Setup
|
||||
$getBlobMetadataResult = new SetBlobMetadataResult();
|
||||
$expected = Utilities::rfc1123ToDateTime('Fri, 09 Oct 2009 21:04:30 GMT');
|
||||
$getBlobMetadataResult->setLastModified($expected);
|
||||
|
||||
// Test
|
||||
$actual = $getBlobMetadataResult->getLastModified();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\SetBlobMetadataResult::setLastModified
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\SetBlobMetadataResult::getLastModified
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\SetBlobMetadataResult::setETag
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\SetBlobMetadataResult::getETag
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\SetBlobMetadataResult::create
|
||||
*/
|
||||
public function testSetLastModified()
|
||||
public function testCreate()
|
||||
{
|
||||
// Setup
|
||||
$getBlobMetadataResult = new SetBlobMetadataResult();
|
||||
$expected = Utilities::rfc1123ToDateTime('Fri, 09 Oct 2009 21:04:30 GMT');
|
||||
$sample = TestResources::ListBlobsOneEntry()['Blobs']['Blob']['Properties'];
|
||||
$expectedDate = Utilities::rfc1123ToDateTime($sample['Last-Modified']);
|
||||
|
||||
// Test
|
||||
$getBlobMetadataResult->setLastModified($expected);
|
||||
$result = SetBlobMetadataResult::create($sample);
|
||||
|
||||
// Assert
|
||||
$actual = $getBlobMetadataResult->getLastModified();
|
||||
$this->assertEquals($expected, $actual);
|
||||
$this->assertEquals($expectedDate, $result->getLastModified());
|
||||
$this->assertEquals($sample['Etag'], $result->getETag());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace MicrosoftAzure\Storage\Tests\unit\Blob\Models;
|
|||
|
||||
use MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesResult;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
use MicrosoftAzure\Storage\Tests\Framework\TestResources;
|
||||
|
||||
/**
|
||||
* Unit tests for class SetBlobPropertiesResult
|
||||
|
@ -42,54 +43,24 @@ class SetBlobPropertiesResultTest extends \PHPUnit_Framework_TestCase
|
|||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesResult::setLastModified
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesResult::getLastModified
|
||||
*/
|
||||
public function testSetLastModified()
|
||||
{
|
||||
// Setup
|
||||
$expected = Utilities::rfc1123ToDateTime('Sun, 25 Sep 2011 19:42:18 GMT');
|
||||
$prooperties = new SetBlobPropertiesResult();
|
||||
$prooperties->setLastModified($expected);
|
||||
|
||||
// Test
|
||||
$prooperties->setLastModified($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $prooperties->getLastModified());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesResult::setETag
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesResult::getETag
|
||||
*/
|
||||
public function testSetETag()
|
||||
{
|
||||
// Setup
|
||||
$expected = '0x8CAFB82EFF70C46';
|
||||
$prooperties = new SetBlobPropertiesResult();
|
||||
$prooperties->setETag($expected);
|
||||
|
||||
// Test
|
||||
$prooperties->setETag($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $prooperties->getETag());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesResult::setSequenceNumber
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesResult::getSequenceNumber
|
||||
* @covers MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesResult::create
|
||||
*/
|
||||
public function testSetSequenceNumber()
|
||||
public function testCreate()
|
||||
{
|
||||
// Setup
|
||||
$expected = 123;
|
||||
$prooperties = new SetBlobPropertiesResult();
|
||||
$prooperties->setSequenceNumber($expected);
|
||||
$sample = TestResources::ListBlobsOneEntry()['Blobs']['Blob']['Properties'];
|
||||
$expectedDate = Utilities::rfc1123ToDateTime($sample['Last-Modified']);
|
||||
|
||||
// Test
|
||||
$prooperties->setSequenceNumber($expected);
|
||||
$result = SetBlobPropertiesResult::create($sample);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $prooperties->getSequenceNumber());
|
||||
$this->assertEquals($expectedDate, $result->getLastModified());
|
||||
$this->assertEquals($sample['x-ms-blob-sequence-number'], $result->getSequenceNumber());
|
||||
$this->assertEquals($sample['Etag'], $result->getETag());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,45 +43,17 @@ class GetServicePropertiesResultTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Common\Models\GetServicePropertiesResult::create
|
||||
* @covers MicrosoftAzure\Storage\Common\Models\GetServicePropertiesResult::getValue
|
||||
* @covers MicrosoftAzure\Storage\Common\Models\GetServicePropertiesResult::setValue
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
// Test
|
||||
$result = GetServicePropertiesResult::create(TestResources::getServicePropertiesSample());
|
||||
$expected = ServiceProperties::create(TestResources::getServicePropertiesSample());
|
||||
|
||||
// Assert
|
||||
$this->assertTrue(isset($result));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Common\Models\GetServicePropertiesResult::getValue
|
||||
*/
|
||||
public function testGetValue()
|
||||
{
|
||||
// Setup
|
||||
$result = GetServicePropertiesResult::create(TestResources::getServicePropertiesSample());
|
||||
$expected = ServiceProperties::create(TestResources::getServicePropertiesSample());
|
||||
|
||||
// Test
|
||||
$actual = $result->getValue();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Common\Models\GetServicePropertiesResult::setValue
|
||||
*/
|
||||
public function testSetValue()
|
||||
{
|
||||
// Setup
|
||||
$result = new GetServicePropertiesResult();
|
||||
$expected = ServiceProperties::create(TestResources::getServicePropertiesSample());
|
||||
|
||||
// Test
|
||||
$result->setValue($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getValue());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,10 @@ class GetQueueMetadataResultTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\GetQueueMetadataResult::__construct
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\GetQueueMetadataResult::getApproximateMessageCount
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\GetQueueMetadataResult::setApproximateMessageCount
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\GetQueueMetadataResult::getMetadata
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\GetQueueMetadataResult::setMetadata
|
||||
*/
|
||||
public function testConstruct()
|
||||
{
|
||||
|
@ -55,68 +59,4 @@ class GetQueueMetadataResultTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals($count, $actual->getApproximateMessageCount());
|
||||
$this->assertEquals($metadata, $actual->getMetadata());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\GetQueueMetadataResult::getApproximateMessageCount
|
||||
*/
|
||||
public function testGetApproximateMessageCount()
|
||||
{
|
||||
// Setup
|
||||
$expected = 10;
|
||||
$metadata = new GetQueueMetadataResult($expected, array());
|
||||
|
||||
// Test
|
||||
$actual = $metadata->getApproximateMessageCount();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\GetQueueMetadataResult::setApproximateMessageCount
|
||||
*/
|
||||
public function testSetApproximateMessageCount()
|
||||
{
|
||||
// Setup
|
||||
$expected = 10;
|
||||
$metadata = new GetQueueMetadataResult(30, array());
|
||||
|
||||
// Test
|
||||
$metadata->setApproximateMessageCount($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $metadata->getApproximateMessageCount());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\GetQueueMetadataResult::getMetadata
|
||||
*/
|
||||
public function testGetMetadata()
|
||||
{
|
||||
// Setup
|
||||
$expected = array('key1' => 'value1', 'key2' => 'value2');
|
||||
$metadata = new GetQueueMetadataResult(0, $expected);
|
||||
|
||||
// Test
|
||||
$actual = $metadata->getMetadata();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\GetQueueMetadataResult::setMetadata
|
||||
*/
|
||||
public function testSetMetadata()
|
||||
{
|
||||
// Setup
|
||||
$expected = array('key1' => 'value1', 'key2' => 'value2');
|
||||
$metadata = new GetQueueMetadataResult(0, $expected);
|
||||
|
||||
// Test
|
||||
$metadata->setMetadata($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $metadata->getMetadata());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,8 @@ class ListMessagesResultTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListMessagesResult::create
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListMessagesResult::setQueueMessages
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListMessagesResult::getQueueMessages
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
|
@ -67,6 +69,8 @@ class ListMessagesResultTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListMessagesResult::create
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListMessagesResult::getQueueMessages
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListMessagesResult::setQueueMessages
|
||||
*/
|
||||
public function testCreateMultiple()
|
||||
{
|
||||
|
@ -95,41 +99,4 @@ class ListMessagesResultTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals(intval($sample['QueueMessage'][1]['DequeueCount']), $actual[1]->getDequeueCount());
|
||||
$this->assertEquals($sample['QueueMessage'][1]['MessageText'], $actual[1]->getMessageText());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListMessagesResult::getQueueMessages
|
||||
*/
|
||||
public function testGetQueueMessages()
|
||||
{
|
||||
// Setup
|
||||
$sample = TestResources::listMessagesSample();
|
||||
$expectedMessageId = '1234b585-0ac3-4e2a-ad0c-18e3992brca1';
|
||||
$result = ListMessagesResult::create($sample);
|
||||
$expected = $result->getQueueMessages();
|
||||
$expected[0]->setMessageId($expectedMessageId);
|
||||
$result->setQueueMessages($expected);
|
||||
|
||||
// Test
|
||||
$actual = $result->getQueueMessages();
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListMessagesResult::setQueueMessages
|
||||
*/
|
||||
public function testSetQueueMessages()
|
||||
{
|
||||
// Setup
|
||||
$sample = TestResources::listMessagesSample();
|
||||
$expectedMessageId = '1234b585-0ac3-4e2a-ad0c-18e3992brca1';
|
||||
$result = ListMessagesResult::create($sample);
|
||||
$expected = $result->getQueueMessages();
|
||||
$expected[0]->setMessageId($expectedMessageId);
|
||||
|
||||
// Test
|
||||
$result->setQueueMessages($expected);
|
||||
|
||||
$this->assertEquals($expected, $result->getQueueMessages());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,6 +58,14 @@ class ListQueuesResultTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::create
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::getQueues
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::setQueues
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::setNextMarker
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::getNextMarker
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::setMarker
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::getMarker
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::setMaxResults
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::getMaxResults
|
||||
*/
|
||||
public function testCreateWithOneEntry()
|
||||
{
|
||||
|
@ -79,6 +87,16 @@ class ListQueuesResultTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::create
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::getQueues
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::setQueues
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::setPrefix
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::getPrefix
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::setNextMarker
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::getNextMarker
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::setMaxResults
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::getMaxResults
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::setAccountName
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::getAccountName
|
||||
*/
|
||||
public function testCreateWithMultipleEntries()
|
||||
{
|
||||
|
@ -97,204 +115,9 @@ class ListQueuesResultTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals($sample['@attributes']['ServiceEndpoint'] . $sample['Queues']['Queue'][1]['Name'], $queues[1]->getUrl());
|
||||
$this->assertEquals($sample['MaxResults'], $actual->getMaxResults());
|
||||
$this->assertEquals($sample['NextMarker'], $actual->getNextMarker());
|
||||
$this->assertEquals($sample['Account'], $actual->getAccountName());
|
||||
$this->assertEquals($sample['Prefix'], $actual->getPrefix());
|
||||
|
||||
return $actual;
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::getQueues
|
||||
* @depends testCreateWithMultipleEntries
|
||||
*/
|
||||
public function testGetQueues($result)
|
||||
{
|
||||
// Test
|
||||
$actual = $result->getQueues();
|
||||
|
||||
// Assert
|
||||
$this->assertCount(2, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::setQueues
|
||||
* @depends testCreateWithMultipleEntries
|
||||
*/
|
||||
public function testSetQueues($result)
|
||||
{
|
||||
// Setup
|
||||
$sample = new ListQueuesResult();
|
||||
$expected = $result->getQueues();
|
||||
|
||||
// Test
|
||||
$sample->setQueues($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $sample->getQueues());
|
||||
$expected[0]->setName('test');
|
||||
$this->assertNotEquals($expected, $sample->getQueues());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::setPrefix
|
||||
*/
|
||||
public function testSetPrefix()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListQueuesResult();
|
||||
$expected = 'myprefix';
|
||||
|
||||
// Test
|
||||
$result->setPrefix($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getPrefix());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::getPrefix
|
||||
*/
|
||||
public function testGetPrefix()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListQueuesResult();
|
||||
$expected = 'myprefix';
|
||||
$result->setPrefix($expected);
|
||||
|
||||
// Test
|
||||
$actual = $result->getPrefix();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::setNextMarker
|
||||
*/
|
||||
public function testSetNextMarker()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListQueuesResult();
|
||||
$expected = 'mymarker';
|
||||
|
||||
// Test
|
||||
$result->setNextMarker($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getNextMarker());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::getNextMarker
|
||||
*/
|
||||
public function testGetNextMarker()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListQueuesResult();
|
||||
$expected = 'mymarker';
|
||||
$result->setNextMarker($expected);
|
||||
|
||||
// Test
|
||||
$actual = $result->getNextMarker();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::setMarker
|
||||
*/
|
||||
public function testSetMarker()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListQueuesResult();
|
||||
$expected = 'mymarker';
|
||||
|
||||
// Test
|
||||
$result->setMarker($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getMarker());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::getMarker
|
||||
*/
|
||||
public function testGetMarker()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListQueuesResult();
|
||||
$expected = 'mymarker';
|
||||
$result->setMarker($expected);
|
||||
|
||||
// Test
|
||||
$actual = $result->getMarker();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::setMaxResults
|
||||
*/
|
||||
public function testSetMaxResults()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListQueuesResult();
|
||||
$expected = '3';
|
||||
|
||||
// Test
|
||||
$result->setMaxResults($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getMaxResults());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::getMaxResults
|
||||
*/
|
||||
public function testGetMaxResults()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListQueuesResult();
|
||||
$expected = '3';
|
||||
$result->setMaxResults($expected);
|
||||
|
||||
// Test
|
||||
$actual = $result->getMaxResults();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::setAccountName
|
||||
*/
|
||||
public function testSetAccountName()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListQueuesResult();
|
||||
$expected = 'name';
|
||||
|
||||
// Test
|
||||
$result->setAccountName($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getAccountName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\ListQueuesResult::getAccountName
|
||||
*/
|
||||
public function testGetAccountName()
|
||||
{
|
||||
// Setup
|
||||
$result = new ListQueuesResult();
|
||||
$expected = 'name';
|
||||
$result->setAccountName($expected);
|
||||
|
||||
// Test
|
||||
$actual = $result->getAccountName();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,8 @@ class PeekMessagesResultTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\PeekMessagesResult::create
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\PeekMessagesResult::getQueueMessages
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\PeekMessagesResult::setQueueMessages
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
|
@ -65,6 +67,8 @@ class PeekMessagesResultTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\PeekMessagesResult::create
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\PeekMessagesResult::getQueueMessages
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\PeekMessagesResult::setQueueMessages
|
||||
*/
|
||||
public function testCreateMultiple()
|
||||
{
|
||||
|
@ -89,41 +93,4 @@ class PeekMessagesResultTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals(intval($sample['QueueMessage'][1]['DequeueCount']), $actual[1]->getDequeueCount());
|
||||
$this->assertEquals($sample['QueueMessage'][1]['MessageText'], $actual[1]->getMessageText());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\PeekMessagesResult::getQueueMessages
|
||||
*/
|
||||
public function testGetQueueMessages()
|
||||
{
|
||||
// Setup
|
||||
$sample = TestResources::listMessagesSample();
|
||||
$expectedMessageId = '1234b585-0ac3-4e2a-ad0c-18e3992brca1';
|
||||
$result = PeekMessagesResult::create($sample);
|
||||
$expected = $result->getQueueMessages();
|
||||
$expected[0]->setMessageId($expectedMessageId);
|
||||
$result->setQueueMessages($expected);
|
||||
|
||||
// Test
|
||||
$actual = $result->getQueueMessages();
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\PeekMessagesResult::setQueueMessages
|
||||
*/
|
||||
public function testSetQueueMessages()
|
||||
{
|
||||
// Setup
|
||||
$sample = TestResources::listMessagesSample();
|
||||
$expectedMessageId = '1234b585-0ac3-4e2a-ad0c-18e3992brca1';
|
||||
$result = PeekMessagesResult::create($sample);
|
||||
$expected = $result->getQueueMessages();
|
||||
$expected[0]->setMessageId($expectedMessageId);
|
||||
|
||||
// Test
|
||||
$result->setQueueMessages($expected);
|
||||
|
||||
$this->assertEquals($expected, $result->getQueueMessages());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,9 @@
|
|||
namespace MicrosoftAzure\Storage\Tests\unit\Queue\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Queue\Models\UpdateMessageResult;
|
||||
use MicrosoftAzure\Storage\Tests\Framework\TestResources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Resources;
|
||||
|
||||
/**
|
||||
* Unit tests for class UpdateMessageResult
|
||||
|
@ -42,69 +44,27 @@ class UpdateMessageResultTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\UpdateMessageResult::getPopReceipt
|
||||
*/
|
||||
public function testGetPopReceipt()
|
||||
{
|
||||
// Setup
|
||||
$updateMessageResult = new UpdateMessageResult();
|
||||
$expected = 'YzQ4Yzg1MDItYTc0Ny00OWNjLTkxYTUtZGM0MDFiZDAwYzEw';
|
||||
$updateMessageResult->setPopReceipt($expected);
|
||||
|
||||
// Test
|
||||
$actual = $updateMessageResult->getPopReceipt();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\UpdateMessageResult::setPopReceipt
|
||||
*/
|
||||
public function testSetPopReceipt()
|
||||
{
|
||||
// Setup
|
||||
$updateMessageResult = new UpdateMessageResult();
|
||||
$expected = 'YzQ4Yzg1MDItYTc0Ny00OWNjLTkxYTUtZGM0MDFiZDAwYzEw';
|
||||
|
||||
// Test
|
||||
$updateMessageResult->setPopReceipt($expected);
|
||||
|
||||
// Assert
|
||||
$actual = $updateMessageResult->getPopReceipt();
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\UpdateMessageResult::getTimeNextVisible
|
||||
*/
|
||||
public function testGetTimeNextVisible()
|
||||
{
|
||||
// Setup
|
||||
$updateMessageResult = new UpdateMessageResult();
|
||||
$expected = Utilities::rfc1123ToDateTime('Fri, 09 Oct 2009 23:29:20 GMT');
|
||||
$updateMessageResult->setTimeNextVisible($expected);
|
||||
|
||||
// Test
|
||||
$actual = $updateMessageResult->getTimeNextVisible();
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\UpdateMessageResult::setTimeNextVisible
|
||||
* @covers MicrosoftAzure\Storage\Queue\Models\UpdateMessageResult::create
|
||||
*/
|
||||
public function testSetTimeNextVisible()
|
||||
public function testCreate()
|
||||
{
|
||||
// Setup
|
||||
$updateMessageResult = new UpdateMessageResult();
|
||||
$expected = Utilities::rfc1123ToDateTime('Fri, 09 Oct 2009 23:29:20 GMT');
|
||||
$sample = TestResources::getUpdateMessageResultSampleHeaders();
|
||||
$expectedDate = Utilities::rfc1123ToDateTime(
|
||||
$sample[Resources::X_MS_TIME_NEXT_VISIBLE]
|
||||
);
|
||||
|
||||
// Test
|
||||
$updateMessageResult->setTimeNextVisible($expected);
|
||||
$result = UpdateMessageResult::create($sample);
|
||||
|
||||
// Assert
|
||||
$actual = $updateMessageResult->getTimeNextVisible();
|
||||
$this->assertEquals($expected, $actual);
|
||||
$this->assertEquals(
|
||||
$sample[Resources::X_MS_POPRECEIPT],
|
||||
$result->getPopReceipt()
|
||||
);
|
||||
$this->assertEquals($expectedDate, $result->getTimeNextVisible());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
namespace MicrosoftAzure\Storage\Tests\unit\Table\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Table\Models\BatchResult;
|
||||
use MicrosoftAzure\Storage\Table\Internal\MimeReaderWriter;
|
||||
use MicrosoftAzure\Storage\Table\Internal\AtomReaderWriter;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
use MicrosoftAzure\Storage\Tests\Framework\TestResources;
|
||||
|
||||
/**
|
||||
* Unit tests for class BatchResult
|
||||
|
@ -42,17 +46,28 @@ class BatchResultTest extends \PHPUnit_Framework_TestCase
|
|||
/**
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\BatchResult::setEntries
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\BatchResult::getEntries
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\BatchResult::create
|
||||
*/
|
||||
public function testSetEntries()
|
||||
public function testCreate()
|
||||
{
|
||||
// Setup
|
||||
$batchResult = new BatchResult();
|
||||
$entries = array();
|
||||
$contexts = TestResources::getBatchContexts();
|
||||
$body = TestResources::getBatchResponseBody();
|
||||
$operations = TestResources::getBatchOperations();
|
||||
$atomSerializer = new AtomReaderWriter();
|
||||
$mimeSerializer = new MimeReaderWriter();
|
||||
$entries = TestResources::getExpectedBatchResultEntries();
|
||||
|
||||
// Test
|
||||
$batchResult->setEntries($entries);
|
||||
$result = BatchResult::create(
|
||||
$body,
|
||||
$operations,
|
||||
$contexts,
|
||||
$atomSerializer,
|
||||
$mimeSerializer
|
||||
);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($entries, $batchResult->getEntries());
|
||||
//Assert
|
||||
$this->assertEquals($entries, $result->getEntries());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
namespace MicrosoftAzure\Storage\Tests\unit\Table\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Table\Models\GetEntityResult;
|
||||
use MicrosoftAzure\Storage\Table\Internal\AtomReaderWriter;
|
||||
use MicrosoftAzure\Storage\Table\Models\Entity;
|
||||
use MicrosoftAzure\Storage\Tests\Framework\TestResources;
|
||||
|
||||
/**
|
||||
* Unit tests for class GetEntityResult
|
||||
|
@ -42,17 +44,21 @@ class GetEntityResultTest extends \PHPUnit_Framework_TestCase
|
|||
/**
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\GetEntityResult::setEntity
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\GetEntityResult::getEntity
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\GetEntityResult::create
|
||||
*/
|
||||
public function testSetEntity()
|
||||
public function testCreate()
|
||||
{
|
||||
// Setup
|
||||
$result = new GetEntityResult();
|
||||
$entity = new Entity();
|
||||
$sampleBody = TestResources::getEntitySampleBody();
|
||||
$serializer = new AtomReaderWriter();
|
||||
|
||||
// Test
|
||||
$result->setEntity($entity);
|
||||
$result = GetEntityResult::create($sampleBody, $serializer);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($entity, $result->getEntity());
|
||||
$this->assertEquals(
|
||||
$serializer->parseEntity($sampleBody),
|
||||
$result->getEntity()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
namespace MicrosoftAzure\Storage\Tests\unit\Table\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Table\Models\GetTableResult;
|
||||
|
||||
use MicrosoftAzure\Storage\Table\Internal\AtomReaderWriter;
|
||||
use MicrosoftAzure\Storage\Tests\Framework\TestResources;
|
||||
/**
|
||||
* Unit tests for class GetTableResult
|
||||
*
|
||||
|
@ -41,17 +42,18 @@ class GetTableResultTest extends \PHPUnit_Framework_TestCase
|
|||
/**
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\GetTableResult::setName
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\GetTableResult::getName
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\GetTableResult::create
|
||||
*/
|
||||
public function testSetName()
|
||||
public function testCreate()
|
||||
{
|
||||
// Setup
|
||||
$result = new GetTableResult();
|
||||
$name = 'myTable';
|
||||
$sampleBody = TestResources::getTableSampleBody();
|
||||
$serializer = new AtomReaderWriter();
|
||||
|
||||
// Test
|
||||
$result->setName($name);
|
||||
$result = GetTableResult::create($sampleBody, $serializer);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($name, $result->getName());
|
||||
$this->assertEquals($serializer->parseTable($sampleBody), $result->getName());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,10 @@
|
|||
namespace MicrosoftAzure\Storage\Tests\unit\Table\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Table\Models\InsertEntityResult;
|
||||
use MicrosoftAzure\Storage\Table\Models\Entity;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Resources;
|
||||
use MicrosoftAzure\Storage\Tests\Framework\TestResources;
|
||||
use MicrosoftAzure\Storage\Table\Internal\AtomReaderWriter;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
|
||||
/**
|
||||
* Unit tests for class InsertEntityResult
|
||||
|
@ -39,20 +42,31 @@ use MicrosoftAzure\Storage\Table\Models\Entity;
|
|||
*/
|
||||
class InsertEntityResultTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\InsertEntityResult::setEntity
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\InsertEntityResult::getEntity
|
||||
*/
|
||||
public function testSetEntity()
|
||||
public function testCreate()
|
||||
{
|
||||
// Setup
|
||||
$result = new InsertEntityResult();
|
||||
$entity = new Entity();
|
||||
$sampleBody = TestResources::getInsertEntitySampleBody();
|
||||
$sampleHeaders = TestResources::getInsertEntitySampleHeaders();
|
||||
$serializer = new AtomReaderWriter();
|
||||
$expectedEntity = $serializer->parseEntity($sampleBody);
|
||||
$expectedEntity->setETag(Utilities::tryGetValue(
|
||||
$sampleHeaders,
|
||||
Resources::ETAG
|
||||
));
|
||||
|
||||
// Test
|
||||
$result->setEntity($entity);
|
||||
$result = InsertEntityResult::create(
|
||||
$sampleBody,
|
||||
$sampleHeaders,
|
||||
$serializer
|
||||
);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($entity, $result->getEntity());
|
||||
$this->assertEquals($expectedEntity, $result->getEntity());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,12 @@ class QueryEntitiesResultTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\QueryEntitiesResult::create
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\QueryEntitiesResult::setNextPartitionKey
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\QueryEntitiesResult::getNextPartitionKey
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\QueryEntitiesResult::setNextRowKey
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\QueryEntitiesResult::getNextRowKey
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\QueryEntitiesResult::setEntities
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\QueryEntitiesResult::getEntities
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
|
@ -51,55 +57,4 @@ class QueryEntitiesResultTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertNull($result->getNextPartitionKey());
|
||||
$this->assertNull($result->getNextRowKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\QueryEntitiesResult::setNextPartitionKey
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\QueryEntitiesResult::getNextPartitionKey
|
||||
*/
|
||||
public function testSetNextPartitionKey()
|
||||
{
|
||||
// Setup
|
||||
$result = new QueryEntitiesResult();
|
||||
$expected = 'parition';
|
||||
|
||||
// Test
|
||||
$result->setNextPartitionKey($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getNextPartitionKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\QueryEntitiesResult::setNextRowKey
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\QueryEntitiesResult::getNextRowKey
|
||||
*/
|
||||
public function testSetNextRowKey()
|
||||
{
|
||||
// Setup
|
||||
$result = new QueryEntitiesResult();
|
||||
$expected = 'edelo';
|
||||
|
||||
// Test
|
||||
$result->setNextRowKey($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getNextRowKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\QueryEntitiesResult::setEntities
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\QueryEntitiesResult::getEntities
|
||||
*/
|
||||
public function testSetEntities()
|
||||
{
|
||||
// Setup
|
||||
$result = new QueryEntitiesResult();
|
||||
$expected = array();
|
||||
|
||||
// Test
|
||||
$result->setEntities($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getEntities());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,37 +39,24 @@ use MicrosoftAzure\Storage\Table\Models\QueryTablesResult;
|
|||
*/
|
||||
class QueryTablesResultTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\QueryTablesResult::setNextTableName
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\QueryTablesResult::getNextTableName
|
||||
*/
|
||||
public function testSetNextTableName()
|
||||
{
|
||||
// Setup
|
||||
$result = new QueryTablesResult();
|
||||
$expected = 'table';
|
||||
|
||||
// Test
|
||||
$result->setNextTableName($expected);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getNextTableName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\QueryTablesResult::setTables
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\QueryTablesResult::getTables
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\QueryTablesResult::setNextTableName
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\QueryTablesResult::getNextTableName
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\QueryTablesResult::create
|
||||
*/
|
||||
public function testSetTables()
|
||||
public function testCreate()
|
||||
{
|
||||
// Setup
|
||||
$result = new QueryTablesResult();
|
||||
$expected = array(1, 2, 3, 4, 5);
|
||||
$entries = array('querytablessimple1', 'querytablessimple2');
|
||||
$headers = array('x-ms-continuation-nexttablename' => 'nextTable');
|
||||
|
||||
// Test
|
||||
$result->setTables($expected);
|
||||
$result = QueryTablesResult::create($headers, $entries);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $result->getTables());
|
||||
$this->assertEquals($entries, $result->getTables());
|
||||
$this->assertEquals($headers['x-ms-continuation-nexttablename'], $result->getNextTableName());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,18 +41,17 @@ class UpdateEntityResultTest extends \PHPUnit_Framework_TestCase
|
|||
/**
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\UpdateEntityResult::setETag
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\UpdateEntityResult::getETag
|
||||
* @covers MicrosoftAzure\Storage\Table\Models\UpdateEntityResult::create
|
||||
*/
|
||||
public function testSetETag()
|
||||
public function testCreate()
|
||||
{
|
||||
// Setup
|
||||
$expected = '0x8CAFB82EFF70C46';
|
||||
$entity = new UpdateEntityResult();
|
||||
$entity->setETag($expected);
|
||||
$headers = array('ETag' => '0x8CACB9BD7C6B1B2');
|
||||
|
||||
// Test
|
||||
$entity->setETag($expected);
|
||||
$result = UpdateEntityResult::create($headers);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($expected, $entity->getETag());
|
||||
$this->assertEquals($headers['ETag'], $result->getETag());
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче