Access conditions feature parity

This commit is contained in:
hasonmsft 2017-04-19 15:28:02 +08:00 коммит произвёл Tank Tang
Родитель ee1863f01a
Коммит 9feaa1bc17
19 изменённых файлов: 400 добавлений и 256 удалений

Просмотреть файл

@ -253,7 +253,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
);
$this->addOptionalAccessConditionHeader(
$headers,
$options->getAccessCondition()
$options->getAccessConditions()
);
return $this->sendAsync(
@ -285,7 +285,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
) {
$headers = $this->addOptionalAccessConditionHeader(
$headers,
$options->getAccessCondition()
$options->getAccessConditions()
);
$this->addOptionalHeader(
@ -507,7 +507,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers = $this->addOptionalAccessConditionHeader(
$headers,
$options->getAccessCondition()
$options->getAccessConditions()
);
$this->addOptionalHeader(
@ -913,7 +913,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
);
$headers = $this->addOptionalAccessConditionHeader(
$headers,
$options->getAccessCondition()
$options->getAccessConditions()
);
$this->addOptionalQueryParam(
@ -1077,7 +1077,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
);
$this->addOptionalAccessConditionHeader(
$headers,
$options->getAccessCondition()
$options->getAccessConditions()
);
$dataSerializer = $this->dataSerializer;
@ -1199,7 +1199,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
);
$this->addOptionalAccessConditionHeader(
$headers,
$options->getAccessCondition()
$options->getAccessConditions()
);
return $this->sendAsync(
@ -1286,7 +1286,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers = $this->addOptionalAccessConditionHeader(
$headers,
$options->getAccessCondition()
$options->getAccessConditions()
);
return $this->sendAsync(
@ -2083,7 +2083,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
);
$headers = $this->addOptionalAccessConditionHeader(
$headers,
$options->getAccessCondition()
$options->getAccessConditions()
);
$this->addOptionalHeader(
$headers,
@ -2436,7 +2436,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers = $this->addOptionalAccessConditionHeader(
$headers,
$options->getAccessCondition()
$options->getAccessConditions()
);
$this->addOptionalHeader(
@ -2638,7 +2638,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers = $this->generateMetadataHeaders($metadata);
$headers = $this->addOptionalAccessConditionHeader(
$headers,
$options->getAccessCondition()
$options->getAccessConditions()
);
$this->addOptionalHeader(
@ -2872,7 +2872,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers = $this->addOptionalAccessConditionHeader(
$headers,
$options->getAccessCondition()
$options->getAccessConditions()
);
$this->addOptionalHeader(
@ -2957,7 +2957,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers = $this->addOptionalAccessConditionHeader(
$headers,
$options->getAccessCondition()
$options->getAccessConditions()
);
$this->addOptionalHeader(
@ -3054,7 +3054,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers = $this->addOptionalAccessConditionHeader(
$headers,
$options->getAccessCondition()
$options->getAccessConditions()
);
$headers = $this->_addOptionalRangeHeader(
@ -3170,7 +3170,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers = $this->addOptionalAccessConditionHeader(
$headers,
$options->getAccessCondition()
$options->getAccessConditions()
);
$this->addOptionalHeader(
@ -3308,7 +3308,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers = $this->addOptionalAccessConditionHeader(
$headers,
$options->getAccessCondition()
$options->getAccessConditions()
);
$headers = $this->addMetadataHeaders($headers, $metadata);
@ -3468,7 +3468,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$getMD5 = $options->getComputeRangeMD5();
$headers = $this->addOptionalAccessConditionHeader(
$headers,
$options->getAccessCondition()
$options->getAccessConditions()
);
$headers = $this->_addOptionalRangeHeader(
$headers,
@ -3597,7 +3597,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers = $this->addOptionalAccessConditionHeader(
$headers,
$options->getAccessCondition()
$options->getAccessConditions()
);
$this->addOptionalHeader(
@ -3686,7 +3686,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers = $this->addOptionalAccessConditionHeader(
$headers,
$options->getAccessCondition()
$options->getAccessConditions()
);
$headers = $this->addMetadataHeaders($headers, $options->getMetadata());
$this->addOptionalHeader(
@ -3796,12 +3796,12 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers = $this->addOptionalAccessConditionHeader(
$headers,
$options->getAccessCondition()
$options->getAccessConditions()
);
$headers = $this->addOptionalSourceAccessConditionHeader(
$headers,
$options->getSourceAccessCondition()
$options->getSourceAccessConditions()
);
$this->addOptionalHeader(
@ -4019,7 +4019,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
null /* breakPeriod */,
self::getStatusCodeOfLeaseAction(LeaseMode::ACQUIRE_ACTION),
$options,
$options->getAccessCondition()
$options->getAccessConditions()
)->then(function ($response) {
return LeaseResult::create(
HttpFormatter::formatHeaders($response->getHeaders())
@ -4281,20 +4281,24 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
*/
public function addOptionalAccessConditionHeader(
array $headers,
Models\AccessCondition $accessCondition = null
array $accessConditions = null
) {
if (!is_null($accessCondition)) {
$header = $accessCondition->getHeader();
if (!empty($accessConditions)) {
foreach ($accessConditions as $accessCondition) {
if (!is_null($accessCondition)) {
$header = $accessCondition->getHeader();
if ($header != Resources::EMPTY_STRING) {
$value = $accessCondition->getValue();
if ($value instanceof \DateTime) {
$value = gmdate(
Resources::AZURE_DATE_FORMAT,
$value->getTimestamp()
);
if ($header != Resources::EMPTY_STRING) {
$value = $accessCondition->getValue();
if ($value instanceof \DateTime) {
$value = gmdate(
Resources::AZURE_DATE_FORMAT,
$value->getTimestamp()
);
}
$headers[$header] = $value;
}
}
$headers[$header] = $value;
}
}
@ -4305,45 +4309,49 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
* Adds optional header to headers if set
*
* @param array $headers The array of request headers.
* @param Models\AccessCondition $accessCondition The access condition object.
* @param array $accessCondition The access condition object.
*
* @return array
*/
public function addOptionalSourceAccessConditionHeader(
array $headers,
Models\AccessCondition $accessCondition = null
array $accessConditions = null
) {
if (!is_null($accessCondition)) {
$header = $accessCondition->getHeader();
$headerName = null;
if (!empty($header)) {
switch ($header) {
case Resources::IF_MATCH:
$headerName = Resources::X_MS_SOURCE_IF_MATCH;
break;
case Resources::IF_UNMODIFIED_SINCE:
$headerName = Resources::X_MS_SOURCE_IF_UNMODIFIED_SINCE;
break;
case Resources::IF_MODIFIED_SINCE:
$headerName = Resources::X_MS_SOURCE_IF_MODIFIED_SINCE;
break;
case Resources::IF_NONE_MATCH:
$headerName = Resources::X_MS_SOURCE_IF_NONE_MATCH;
break;
default:
throw new \Exception(Resources::INVALID_ACH_MSG);
break;
if (!empty($accessConditions)) {
foreach ($accessConditions as $accessCondition) {
if (!is_null($accessCondition)) {
$header = $accessCondition->getHeader();
$headerName = null;
if (!empty($header)) {
switch ($header) {
case Resources::IF_MATCH:
$headerName = Resources::X_MS_SOURCE_IF_MATCH;
break;
case Resources::IF_UNMODIFIED_SINCE:
$headerName = Resources::X_MS_SOURCE_IF_UNMODIFIED_SINCE;
break;
case Resources::IF_MODIFIED_SINCE:
$headerName = Resources::X_MS_SOURCE_IF_MODIFIED_SINCE;
break;
case Resources::IF_NONE_MATCH:
$headerName = Resources::X_MS_SOURCE_IF_NONE_MATCH;
break;
default:
throw new \Exception(Resources::INVALID_ACH_MSG);
break;
}
}
$value = $accessCondition->getValue();
if ($value instanceof \DateTime) {
$value = gmdate(
Resources::AZURE_DATE_FORMAT,
$value->getTimestamp()
);
}
$this->addOptionalHeader($headers, $headerName, $value);
}
}
$value = $accessCondition->getValue();
if ($value instanceof \DateTime) {
$value = gmdate(
Resources::AZURE_DATE_FORMAT,
$value->getTimestamp()
);
}
$this->addOptionalHeader($headers, $headerName, $value);
}
return $headers;

Просмотреть файл

@ -166,6 +166,118 @@ class AccessCondition
);
}
/**
* Returns an access condition such that an operation will be performed only if
* the operation would cause the blob to exceed that limit or if the append
* position is equal to this number.
* <p>
* Setting this access condition modifies the request to include the HTTP
* <i>x-ms-blob-condition-appendpos</i> conditional header. If this access condition
* is set, the operation is performed only if the append position is equal to this number
* <p>
* For more information,
* see <a href= 'https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/append-block'>
* Specifying Conditional Headers for Blob Service Operations</a>.
*
* @param int $appendPosition int that represents the append position
*
* @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
*/
public static function appendPosition($appendPosition)
{
return new AccessCondition(Resources::MAX_APPEND_POSITION, $appendPosition);
}
/**
* Returns an access condition such that an operation will be performed only if
* the operation would cause the blob to exceed that limit or if the blob size
* is already greater than the value specified in this header.
* <p>
* Setting this access condition modifies the request to include the HTTP
* <i>x-ms-blob-condition-maxsize</i> conditional header. If this access condition
* is set, the operation is performed only if the operation would cause the blob
* to exceed that limit or if the blob size is already greater than the value
* specified in this header.
* <p>
* For more information,
* see <a href= 'https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/append-block'>
* Specifying Conditional Headers for Blob Service Operations</a>.
*
* @param int $maxBlobSize int that represents the max blob size
*
* @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
*/
public static function maxBlobSize($maxBlobSize)
{
return new AccessCondition(Resources::MAX_BLOB_SIZE, $maxBlobSize);
}
/**
* Returns an access condition such that an operation will be performed only if
* the blobs sequence number is less than the specified value.
* <p>
* Setting this access condition modifies the request to include the HTTP
* <i>x-ms-if-sequence-number-lt</i> conditional header. If this access condition
* is set, the operation is performed only if the blobs sequence number is less
* than the specified value.
* <p>
* For more information,
* see <a href= 'https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/put-page'>
* Specifying Conditional Headers for Blob Service Operations</a>.
*
* @param int $sequenceNumber int that represents the sequence number value to check.
*
* @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
*/
public static function ifSequenceNumberLessThan($sequenceNumber)
{
return new AccessCondition(Resources::SEQUENCE_NUMBER_LESS_THAN, $sequenceNumber);
}
/**
* Returns an access condition such that an operation will be performed only if
* the blobs sequence number is equal to the specified value.
* <p>
* Setting this access condition modifies the request to include the HTTP
* <i>x-ms-if-sequence-number-eq</i> conditional header. If this access condition
* is set, the operation is performed only if the blobs sequence number is equal to
* the specified value.
* <p>
* For more information,
* see <a href= 'https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/put-page'>
* Specifying Conditional Headers for Blob Service Operations</a>.
*
* @param int $sequenceNumber int that represents the sequence number value to check.
*
* @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
*/
public static function ifSequenceNumberEqual($sequenceNumber)
{
return new AccessCondition(Resources::SEQUENCE_NUMBER_EQUAL, $sequenceNumber);
}
/**
* Returns an access condition such that an operation will be performed only if
* the blobs sequence number is less than or equal to the specified value.
* <p>
* Setting this access condition modifies the request to include the HTTP
* <i>x-ms-if-sequence-number-le</i> conditional header. If this access condition
* is set, the operation is performed only if the blobs sequence number is less
* than or equal to the specified value.
* <p>
* For more information,
* see <a href= 'https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/put-page'>
* Specifying Conditional Headers for Blob Service Operations</a>.
*
* @param int $sequenceNumber int that represents the sequence number value to check.
*
* @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
*/
public static function ifSequenceNumberLessThanOrEqual($sequenceNumber)
{
return new AccessCondition(Resources::SEQUENCE_NUMBER_LESS_THAN_OR_EQUAL, $sequenceNumber);
}
/**
* Sets header type
*
@ -229,6 +341,11 @@ class AccessCondition
|| $headerType == Resources::IF_MATCH
|| $headerType == Resources::IF_MODIFIED_SINCE
|| $headerType == Resources::IF_NONE_MATCH
|| $headerType == Resources::MAX_BLOB_SIZE
|| $headerType == Resources::MAX_APPEND_POSITION
|| $headerType == Resources::SEQUENCE_NUMBER_LESS_THAN_OR_EQUAL
|| $headerType == Resources::SEQUENCE_NUMBER_LESS_THAN
|| $headerType == Resources::SEQUENCE_NUMBER_EQUAL
) {
return true;
} else {

Просмотреть файл

@ -39,7 +39,7 @@ use MicrosoftAzure\Storage\Common\Internal\ServiceOptionsBase;
class BlobServiceOptions extends ServiceOptionsBase
{
private $_leaseId;
private $_accessCondition;
private $_accessConditions;
/**
* Gets lease Id for the blob
@ -66,22 +66,27 @@ class BlobServiceOptions extends ServiceOptionsBase
/**
* Gets access condition
*
* @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
* @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition[]
*/
public function getAccessCondition()
public function getAccessConditions()
{
return $this->_accessCondition;
return $this->_accessConditions;
}
/**
* Sets access condition
*
* @param \MicrosoftAzure\Storage\Blob\Models\AccessCondition $accessCondition value to use.
* @param mixed $accessConditions value to use.
*
* @return void
*/
public function setAccessCondition(AccessCondition $accessCondition)
public function setAccessConditions($accessConditions)
{
$this->_accessCondition = $accessCondition;
if (!is_null($accessConditions) &&
is_array($accessConditions)) {
$this->_accessConditions = $accessConditions;
} else {
$this->_accessConditions = [$accessConditions];
}
}
}

Просмотреть файл

@ -39,30 +39,35 @@ use MicrosoftAzure\Storage\Common\Internal\Validate;
class CopyBlobOptions extends BlobServiceOptions
{
private $_sourceLeaseId;
private $_sourceAccessCondition;
private $_sourceAccessConditions;
private $_metadata;
private $_sourceSnapshot;
/**
* Gets source access condition
*
* @return AccessCondition
* @return AccessCondition[]
*/
public function getSourceAccessCondition()
public function getSourceAccessConditions()
{
return $this->_sourceAccessCondition;
return $this->_sourceAccessConditions;
}
/**
* Sets source access condition
*
* @param AccessCondition $sourceAccessCondition value to use.
* @param array $sourceAccessCondition value to use.
*
* @return void
*/
public function setSourceAccessCondition(AccessCondition $sourceAccessCondition)
public function setSourceAccessConditions($sourceAccessConditions)
{
$this->_sourceAccessCondition = $sourceAccessCondition;
if (!is_null($sourceAccessConditions) &&
is_array($sourceAccessConditions)) {
$this->_sourceAccessConditions = $sourceAccessConditions;
} else {
$this->_sourceAccessConditions = [$sourceAccessConditions];
}
}
/**

Просмотреть файл

@ -204,6 +204,11 @@ class Resources
const IF_MATCH = 'if-match';
const IF_NONE_MATCH = 'if-none-match';
const IF_UNMODIFIED_SINCE = 'if-unmodified-since';
const MAX_BLOB_SIZE = 'x-ms-blob-condition-maxsize';
const MAX_APPEND_POSITION = 'x-ms-blob-condition-appendpos';
const SEQUENCE_NUMBER_LESS_THAN_OR_EQUAL = 'x-ms-if-sequence-number-le';
const SEQUENCE_NUMBER_LESS_THAN = 'x-ms-if-sequence-number-lt';
const SEQUENCE_NUMBER_EQUAL = 'x-ms-if-sequence-number-eq';
const RANGE = 'range';
const DATA_SERVICE_VERSION = 'dataserviceversion';
const MAX_DATA_SERVICE_VERSION = 'maxdataserviceversion';

Просмотреть файл

@ -622,7 +622,7 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
$this->assertTrue(false, 'Expect negative timeouts in $options to throw');
}
if (!$this->isEmulated() &&
!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition())) {
!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessConditions())) {
$this->assertTrue(false, 'Failing access condition should throw');
}
@ -648,7 +648,7 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
$this->assertEquals(TestResources::STATUS_INTERNAL_SERVER_ERROR, $e->getCode(), 'getCode');
} elseif (!$this->isEmulated() &&
!BlobServiceFunctionalTestData::passTemporalAccessCondition(
$options->getAccessCondition()
$options->getAccessConditions()
)) {
$this->assertEquals(TestResources::STATUS_PRECONDITION_FAILED, $e->getCode(), 'getCode');
} else {
@ -832,9 +832,10 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
// setMetadata only honors If-Modified-Since
if (! $this->isEmulated() &&
!BlobServiceFunctionalTestData::passTemporalAccessCondition(
$options->getAccessCondition()
) && (!is_null($options->getAccessCondition()) &&
$options->getAccessCondition()->getHeader() !=
$options->getAccessConditions()
) && (!is_null($options->getAccessConditions()) &&
empty($options->getAccessConditions()) &&
$options->getAccessConditions()[0]->getHeader() !=
Resources::IF_UNMODIFIED_SINCE)) {
$this->assertTrue(false, 'Expect failing access condition to throw');
}
@ -845,9 +846,10 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
if (Utilities::startsWith($firstkey, '<')) {
$this->assertEquals(TestResources::STATUS_BAD_REQUEST, $e->getCode(), 'getCode');
} elseif (!$this->isEmulated() &&
!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition()) &&
(!is_null($options->getAccessCondition()) &&
$options->getAccessCondition()->getHeader() != Resources::IF_UNMODIFIED_SINCE)) {
!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessConditions()) &&
(!is_null($options->getAccessConditions()) &&
!empty($options->getAccessConditions()) &&
$options->getAccessConditions()[0]->getHeader() != Resources::IF_UNMODIFIED_SINCE)) {
// setMetadata only honors If-Modified-Since
$this->assertEquals(TestResources::STATUS_PRECONDITION_FAILED, $e->getCode(), 'getCode');
} elseif (!is_null($options->getTimeout()) && $options->getTimeout() < 1) {
@ -1452,7 +1454,7 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
if (!is_null($options)) {
BlobServiceFunctionalTestData::fixETagAccessCondition(
$options->getAccessCondition(),
$options->getAccessConditions(),
$createBlockBlobResult->getETag()
);
}
@ -1470,10 +1472,10 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
if (!is_null($options->getTimeout()) && $options->getTimeout() < 1) {
$this->assertTrue(false, 'Expect negative timeouts in $options to throw');
}
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition())) {
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessConditions())) {
$this->assertTrue(false, 'Failing temporal access condition should throw');
}
if (!BlobServiceFunctionalTestData::passETagAccessCondition($options->getAccessCondition())) {
if (!BlobServiceFunctionalTestData::passETagAccessCondition($options->getAccessConditions())) {
$this->assertTrue(false, 'Failing etag access condition should throw');
}
@ -1481,13 +1483,13 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
} catch (ServiceException $e) {
if (!is_null($options->getTimeout()) && $options->getTimeout() < 1) {
$this->assertEquals(TestResources::STATUS_INTERNAL_SERVER_ERROR, $e->getCode(), 'bad timeout: getCode');
} elseif (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition())) {
} elseif (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessConditions())) {
$this->assertEquals(
TestResources::STATUS_PRECONDITION_FAILED,
$e->getCode(),
'bad temporal access condition: getCode'
);
} elseif (!BlobServiceFunctionalTestData::passETagAccessCondition($options->getAccessCondition())) {
} elseif (!BlobServiceFunctionalTestData::passETagAccessCondition($options->getAccessConditions())) {
$this->assertEquals(
TestResources::STATUS_PRECONDITION_FAILED,
$e->getCode(),
@ -1611,7 +1613,7 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
$createBlockBlobResult = $this->restProxy->createBlockBlob($container, $blob, "");
if (!is_null($options)) {
BlobServiceFunctionalTestData::fixETagAccessCondition(
$options->getAccessCondition(),
$options->getAccessConditions(),
$createBlockBlobResult->getETag()
);
}
@ -1639,10 +1641,10 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
if (!is_null($options->getTimeout()) && $options->getTimeout() < 1) {
$this->assertTrue(false, 'Expect negative timeouts in $options to throw');
}
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition())) {
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessConditions())) {
$this->assertTrue(false, 'Failing access condition should throw');
}
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition())) {
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessConditions())) {
$this->assertTrue(false, 'Expect failing access condition to throw');
}
if (Utilities::startsWith($firstkey, '<')) {
@ -1658,13 +1660,13 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
$this->assertEquals(TestResources::STATUS_BAD_REQUEST, $e->getCode(), 'getCode');
} elseif (!is_null($options->getTimeout()) && $options->getTimeout() < 1) {
$this->assertEquals(TestResources::STATUS_INTERNAL_SERVER_ERROR, $e->getCode(), 'bad timeout: getCode');
} elseif (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition())) {
} elseif (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessConditions())) {
$this->assertEquals(
TestResources::STATUS_PRECONDITION_FAILED,
$e->getCode(),
'bad temporal access condition: getCode'
);
} elseif (!BlobServiceFunctionalTestData::passETagAccessCondition($options->getAccessCondition())) {
} elseif (!BlobServiceFunctionalTestData::passETagAccessCondition($options->getAccessConditions())) {
$this->assertEquals(
TestResources::STATUS_PRECONDITION_FAILED,
$e->getCode(),
@ -1769,7 +1771,7 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
if (!is_null($options)) {
BlobServiceFunctionalTestData::fixETagAccessCondition(
$options->getAccessCondition(),
$options->getAccessConditions(),
$createPageBlobResult->getETag()
);
}
@ -1787,13 +1789,14 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
if (!is_null($options->getTimeout()) && $options->getTimeout() < 1) {
$this->assertTrue(false, 'Expect negative timeouts in $options to throw');
}
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition())) {
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessConditions())) {
$this->assertTrue(false, 'Failing temporal access condition should throw');
}
$this->verifyGetBlobPropertiesWorker($res, $metadata, null);
} catch (ServiceException $e) {
if (!is_null($options->getAccessCondition()) &&
if (!is_null($options->getAccessConditions()) &&
!empty($options->getAccessConditions()) &&
!$this->hasSecureEndpoint() &&
$e->getCode() == TestResources::STATUS_FORBIDDEN) {
// Proxies can eat the access condition headers of
@ -1802,8 +1805,8 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
// can be done about this, other than ignore it.
} elseif (!is_null($options->getTimeout()) && $options->getTimeout() < 1) {
$this->assertEquals(TestResources::STATUS_INTERNAL_SERVER_ERROR, $e->getCode(), 'bad timeout: getCode');
} elseif (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition())) {
if ($options->getAccessCondition()->getHeader() == Resources::IF_MODIFIED_SINCE) {
} elseif (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessConditions())) {
if ($options->getAccessConditions()[0]->getHeader() == Resources::IF_MODIFIED_SINCE) {
$this->assertEquals(
TestResources::STATUS_NOT_MODIFIED,
$e->getCode(),
@ -2004,7 +2007,7 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
// Make sure there is something to test
$createPageBlobResult = $this->restProxy->createPageBlob($container, $blob, 512);
BlobServiceFunctionalTestData::fixETagAccessCondition(
$properties->getAccessCondition(),
$properties->getAccessConditions(),
$createPageBlobResult->getETag()
);
@ -2015,10 +2018,10 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
if (!is_null($properties->getTimeout()) && $properties->getTimeout() < 1) {
$this->assertTrue(false, 'Expect negative timeouts in options to throw');
}
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($properties->getAccessCondition())) {
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($properties->getAccessConditions())) {
$this->assertTrue(false, 'Failing access condition should throw');
}
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($properties->getAccessCondition())) {
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($properties->getAccessConditions())) {
$this->assertTrue(false, 'Expect failing access condition to throw');
}
@ -2029,13 +2032,13 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
} catch (ServiceException $e) {
if (!is_null($properties->getTimeout()) && $properties->getTimeout() < 1) {
$this->assertEquals(TestResources::STATUS_INTERNAL_SERVER_ERROR, $e->getCode(), 'bad timeout: getCode');
} elseif (!BlobServiceFunctionalTestData::passTemporalAccessCondition($properties->getAccessCondition())) {
} elseif (!BlobServiceFunctionalTestData::passTemporalAccessCondition($properties->getAccessConditions())) {
$this->assertEquals(
TestResources::STATUS_PRECONDITION_FAILED,
$e->getCode(),
'bad temporal access condition: getCode'
);
} elseif (!BlobServiceFunctionalTestData::passETagAccessCondition($properties->getAccessCondition())) {
} elseif (!BlobServiceFunctionalTestData::passETagAccessCondition($properties->getAccessConditions())) {
$this->assertEquals(
TestResources::STATUS_PRECONDITION_FAILED,
$e->getCode(),
@ -2141,7 +2144,7 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
$this->restProxy->createBlobSnapshot($container, $blob);
if (!is_null($options)) {
BlobServiceFunctionalTestData::fixETagAccessCondition($options->getAccessCondition(), $sbmd->getETag());
BlobServiceFunctionalTestData::fixETagAccessCondition($options->getAccessConditions(), $sbmd->getETag());
$options->setSnapshot(is_null($options->getSnapshot()) ? null : $snapshot->getSnapshot());
}
@ -2158,10 +2161,10 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
if (!is_null($options->getTimeout()) && $options->getTimeout() < 1) {
$this->assertTrue(false, 'Expect negative timeouts in $options to throw');
}
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition())) {
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessConditions())) {
$this->assertTrue(false, 'Expect failing temporal access condition should throw');
}
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition())) {
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessConditions())) {
$this->assertTrue(false, 'Expect failing etag access condition to throw');
}
if ($options->getComputeRangeMD5() && is_null($options->getRangeStart())) {
@ -2170,7 +2173,8 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
$this->verifyGetBlobWorker($res, $options, $dataSize, $metadata);
} catch (ServiceException $e) {
if (!is_null($options->getAccessCondition()) &&
if (!is_null($options->getAccessConditions()) &&
!empty($options->getAccessConditions()) &&
!$this->hasSecureEndpoint() &&
$e->getCode() == TestResources::STATUS_FORBIDDEN) {
// Proxies can eat the access condition headers of
@ -2179,8 +2183,8 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
// can be done about this, other than ignore it.
} elseif (!is_null($options->getTimeout()) && $options->getTimeout() < 1) {
$this->assertEquals(TestResources::STATUS_INTERNAL_SERVER_ERROR, $e->getCode(), 'bad timeout: getCode');
} elseif (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition())) {
if ($options->getAccessCondition()->getHeader() == Resources::IF_MODIFIED_SINCE) {
} elseif (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessConditions())) {
if ($options->getAccessConditions()[0]->getHeader() == Resources::IF_MODIFIED_SINCE) {
$this->assertEquals(
TestResources::STATUS_NOT_MODIFIED,
$e->getCode(),
@ -2195,7 +2199,7 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
' getCode'
);
}
} elseif (!BlobServiceFunctionalTestData::passETagAccessCondition($options->getAccessCondition())) {
} elseif (!BlobServiceFunctionalTestData::passETagAccessCondition($options->getAccessConditions())) {
$this->assertEquals(
TestResources::STATUS_PRECONDITION_FAILED,
$e->getCode(),
@ -2336,7 +2340,7 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
$blobinfo = $this->restProxy->getBlob($container, $blob);
if (!is_null($options)) {
BlobServiceFunctionalTestData::fixETagAccessCondition(
$options->getAccessCondition(),
$options->getAccessConditions(),
$blobinfo->getProperties()->getETag()
);
$options->setSnapshot(is_null($options->getSnapshot()) ? null : $snapshot->getSnapshot());
@ -2358,10 +2362,10 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
if (!is_null($options->getTimeout()) && $options->getTimeout() < 1) {
$this->assertTrue(false, 'Expect negative timeouts in $options to throw');
}
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition())) {
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessConditions())) {
$this->assertTrue(false, 'Expect failing temporal access condition should throw');
}
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition())) {
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessConditions())) {
$this->assertTrue(false, 'Expect failing etag access condition to throw');
}
@ -2379,14 +2383,14 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
$e->getCode(),
'bad timeout: deleteHttpStatusCode'
);
} elseif (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition())) {
} elseif (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessConditions())) {
$this->assertEquals(
TestResources::STATUS_PRECONDITION_FAILED,
$e->getCode(),
'bad temporal access condition IF_UNMODIFIED_SINCE: ' .
'deleteHttpStatusCode'
);
} elseif (!BlobServiceFunctionalTestData::passETagAccessCondition($options->getAccessCondition())) {
} elseif (!BlobServiceFunctionalTestData::passETagAccessCondition($options->getAccessConditions())) {
$this->assertEquals(
TestResources::STATUS_PRECONDITION_FAILED,
$e->getCode(),
@ -2494,7 +2498,7 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
$snapshot1 = $this->restProxy->createBlobSnapshot($container, $blob);
if (!is_null($options)) {
BlobServiceFunctionalTestData::fixETagAccessCondition(
$options->getAccessCondition(),
$options->getAccessConditions(),
$snapshot1->getETag()
);
}
@ -2512,10 +2516,10 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
if (!is_null($options->getTimeout()) && $options->getTimeout() < 1) {
$this->assertTrue(false, 'Expect negative timeouts in $options to throw');
}
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition())) {
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessConditions())) {
$this->assertTrue(false, 'Expect failing temporal access condition should throw');
}
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition())) {
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessConditions())) {
$this->assertTrue(false, 'Expect failing etag access condition to throw');
}
@ -2538,7 +2542,7 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
'bad timeout: deleteHttpStatusCode'
);
} elseif (!BlobServiceFunctionalTestData::
passTemporalAccessCondition($options->getAccessCondition())
passTemporalAccessCondition($options->getAccessConditions())
) {
$this->assertEquals(
TestResources::STATUS_PRECONDITION_FAILED,
@ -2547,7 +2551,7 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
' deleteHttpStatusCode'
);
} elseif (!BlobServiceFunctionalTestData::
passETagAccessCondition($options->getAccessCondition())) {
passETagAccessCondition($options->getAccessConditions())) {
$this->assertEquals(
TestResources::STATUS_PRECONDITION_FAILED,
$e->getCode(),
@ -2681,11 +2685,11 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
$snapshot = $this->restProxy->createBlobSnapshot($sourceContainer, $sourceBlob);
if (!is_null($options)) {
BlobServiceFunctionalTestData::fixETagAccessCondition(
$options->getSourceAccessCondition(),
$options->getSourceAccessConditions(),
$snapshot->getETag()
);
BlobServiceFunctionalTestData::fixETagAccessCondition(
$options->getAccessCondition(),
$options->getAccessConditions(),
$destBlobInfo->getETag()
);
$options->setSourceSnapshot(is_null($options->getSourceSnapshot()) ? null : $snapshot->getSnapshot());
@ -2705,16 +2709,16 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
if (!is_null($options->getTimeout()) && $options->getTimeout() < 1) {
$this->assertTrue(false, 'Expect negative timeouts in $options to throw');
}
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getSourceAccessCondition())) {
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getSourceAccessConditions())) {
$this->assertTrue(false, 'Expect failing source temporal access condition should throw');
}
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getSourceAccessCondition())) {
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getSourceAccessConditions())) {
$this->assertTrue(false, 'Expect failing source etag access condition to throw');
}
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition())) {
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessConditions())) {
$this->assertTrue(false, 'Expect failing dest temporal access condition should throw');
}
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessCondition())) {
if (!BlobServiceFunctionalTestData::passTemporalAccessCondition($options->getAccessConditions())) {
$this->assertTrue(false, 'Expect failing dest etag access condition to throw');
}
@ -2740,7 +2744,7 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
$this->assertEquals(500, $e->getCode(), 'bad timeout: deleteHttpStatusCode');
} elseif (!BlobServiceFunctionalTestData::
passTemporalAccessCondition(
$options->getSourceAccessCondition()
$options->getSourceAccessConditions()
)) {
$this->assertEquals(
412,
@ -2750,7 +2754,7 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
);
} elseif (!BlobServiceFunctionalTestData::
passETagAccessCondition(
$options->getSourceAccessCondition()
$options->getSourceAccessConditions()
)) {
$this->assertEquals(
412,
@ -2759,7 +2763,7 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
);
} elseif (!BlobServiceFunctionalTestData::
passTemporalAccessCondition(
$options->getAccessCondition()
$options->getAccessConditions()
)) {
$this->assertEquals(
412,
@ -2769,7 +2773,7 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
);
} elseif (!BlobServiceFunctionalTestData::
passETagAccessCondition(
$options->getAccessCondition()
$options->getAccessConditions()
)) {
$this->assertEquals(
412,

Просмотреть файл

@ -135,16 +135,16 @@ class BlobServiceFunctionalTestData
public static function passTemporalAccessCondition($ac)
{
if (is_null($ac)) {
if (is_null($ac) || empty($ac)) {
return true;
}
$now = new \DateTime();
if ($ac->getHeader() == Resources::IF_UNMODIFIED_SINCE) {
return $ac->getValue() > $now;
} elseif ($ac->getHeader() == Resources::IF_MODIFIED_SINCE) {
return $ac->getValue() < $now;
if ($ac[0]->getHeader() == Resources::IF_UNMODIFIED_SINCE) {
return $ac[0]->getValue() > $now;
} elseif ($ac[0]->getHeader() == Resources::IF_MODIFIED_SINCE) {
return $ac[0]->getValue() < $now;
} else {
return true;
}
@ -152,12 +152,12 @@ class BlobServiceFunctionalTestData
public static function passETagAccessCondition($ac)
{
if (is_null($ac)) {
if (is_null($ac) || empty($ac)) {
return true;
} elseif ($ac->getHeader() == Resources::IF_MATCH) {
return self::$badETag != $ac->getValue();
} elseif ($ac->getHeader() == Resources::IF_NONE_MATCH) {
return self::$badETag == $ac->getValue();
} elseif ($ac[0]->getHeader() == Resources::IF_MATCH) {
return self::$badETag != $ac[0]->getValue();
} elseif ($ac[0]->getHeader() == Resources::IF_NONE_MATCH) {
return self::$badETag == $ac[0]->getValue();
} else {
return true;
}
@ -165,10 +165,10 @@ class BlobServiceFunctionalTestData
public static function fixETagAccessCondition($ac, $etag)
{
if (!is_null($ac)) {
if ($ac->getHeader() == Resources::IF_MATCH || $ac->getHeader() == Resources::IF_NONE_MATCH) {
if (is_null($ac->getValue()) || self::$badETag != $ac->getValue()) {
$ac->setValue($etag);
if (!is_null($ac) && !empty($ac)) {
if ($ac[0]->getHeader() == Resources::IF_MATCH || $ac[0]->getHeader() == Resources::IF_NONE_MATCH) {
if (is_null($ac[0]->getValue()) || self::$badETag != $ac[0]->getValue()) {
$ac[0]->setValue($etag);
}
}
}
@ -570,19 +570,19 @@ class BlobServiceFunctionalTestData
array_push($ret, $options);
$options = new BlobServiceOptions();
$options->setAccessCondition(AccessCondition::ifModifiedSince($past));
$options->setAccessConditions(AccessCondition::ifModifiedSince($past));
array_push($ret, $options);
$options = new BlobServiceOptions();
$options->setAccessCondition(AccessCondition::ifNotModifiedSince($past));
$options->setAccessConditions(AccessCondition::ifNotModifiedSince($past));
array_push($ret, $options);
$options = new BlobServiceOptions();
$options->setAccessCondition(AccessCondition::ifModifiedSince($future));
$options->setAccessConditions(AccessCondition::ifModifiedSince($future));
array_push($ret, $options);
$options = new BlobServiceOptions();
$options->setAccessCondition(AccessCondition::ifNotModifiedSince($future));
$options->setAccessConditions(AccessCondition::ifNotModifiedSince($future));
array_push($ret, $options);
return $ret;
@ -607,7 +607,7 @@ class BlobServiceFunctionalTestData
// But easier to special-case If-Unmodified-Since in the test.
foreach (self::getTemporalAccessConditions() as $ac) {
$options = new BlobServiceOptions();
$options->setAccessCondition($ac);
$options->setAccessConditions($ac);
array_push($ret, $options);
}
@ -631,7 +631,7 @@ class BlobServiceFunctionalTestData
foreach (self::getAllAccessConditions() as $ac) {
$options = new BlobServiceOptions();
$options->setAccessCondition($ac);
$options->setAccessConditions($ac);
array_push($ret, $options);
}
@ -661,7 +661,7 @@ class BlobServiceFunctionalTestData
// Get Blob Properties only supports the temporal access conditions.
foreach (self::getTemporalAccessConditions() as $ac) {
$options = new GetBlobPropertiesOptions();
$options->setAccessCondition($ac);
$options->setAccessConditions($ac);
array_push($ret, $options);
}
@ -686,7 +686,7 @@ class BlobServiceFunctionalTestData
// Get Blob Properties only supports the temporal access conditions.
foreach (self::getTemporalAccessConditions() as $ac) {
$options = new SetBlobPropertiesOptions();
$options->setAccessCondition($ac);
$options->setAccessConditions($ac);
array_push($ret, $options);
}
@ -776,7 +776,7 @@ class BlobServiceFunctionalTestData
// Get Blob only supports the temporal access conditions.
foreach (self::getTemporalAccessConditions() as $ac) {
$options = new GetBlobOptions();
$options->setAccessCondition($ac);
$options->setAccessConditions($ac);
array_push($ret, $options);
}
@ -837,7 +837,7 @@ class BlobServiceFunctionalTestData
foreach (self::getAllAccessConditions() as $ac) {
$options = new DeleteBlobOptions();
$options->setAccessCondition($ac);
$options->setAccessConditions($ac);
array_push($ret, $options);
}
@ -878,7 +878,7 @@ class BlobServiceFunctionalTestData
foreach (self::getAllAccessConditions() as $ac) {
$options = new CreateBlobSnapshotOptions();
$options->setAccessCondition($ac);
$options->setAccessConditions($ac);
array_push($ret, $options);
}
@ -911,13 +911,13 @@ class BlobServiceFunctionalTestData
foreach (self::getAllAccessConditions() as $ac) {
$options = new CopyBlobOptions();
$options->setSourceAccessCondition($ac);
$options->setSourceAccessConditions($ac);
array_push($ret, $options);
}
foreach (self::getAllAccessConditions() as $ac) {
$options = new CopyBlobOptions();
$options->setAccessCondition($ac);
$options->setAccessConditions($ac);
array_push($ret, $options);
}

Просмотреть файл

@ -1335,7 +1335,7 @@ class BlobServiceIntegrationTest extends IntegrationTestBase
$this->restProxy->createPageBlob(self::$_test_container_for_blobs, 'test', 4096);
try {
$opts = new GetBlobOptions();
$opts->setAccessCondition(AccessCondition::ifMatch('123'));
$opts->setAccessConditions(AccessCondition::ifMatch('123'));
$this->restProxy->getBlob(self::$_test_container_for_blobs, 'test', $opts);
$this->fail('getBlob should throw an exception');
} catch (ServiceException $e) {
@ -1355,7 +1355,7 @@ class BlobServiceIntegrationTest extends IntegrationTestBase
$props = $this->restProxy->getBlobProperties(self::$_test_container_for_blobs, 'test');
try {
$opts = new GetBlobOptions();
$opts->setAccessCondition(AccessCondition::ifNoneMatch($props->getProperties()->getETag()));
$opts->setAccessConditions(AccessCondition::ifNoneMatch($props->getProperties()->getETag()));
$this->restProxy->getBlob(self::$_test_container_for_blobs, 'test', $opts);
$this->fail('getBlob should throw an exception');
} catch (ServiceException $e) {
@ -1384,7 +1384,7 @@ class BlobServiceIntegrationTest extends IntegrationTestBase
try {
$opts = new GetBlobOptions();
$lastMod = $props->getProperties()->getLastModified();
$opts->setAccessCondition(AccessCondition::ifModifiedSince($lastMod));
$opts->setAccessConditions(AccessCondition::ifModifiedSince($lastMod));
$this->restProxy->getBlob(self::$_test_container_for_blobs, 'test', $opts);
$this->fail('getBlob should throw an exception');
} catch (ServiceException $e) {
@ -1431,7 +1431,7 @@ class BlobServiceIntegrationTest extends IntegrationTestBase
}
try {
$opts = new GetBlobOptions();
$opts->setAccessCondition(AccessCondition::ifNotModifiedSince($lastModifiedBase));
$opts->setAccessConditions(AccessCondition::ifNotModifiedSince($lastModifiedBase));
$this->restProxy->getBlob($container, $blob, $opts);
$this->fail('getBlob should throw an exception');
} catch (ServiceException $e) {

Просмотреть файл

@ -2787,7 +2787,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase
$headers = array('Header1' => 'Value1', 'Header2' => 'Value2');
// Test
$actual = $this->restProxy->addOptionalAccessConditionHeader($headers, $accessCondition);
$actual = $this->restProxy->addOptionalAccessConditionHeader($headers, [$accessCondition]);
// Assert
$this->assertCount(3, $actual);
@ -2806,7 +2806,7 @@ class BlobRestProxyTest extends BlobServiceRestProxyTestBase
$headers = array('Header1' => 'Value1', 'Header2' => 'Value2');
// Test
$actual = $this->restProxy->addOptionalSourceAccessConditionHeader($headers, $accessCondition);
$actual = $this->restProxy->addOptionalSourceAccessConditionHeader($headers, [$accessCondition]);
// Assert
$this->assertCount(3, $actual);

Просмотреть файл

@ -198,35 +198,35 @@ class CommitBlobBlocksOptionsTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers MicrosoftAzure\Storage\Blob\Models\CommitBlobBlocksOptions::getAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\CommitBlobBlocksOptions::getAccessConditions
*/
public function testGetAccessCondition()
public function testGetAccessConditions()
{
// Setup
$expected = AccessCondition::none();
$result = new CommitBlobBlocksOptions();
$result->setAccessCondition($expected);
$result->setAccessConditions($expected);
// Test
$actual = $result->getAccessCondition();
$actual = $result->getAccessConditions();
// Assert
$this->assertEquals($expected, $actual);
$this->assertEquals($expected, $actual[0]);
}
/**
* @covers MicrosoftAzure\Storage\Blob\Models\CommitBlobBlocksOptions::setAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\CommitBlobBlocksOptions::setAccessConditions
*/
public function testSetAccessCondition()
public function testSetAccessConditions()
{
// Setup
$expected = AccessCondition::none();
$result = new CommitBlobBlocksOptions();
// Test
$result->setAccessCondition($expected);
$result->setAccessConditions($expected);
// Assert
$this->assertEquals($expected, $result->getAccessCondition());
$this->assertEquals($expected, $result->getAccessConditions()[0]);
}
}

Просмотреть файл

@ -57,34 +57,34 @@ class CopyBlobOptionsTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers MicrosoftAzure\Storage\Blob\Models\CopyBlobOptions::setAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\CopyBlobOptions::getAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\CopyBlobOptions::setAccessConditions
* @covers MicrosoftAzure\Storage\Blob\Models\CopyBlobOptions::getAccessConditions
*/
public function testSetAccessCondition()
public function testSetAccessConditions()
{
$copyBlobOptions = new CopyBlobOptions();
$expected = AccessCondition::ifMatch("12345");
$copyBlobOptions->setAccessCondition($expected);
$copyBlobOptions->setAccessConditions($expected);
$this->assertEquals(
$expected,
$copyBlobOptions->getAccessCondition()
$copyBlobOptions->getAccessConditions()[0]
);
}
/**
* @covers MicrosoftAzure\Storage\Blob\Models\CopyBlobOptions::setSourceAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\CopyBlobOptions::getSourceAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\CopyBlobOptions::setSourceAccessConditions
* @covers MicrosoftAzure\Storage\Blob\Models\CopyBlobOptions::getSourceAccessConditions
*/
public function testSetSourceAccessCondition()
public function testSetSourceAccessConditions()
{
$copyBlobOptions = new CopyBlobOptions();
$expected = AccessCondition::IfMatch("x");
$copyBlobOptions->setSourceAccessCondition($expected);
$copyBlobOptions->setSourceAccessConditions($expected);
$this->assertEquals(
$expected,
$copyBlobOptions->getSourceAccessCondition()
$copyBlobOptions->getSourceAccessConditions()[0]
);
}

Просмотреть файл

@ -218,35 +218,35 @@ class CreateBlobOptionsTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions::getAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions::getAccessConditions
*/
public function testGetAccessCondition()
public function testGetAccessConditions()
{
// Setup
$expected = AccessCondition::none();
$result = new CreateBlobOptions();
$result->setAccessCondition($expected);
$result->setAccessConditions($expected);
// Test
$actual = $result->getAccessCondition();
$actual = $result->getAccessConditions();
// Assert
$this->assertEquals($expected, $actual);
$this->assertEquals($expected, $actual[0]);
}
/**
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions::setAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions::setAccessConditions
*/
public function testSetAccessCondition()
public function testSetAccessConditions()
{
// Setup
$expected = AccessCondition::none();
$result = new CreateBlobOptions();
// Test
$result->setAccessCondition($expected);
$result->setAccessConditions($expected);
// Assert
$this->assertEquals($expected, $result->getAccessCondition());
$this->assertEquals($expected, $result->getAccessConditions()[0]);
}
}

Просмотреть файл

@ -39,36 +39,36 @@ use MicrosoftAzure\Storage\Blob\Models\AccessCondition;
class CreateBlobPagesOptionsTest extends \PHPUnit_Framework_TestCase
{
/**
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesOptions::getAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesOptions::getAccessConditions
*/
public function testGetAccessCondition()
public function testGetAccessConditions()
{
// Setup
$expected = AccessCondition::none();
$options = new CreateBlobPagesOptions();
$options->setAccessCondition($expected);
$options->setAccessConditions($expected);
// Test
$actual = $options->getAccessCondition();
$actual = $options->getAccessConditions();
// Assert
$this->assertEquals($expected, $actual);
$this->assertEquals($expected, $actual[0]);
}
/**
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesOptions::setAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesOptions::setAccessConditions
*/
public function testSetAccessCondition()
public function testSetAccessConditions()
{
// Setup
$expected = AccessCondition::none();
$options = new CreateBlobPagesOptions();
// Test
$options->setAccessCondition($expected);
$options->setAccessConditions($expected);
// Assert
$this->assertEquals($expected, $options->getAccessCondition());
$this->assertEquals($expected, $options->getAccessConditions()[0]);
}
/**

Просмотреть файл

@ -58,36 +58,36 @@ class DeleteBlobOptionsTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers MicrosoftAzure\Storage\Blob\Models\DeleteBlobOptions::getAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\DeleteBlobOptions::getAccessConditions
*/
public function testGetAccessCondition()
public function testGetAccessConditions()
{
// Setup
$expected = AccessCondition::none();
$result = new DeleteBlobOptions();
$result->setAccessCondition($expected);
$result->setAccessConditions($expected);
// Test
$actual = $result->getAccessCondition();
$actual = $result->getAccessConditions();
// Assert
$this->assertEquals($expected, $actual);
$this->assertEquals($expected, $actual[0]);
}
/**
* @covers MicrosoftAzure\Storage\Blob\Models\DeleteBlobOptions::setAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\DeleteBlobOptions::setAccessConditions
*/
public function testSetAccessCondition()
public function testSetAccessConditions()
{
// Setup
$expected = AccessCondition::none();
$result = new DeleteBlobOptions();
// Test
$result->setAccessCondition($expected);
$result->setAccessConditions($expected);
// Assert
$this->assertEquals($expected, $result->getAccessCondition());
$this->assertEquals($expected, $result->getAccessConditions()[0]);
}
/**

Просмотреть файл

@ -58,36 +58,36 @@ class GetBlobMetadataOptionsTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobMetadataOptions::getAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobMetadataOptions::getAccessConditions
*/
public function testGetAccessCondition()
public function testGetAccessConditions()
{
// Setup
$expected = AccessCondition::none();
$result = new GetBlobMetadataOptions();
$result->setAccessCondition($expected);
$result->setAccessConditions($expected);
// Test
$actual = $result->getAccessCondition();
$actual = $result->getAccessConditions();
// Assert
$this->assertEquals($expected, $actual);
$this->assertEquals($expected, $actual[0]);
}
/**
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobMetadataOptions::setAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobMetadataOptions::setAccessConditions
*/
public function testSetAccessCondition()
public function testSetAccessConditions()
{
// Setup
$expected = AccessCondition::none();
$result = new GetBlobMetadataOptions();
// Test
$result->setAccessCondition($expected);
$result->setAccessConditions($expected);
// Assert
$this->assertEquals($expected, $result->getAccessCondition());
$this->assertEquals($expected, $result->getAccessConditions()[0]);
}
/**

Просмотреть файл

@ -58,36 +58,36 @@ class GetBlobOptionsTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobOptions::getAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobOptions::getAccessConditions
*/
public function testGetAccessCondition()
public function testGetAccessConditions()
{
// Setup
$expected = AccessCondition::none();
$result = new GetBlobOptions();
$result->setAccessCondition($expected);
$result->setAccessConditions($expected);
// Test
$actual = $result->getAccessCondition();
$actual = $result->getAccessConditions();
// Assert
$this->assertEquals($expected, $actual);
$this->assertEquals($expected, $actual[0]);
}
/**
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobOptions::setAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobOptions::setAccessConditions
*/
public function testSetAccessCondition()
public function testSetAccessConditions()
{
// Setup
$expected = AccessCondition::none();
$result = new GetBlobOptions();
// Test
$result->setAccessCondition($expected);
$result->setAccessConditions($expected);
// Assert
$this->assertEquals($expected, $result->getAccessCondition());
$this->assertEquals($expected, $result->getAccessConditions()[0]);
}
/**

Просмотреть файл

@ -58,36 +58,36 @@ class GetBlobPropertiesOptionsTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobPropertiesOptions::getAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobPropertiesOptions::getAccessConditions
*/
public function testGetAccessCondition()
public function testGetAccessConditions()
{
// Setup
$expected = AccessCondition::none();
$result = new GetBlobPropertiesOptions();
$result->setAccessCondition($expected);
$result->setAccessConditions($expected);
// Test
$actual = $result->getAccessCondition();
$actual = $result->getAccessConditions();
// Assert
$this->assertEquals($expected, $actual);
$this->assertEquals($expected, $actual[0]);
}
/**
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobPropertiesOptions::setAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\GetBlobPropertiesOptions::setAccessConditions
*/
public function testSetAccessCondition()
public function testSetAccessConditions()
{
// Setup
$expected = AccessCondition::none();
$result = new GetBlobPropertiesOptions();
// Test
$result->setAccessCondition($expected);
$result->setAccessConditions($expected);
// Assert
$this->assertEquals($expected, $result->getAccessCondition());
$this->assertEquals($expected, $result->getAccessConditions()[0]);
}
/**

Просмотреть файл

@ -58,36 +58,36 @@ class ListPageBlobRangesOptionsTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesOptions::getAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesOptions::getAccessConditions
*/
public function testGetAccessCondition()
public function testGetAccessConditions()
{
// Setup
$expected = AccessCondition::none();
$result = new ListPageBlobRangesOptions();
$result->setAccessCondition($expected);
$result->setAccessConditions($expected);
// Test
$actual = $result->getAccessCondition();
$actual = $result->getAccessConditions();
// Assert
$this->assertEquals($expected, $actual);
$this->assertEquals($expected, $actual[0]);
}
/**
* @covers MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesOptions::setAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesOptions::setAccessConditions
*/
public function testSetAccessCondition()
public function testSetAccessConditions()
{
// Setup
$expected = AccessCondition::none();
$result = new ListPageBlobRangesOptions();
// Test
$result->setAccessCondition($expected);
$result->setAccessConditions($expected);
// Assert
$this->assertEquals($expected, $result->getAccessCondition());
$this->assertEquals($expected, $result->getAccessConditions()[0]);
}
/**

Просмотреть файл

@ -221,35 +221,35 @@ class SetBlobPropertiesOptionsTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesOptions::getAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesOptions::getAccessConditions
*/
public function testGetAccessCondition()
public function testGetAccessConditions()
{
// Setup
$expected = AccessCondition::none();
$result = new SetBlobPropertiesOptions();
$result->setAccessCondition($expected);
$result->setAccessConditions($expected);
// Test
$actual = $result->getAccessCondition();
$actual = $result->getAccessConditions();
// Assert
$this->assertEquals($expected, $actual);
$this->assertEquals($expected, $actual[0]);
}
/**
* @covers MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesOptions::setAccessCondition
* @covers MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesOptions::setAccessConditions
*/
public function testSetAccessCondition()
public function testSetAccessConditions()
{
// Setup
$expected = AccessCondition::none();
$result = new SetBlobPropertiesOptions();
// Test
$result->setAccessCondition($expected);
$result->setAccessConditions($expected);
// Assert
$this->assertEquals($expected, $result->getAccessCondition());
$this->assertEquals($expected, $result->getAccessConditions()[0]);
}
}