├── .gitignore ├── BreakingChanges.md ├── CONTRIBUTING.md ├── ChangeLog.md ├── ISSUE_TEMPLATE.md ├── LICENSE ├── README.md ├── SECURITY.md ├── azure-pipelines.yml ├── azure-storage-blob ├── BreakingChanges.md ├── CONTRIBUTING.md ├── ChangeLog.md ├── LICENSE ├── README.md ├── composer.json └── src │ └── Blob │ ├── BlobRestProxy.php │ ├── BlobSharedAccessSignatureHelper.php │ ├── Internal │ ├── BlobResources.php │ └── IBlob.php │ └── Models │ ├── AccessCondition.php │ ├── AccessTierTrait.php │ ├── AppendBlockOptions.php │ ├── AppendBlockResult.php │ ├── Blob.php │ ├── BlobAccessPolicy.php │ ├── BlobBlockType.php │ ├── BlobPrefix.php │ ├── BlobProperties.php │ ├── BlobServiceOptions.php │ ├── BlobType.php │ ├── Block.php │ ├── BlockList.php │ ├── BreakLeaseResult.php │ ├── CommitBlobBlocksOptions.php │ ├── Container.php │ ├── ContainerACL.php │ ├── ContainerAccessPolicy.php │ ├── ContainerProperties.php │ ├── CopyBlobFromURLOptions.php │ ├── CopyBlobOptions.php │ ├── CopyBlobResult.php │ ├── CopyState.php │ ├── CreateBlobBlockOptions.php │ ├── CreateBlobOptions.php │ ├── CreateBlobPagesOptions.php │ ├── CreateBlobPagesResult.php │ ├── CreateBlobSnapshotOptions.php │ ├── CreateBlobSnapshotResult.php │ ├── CreateBlockBlobOptions.php │ ├── CreateContainerOptions.php │ ├── CreatePageBlobFromContentOptions.php │ ├── CreatePageBlobOptions.php │ ├── DeleteBlobOptions.php │ ├── GetBlobMetadataOptions.php │ ├── GetBlobMetadataResult.php │ ├── GetBlobOptions.php │ ├── GetBlobPropertiesOptions.php │ ├── GetBlobPropertiesResult.php │ ├── GetBlobResult.php │ ├── GetContainerACLResult.php │ ├── GetContainerPropertiesResult.php │ ├── LeaseMode.php │ ├── LeaseResult.php │ ├── ListBlobBlocksOptions.php │ ├── ListBlobBlocksResult.php │ ├── ListBlobsOptions.php │ ├── ListBlobsResult.php │ ├── ListContainersOptions.php │ ├── ListContainersResult.php │ ├── ListPageBlobRangesDiffResult.php │ ├── ListPageBlobRangesOptions.php │ ├── ListPageBlobRangesResult.php │ ├── PageWriteOption.php │ ├── PublicAccessType.php │ ├── PutBlobResult.php │ ├── PutBlockResult.php │ ├── SetBlobMetadataResult.php │ ├── SetBlobPropertiesOptions.php │ ├── SetBlobPropertiesResult.php │ ├── SetBlobTierOptions.php │ └── UndeleteBlobOptions.php ├── azure-storage-common ├── BreakingChanges.md ├── CONTRIBUTING.md ├── ChangeLog.md ├── LICENSE ├── README.md ├── composer.json └── src │ └── Common │ ├── CloudConfigurationManager.php │ ├── Exceptions │ ├── InvalidArgumentTypeException.php │ └── ServiceException.php │ ├── Internal │ ├── ACLBase.php │ ├── Authentication │ │ ├── IAuthScheme.php │ │ ├── SharedAccessSignatureAuthScheme.php │ │ ├── SharedKeyAuthScheme.php │ │ └── TokenAuthScheme.php │ ├── ConnectionStringParser.php │ ├── ConnectionStringSource.php │ ├── Http │ │ ├── HttpCallContext.php │ │ └── HttpFormatter.php │ ├── MetadataTrait.php │ ├── Middlewares │ │ └── CommonRequestMiddleware.php │ ├── Resources.php │ ├── RestProxy.php │ ├── Serialization │ │ ├── ISerializer.php │ │ ├── JsonSerializer.php │ │ ├── MessageSerializer.php │ │ └── XmlSerializer.php │ ├── ServiceRestProxy.php │ ├── ServiceRestTrait.php │ ├── ServiceSettings.php │ ├── StorageServiceSettings.php │ ├── Utilities.php │ └── Validate.php │ ├── LocationMode.php │ ├── Logger.php │ ├── MarkerContinuationTokenTrait.php │ ├── Middlewares │ ├── HistoryMiddleware.php │ ├── IMiddleware.php │ ├── MiddlewareBase.php │ ├── MiddlewareStack.php │ ├── RetryMiddleware.php │ └── RetryMiddlewareFactory.php │ ├── Models │ ├── AccessPolicy.php │ ├── CORS.php │ ├── ContinuationToken.php │ ├── GetServicePropertiesResult.php │ ├── GetServiceStatsResult.php │ ├── Logging.php │ ├── MarkerContinuationToken.php │ ├── Metrics.php │ ├── Range.php │ ├── RangeDiff.php │ ├── RetentionPolicy.php │ ├── ServiceOptions.php │ ├── ServiceProperties.php │ ├── SignedIdentifier.php │ └── TransactionalMD5Trait.php │ └── SharedAccessSignatureHelper.php ├── azure-storage-file ├── BreakingChanges.md ├── CONTRIBUTING.md ├── ChangeLog.md ├── LICENSE ├── README.md ├── composer.json └── src │ └── File │ ├── FileRestProxy.php │ ├── FileSharedAccessSignatureHelper.php │ ├── Internal │ ├── FileResources.php │ └── IFile.php │ └── Models │ ├── CopyFileResult.php │ ├── CreateDirectoryOptions.php │ ├── CreateFileFromContentOptions.php │ ├── CreateFileOptions.php │ ├── CreateShareOptions.php │ ├── Directory.php │ ├── File.php │ ├── FileAccessPolicy.php │ ├── FileProperties.php │ ├── FileServiceOptions.php │ ├── GetDirectoryMetadataResult.php │ ├── GetDirectoryPropertiesResult.php │ ├── GetFileMetadataResult.php │ ├── GetFileOptions.php │ ├── GetFileResult.php │ ├── GetShareACLResult.php │ ├── GetSharePropertiesResult.php │ ├── GetShareStatsResult.php │ ├── ListDirectoriesAndFilesOptions.php │ ├── ListDirectoriesAndFilesResult.php │ ├── ListFileRangesResult.php │ ├── ListSharesOptions.php │ ├── ListSharesResult.php │ ├── PutFileRangeOptions.php │ ├── Share.php │ ├── ShareACL.php │ ├── ShareAccessPolicy.php │ └── ShareProperties.php ├── azure-storage-queue ├── BreakingChanges.md ├── CONTRIBUTING.md ├── ChangeLog.md ├── LICENSE ├── README.md ├── composer.json └── src │ └── Queue │ ├── Internal │ ├── IQueue.php │ └── QueueResources.php │ ├── Models │ ├── CreateMessageOptions.php │ ├── CreateMessageResult.php │ ├── CreateQueueOptions.php │ ├── GetQueueMetadataResult.php │ ├── ListMessagesOptions.php │ ├── ListMessagesResult.php │ ├── ListQueuesOptions.php │ ├── ListQueuesResult.php │ ├── PeekMessagesOptions.php │ ├── PeekMessagesResult.php │ ├── Queue.php │ ├── QueueACL.php │ ├── QueueAccessPolicy.php │ ├── QueueMessage.php │ ├── QueueServiceOptions.php │ └── UpdateMessageResult.php │ ├── QueueRestProxy.php │ └── QueueSharedAccessSignatureHelper.php ├── azure-storage-table ├── BreakingChanges.md ├── CONTRIBUTING.md ├── ChangeLog.md ├── LICENSE ├── README.md ├── composer.json └── src │ └── Table │ ├── Internal │ ├── AcceptOptionTrait.php │ ├── Authentication │ │ └── TableSharedKeyLiteAuthScheme.php │ ├── IMimeReaderWriter.php │ ├── IODataReaderWriter.php │ ├── ITable.php │ ├── JsonODataReaderWriter.php │ ├── MimeReaderWriter.php │ └── TableResources.php │ ├── Models │ ├── AcceptJSONContentType.php │ ├── BatchOperation.php │ ├── BatchOperationParameterName.php │ ├── BatchOperationType.php │ ├── BatchOperations.php │ ├── BatchResult.php │ ├── DeleteEntityOptions.php │ ├── EdmType.php │ ├── Entity.php │ ├── Filters │ │ ├── BinaryFilter.php │ │ ├── ConstantFilter.php │ │ ├── Filter.php │ │ ├── PropertyNameFilter.php │ │ ├── QueryStringFilter.php │ │ └── UnaryFilter.php │ ├── GetEntityOptions.php │ ├── GetEntityResult.php │ ├── GetTableOptions.php │ ├── GetTableResult.php │ ├── InsertEntityResult.php │ ├── Property.php │ ├── Query.php │ ├── QueryEntitiesOptions.php │ ├── QueryEntitiesResult.php │ ├── QueryTablesOptions.php │ ├── QueryTablesResult.php │ ├── TableACL.php │ ├── TableAccessPolicy.php │ ├── TableContinuationToken.php │ ├── TableContinuationTokenTrait.php │ ├── TableServiceCreateOptions.php │ ├── TableServiceOptions.php │ └── UpdateEntityResult.php │ ├── TableRestProxy.php │ └── TableSharedAccessSignatureHelper.php ├── build.linux.xml ├── build.xml ├── build ├── phpcs.xml └── phpmd.xml ├── clean_up.php ├── composer.json ├── phpdoc.dist.xml ├── phpunit.xml.dist ├── samples ├── AADAuthSamples.php ├── BlobSamples.php ├── FileSamples.php ├── QueueSamples.php └── TableSamples.php └── tests ├── Framework ├── BlobServiceRestProxyTestBase.php ├── FileServiceRestProxyTestBase.php ├── QueueServiceRestProxyTestBase.php ├── ReflectionTestBase.php ├── RestProxyTestBase.php ├── SASFunctionalTestBase.php ├── ServiceRestProxyTestBase.php ├── TableServiceRestProxyTestBase.php ├── TestResources.php └── VirtualFileSystem.php ├── Functional ├── Blob │ ├── AnonymousAccessFunctionalTest.php │ ├── BlobServiceFunctionalTest.php │ ├── BlobServiceFunctionalTestData.php │ ├── BlobServiceIntegrationTest.php │ ├── BlobServiceSASFunctionalTest.php │ ├── BlobSharedAccessSignatureHelperMock.php │ ├── BlobStorageAccountFunctionalTest.php │ ├── FunctionalTestBase.php │ ├── IntegrationTestBase.php │ └── PremiumAccountFunctionalTest.php ├── Common │ ├── AccountSASFunctionalTest.php │ └── SharedAccessSignatureHelperMock.php ├── File │ ├── FileServiceFunctionalTest.php │ ├── FileServiceFunctionalTestData.php │ ├── FileServiceSASFunctionalTest.php │ ├── FileSharedAccessSignatureHelperMock.php │ ├── FunctionalTestBase.php │ └── IntegrationTestBase.php ├── Queue │ ├── FunctionalTestBase.php │ ├── IntegrationTestBase.php │ ├── QueueServiceFunctionalOptionsTest.php │ ├── QueueServiceFunctionalParameterTest.php │ ├── QueueServiceFunctionalTest.php │ ├── QueueServiceFunctionalTestData.php │ ├── QueueServiceIntegrationTest.php │ ├── QueueServiceSASFunctionalTest.php │ └── QueueSharedAccessSignatureHelperMock.php └── Table │ ├── Enums │ ├── ConcurType.php │ ├── MutatePivot.php │ └── OpType.php │ ├── FunctionalTestBase.php │ ├── IntegrationTestBase.php │ ├── Models │ ├── BatchWorkerConfig.php │ └── FakeTableInfoEntry.php │ ├── TableServiceFunctionalOptionsTest.php │ ├── TableServiceFunctionalParametersTest.php │ ├── TableServiceFunctionalQueryTest.php │ ├── TableServiceFunctionalTest.php │ ├── TableServiceFunctionalTestData.php │ ├── TableServiceFunctionalTestUtils.php │ ├── TableServiceIntegrationTest.php │ ├── TableServiceSASFunctionalTest.php │ └── TableSharedAccessSignatureHelperMock.php ├── Mock ├── Common │ └── Internal │ │ └── Authentication │ │ ├── OAuthSchemeMock.php │ │ ├── SharedAccessSignatureAuthSchemeMock.php │ │ └── SharedKeyAuthSchemeMock.php └── Table │ └── Internal │ └── Authentication │ └── TableSharedKeyLiteAuthSchemeMock.php └── Unit ├── Blob ├── BlobRestProxyTest.php └── Models │ ├── AccessConditionTest.php │ ├── BlobBlockTypeTest.php │ ├── BlobPolicyTest.php │ ├── BlobPrefixTest.php │ ├── BlobPropertiesTest.php │ ├── BlobTest.php │ ├── BlobTypeTest.php │ ├── BlockListTest.php │ ├── BlockTest.php │ ├── BreakLeaseResultTest.php │ ├── CommitBlobBlocksOptionsTest.php │ ├── ContainerACLTest.php │ ├── ContainerPolicyTest.php │ ├── ContainerPropertiesTest.php │ ├── ContainerTest.php │ ├── CopyBlobOptionsTest.php │ ├── CopyBlobResultTest.php │ ├── CreateBlobBlockOptionsTest.php │ ├── CreateBlobOptionsTest.php │ ├── CreateBlobPagesOptionsTest.php │ ├── CreateBlobPagesResultTest.php │ ├── CreateBlobSnapshotOptionsTest.php │ ├── CreateBlobSnapshotResultTest.php │ ├── CreateContainerOptionsTest.php │ ├── DeleteBlobOptionsTest.php │ ├── GetBlobMetadataOptionsTest.php │ ├── GetBlobMetadataResultTest.php │ ├── GetBlobOptionsTest.php │ ├── GetBlobPropertiesOptionsTest.php │ ├── GetBlobPropertiesResultTest.php │ ├── GetBlobResultTest.php │ ├── GetContainerACLResultTest.php │ ├── GetContainerPropertiesResultTest.php │ ├── LeaseModeTest.php │ ├── LeaseResultTest.php │ ├── ListBlobBlocksOptionsTest.php │ ├── ListBlobBlocksResultTest.php │ ├── ListBlobsOptionsTest.php │ ├── ListBlobsResultTest.php │ ├── ListContainersOptionsTest.php │ ├── ListContainersResultTest.php │ ├── ListPageBlobRangesDiffResultTest.php │ ├── ListPageBlobRangesOptionsTest.php │ ├── ListPageBlobRangesResultTest.php │ ├── PublicAccessTypeTest.php │ ├── PutBlobResultTest.php │ ├── PutBlockResultTest.php │ ├── SetBlobMetadataResultTest.php │ ├── SetBlobPropertiesOptionsTest.php │ ├── SetBlobPropertiesResultTest.php │ ├── SignedIdentifierTest.php │ └── UndeleteBlobOptionsTest.php ├── Common ├── CloudConfigurationManagerTest.php ├── Exceptions │ └── ServiceExceptionTest.php ├── Internal │ ├── ACLBaseTest.php │ ├── Authentication │ │ ├── SharedAccessSignatureAuthSchemeTest.php │ │ ├── SharedKeyAuthSchemeTest.php │ │ └── TokenAuthSchemeTest.php │ ├── ConnectionStringParserTest.php │ ├── ConnectionStringSourceTest.php │ ├── Http │ │ └── HttpCallContextTest.php │ ├── InvalidArgumentTypeExceptionTest.php │ ├── LoggerTest.php │ ├── Middlewares │ │ └── CommonRequestMiddlewareTest.php │ ├── Serialization │ │ ├── DummyClass.php │ │ ├── JsonSerializerTest.php │ │ └── XmlSerializerTest.php │ ├── ServiceOptionsTest.php │ ├── ServiceRestProxyTest.php │ ├── StorageServiceSettingsTest.php │ ├── TestFiles │ │ └── cacert.pem │ ├── UtilitiesTest.php │ └── ValidateTest.php ├── Middlewares │ ├── HistoryMiddlewareTest.php │ ├── MiddlewareBaseTest.php │ ├── MiddlewareStackTest.php │ └── RetryMiddlewareFactoryTest.php ├── Models │ ├── AccessPolicyTest.php │ ├── CORSTest.php │ ├── GetServicePropertiesResultTest.php │ ├── GetServiceStatsResultTest.php │ ├── LoggingTest.php │ ├── MetricsTest.php │ ├── RangeDiffTest.php │ ├── RangeTest.php │ ├── RetentionPolicyTest.php │ └── ServicePropertiesTest.php └── SharedAccessSignatureHelperTest.php ├── File ├── FileRestProxyTest.php └── Models │ ├── DirectoryTest.php │ ├── FilePolicyTest.php │ ├── FileTest.php │ ├── GetDirectoryPropertiesResultTest.php │ ├── GetSharePropertiesResultTest.php │ ├── ListDirectoriesAndFilesResultTest.php │ ├── ListSharesResultTest.php │ ├── SharePolicyTest.php │ ├── SharePropertiesTest.php │ └── ShareTest.php ├── Queue ├── Models │ ├── CreateMessageOptionsTest.php │ ├── CreateMessageResultTest.php │ ├── CreateQueueOptionsTest.php │ ├── GetQueueMetadataResultTest.php │ ├── ListMessagesOptionsTest.php │ ├── ListMessagesResultTest.php │ ├── ListQueuesOptionsTest.php │ ├── ListQueuesResultTest.php │ ├── PeekMessagesOptionsTest.php │ ├── PeekMessagesResultTest.php │ ├── QueueACLTest.php │ ├── QueueMessageTest.php │ ├── QueuePolicyTest.php │ ├── QueueTest.php │ └── UpdateMessageResultTest.php └── QueueRestProxyTest.php └── Table ├── Internal ├── Authentication │ └── TableSharedKeyLiteAuthSchemeTest.php └── JsonODataReaderWriterTest.php ├── Models ├── BatchOperationParameterNameTest.php ├── BatchOperationTest.php ├── BatchOperationTypeTest.php ├── BatchOperationsTest.php ├── BatchResultTest.php ├── DeleteEntityOptionsTest.php ├── EdmTypeTest.php ├── EntityTest.php ├── Filters │ ├── BinaryFilterTest.php │ ├── ConstantFilterTest.php │ ├── FilterTest.php │ ├── PropertyNameFilterTest.php │ ├── QueryStringFilterTest.php │ └── UnaryFilterTest.php ├── GetEntityResultTest.php ├── GetTableResultTest.php ├── InsertEntityResultTest.php ├── PropertyTest.php ├── QueryEntitiesOptionsTest.php ├── QueryEntitiesResultTest.php ├── QueryTablesOptionsTest.php ├── QueryTablesResultTest.php ├── QueryTest.php ├── TableACLTest.php ├── TablePolicyTest.php └── UpdateEntityResultTest.php └── TableRestProxyTest.php /.gitignore: -------------------------------------------------------------------------------- 1 | .buildpath 2 | .settings/* 3 | .project 4 | .cache.properties 5 | composer.lock 6 | test-file-* 7 | .idea 8 | .php_cs.cache 9 | cache.properties 10 | output.txt 11 | /vendor/* 12 | /output/* 13 | /build/* 14 | /doc/* -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Which service(blob, file, queue, table) does this issue concern? 2 | 3 | 4 | ### Which version of the SDK was used? 5 | 6 | 7 | ### What's the PHP/OS version? 8 | 9 | 10 | ### What problem was encountered? 11 | 12 | 13 | ### Steps to reproduce the issue? 14 | 15 | 16 | ### Have you found a mitigation/solution? 17 | 18 | 19 | ### Is there a failing request ID related to this problem returned by server? What is it? 20 | 21 | 22 | ### What is the storage account name and time frame of your last reproduce? (UTC YYYY/MM/DD hh:mm:ss) 23 | 24 | 25 | (If you think some of the information should not be shared publicly, you can e-mail the main Microsoft contributors of the repository instead.) 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Microsoft Corporation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | # PHP 2 | # Test and package your PHP project. 3 | # Add steps that run tests, save build artifacts, deploy, and more: 4 | # https://docs.microsoft.com/azure/devops/pipelines/languages/php 5 | 6 | pr: 7 | - master 8 | - dev 9 | 10 | jobs: 11 | - job: fullvalidation 12 | timeoutInMinutes: 120 13 | 14 | pool: 15 | vmImage: 'Ubuntu-18.04' 16 | 17 | variables: 18 | phpVersion: 7.1 19 | 20 | steps: 21 | - script: | 22 | sudo update-alternatives --set php /usr/bin/php$(phpVersion) 23 | sudo update-alternatives --set phar /usr/bin/phar$(phpVersion) 24 | sudo update-alternatives --set phpdbg /usr/bin/phpdbg$(phpVersion) 25 | sudo update-alternatives --set php-cgi /usr/bin/php-cgi$(phpVersion) 26 | sudo update-alternatives --set phar.phar /usr/bin/phar.phar$(phpVersion) 27 | php -version 28 | displayName: 'Use PHP version $(phpVersion)' 29 | 30 | - script: composer install --no-interaction --prefer-dist 31 | displayName: 'composer install' 32 | 33 | - script: php clean_up.php 34 | env: { AZURE_STORAGE_CONNECTION_STRING: $(AZURE_STORAGE_CONNECTION_STRING), 35 | AZURE_STORAGE_CONNECTION_STRING_BLOB_ACCOUNT: $(AZURE_STORAGE_CONNECTION_STRING_BLOB_ACCOUNT), 36 | AZURE_STORAGE_CONNECTION_STRING_PREMIUM_ACCOUNT: $(AZURE_STORAGE_CONNECTION_STRING_PREMIUM_ACCOUNT)} 37 | displayName: 'clean up test environment' 38 | 39 | 40 | - task: Ant@1 41 | inputs: 42 | antBuildFile: 'build.linux.xml' 43 | options: 44 | targets: 'full-build-parallel' 45 | publishJUnitResults: false 46 | env: { AZURE_STORAGE_CONNECTION_STRING: $(AZURE_STORAGE_CONNECTION_STRING), 47 | AZURE_STORAGE_CONNECTION_STRING_BLOB_ACCOUNT: $(AZURE_STORAGE_CONNECTION_STRING_BLOB_ACCOUNT), 48 | AZURE_STORAGE_CONNECTION_STRING_PREMIUM_ACCOUNT: $(AZURE_STORAGE_CONNECTION_STRING_PREMIUM_ACCOUNT)} 49 | 50 | -------------------------------------------------------------------------------- /azure-storage-blob/BreakingChanges.md: -------------------------------------------------------------------------------- 1 | Tracking Breaking changes in 1.0.0 2 | 3 | * Removed `dataSerializer` parameter from `BlobRextProxy` constructor. 4 | * Option parameter type of `BlobRestProxy::CreateBlockBlob` and `BlobRestProxy::CreatePageBlobFromContent` changed and added `setUseTransactionalMD5` method. 5 | * Deprecated PHP 5.5 support. -------------------------------------------------------------------------------- /azure-storage-blob/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | This [repository](https://github.com/azure/azure-storage-blob-php) is currently used for releasing only, please go to [azure-storage-php](https://github.com/azure/azure-storage-php) for submitting issues or contribution. -------------------------------------------------------------------------------- /azure-storage-blob/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Microsoft Corporation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /azure-storage-blob/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "microsoft/azure-storage-blob", 3 | "version": "1.5.4", 4 | "description": "This project provides a set of PHP client libraries that make it easy to access Microsoft Azure Storage Blob APIs.", 5 | "keywords": [ "php", "azure", "storage", "sdk", "blob" ], 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "Azure Storage PHP Client Library", 10 | "email": "dmsh@microsoft.com" 11 | } 12 | ], 13 | "require": { 14 | "php": ">=5.6.0", 15 | "microsoft/azure-storage-common": "~1.5" 16 | }, 17 | "autoload": { 18 | "psr-4": { 19 | "MicrosoftAzure\\Storage\\Blob\\": "src/Blob" 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /azure-storage-blob/src/Blob/Models/BlobAccessPolicy.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Blob\Models; 26 | 27 | use MicrosoftAzure\Storage\Blob\Internal\BlobResources; 28 | use MicrosoftAzure\Storage\Common\Models\AccessPolicy; 29 | 30 | /** 31 | * Holds access policy elements 32 | * 33 | * @category Microsoft 34 | * @package MicrosoftAzure\Storage\Blob\Models 35 | * @author Azure Storage PHP SDK 36 | * @copyright 2017 Microsoft Corporation 37 | * @license https://github.com/azure/azure-storage-php/LICENSE 38 | * @link https://github.com/azure/azure-storage-php 39 | */ 40 | class BlobAccessPolicy extends AccessPolicy 41 | { 42 | /** 43 | * Get the valid permissions for the given resource. 44 | * 45 | * @return array 46 | */ 47 | public static function getResourceValidPermissions() 48 | { 49 | return BlobResources::ACCESS_PERMISSIONS[ 50 | BlobResources::RESOURCE_TYPE_BLOB 51 | ]; 52 | } 53 | 54 | /** 55 | * Constructor 56 | */ 57 | public function __construct() 58 | { 59 | parent::__construct(BlobResources::RESOURCE_TYPE_BLOB); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /azure-storage-blob/src/Blob/Models/BlobBlockType.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Blob\Models; 26 | 27 | /** 28 | * Holds available blob block types 29 | * 30 | * @category Microsoft 31 | * @package MicrosoftAzure\Storage\Blob\Models 32 | * @author Azure Storage PHP SDK 33 | * @copyright 2016 Microsoft Corporation 34 | * @license https://github.com/azure/azure-storage-php/LICENSE 35 | * @link https://github.com/azure/azure-storage-php 36 | */ 37 | class BlobBlockType 38 | { 39 | const COMMITTED_TYPE = 'Committed'; 40 | const UNCOMMITTED_TYPE = 'Uncommitted'; 41 | const LATEST_TYPE = 'Latest'; 42 | 43 | /** 44 | * Validates the provided type. 45 | * 46 | * @param string $type The entry type. 47 | * 48 | * @internal 49 | * 50 | * @return boolean 51 | */ 52 | public static function isValid($type) 53 | { 54 | switch ($type) { 55 | case self::COMMITTED_TYPE: 56 | case self::LATEST_TYPE: 57 | case self::UNCOMMITTED_TYPE: 58 | return true; 59 | 60 | default: 61 | return false; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /azure-storage-blob/src/Blob/Models/BlobPrefix.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Blob\Models; 26 | 27 | /** 28 | * Represents BlobPrefix object 29 | * 30 | * @category Microsoft 31 | * @package MicrosoftAzure\Storage\Blob\Models 32 | * @author Azure Storage PHP SDK 33 | * @copyright 2016 Microsoft Corporation 34 | * @license https://github.com/azure/azure-storage-php/LICENSE 35 | * @link https://github.com/azure/azure-storage-php 36 | */ 37 | class BlobPrefix 38 | { 39 | private $_name; 40 | 41 | /** 42 | * Gets blob name. 43 | * 44 | * @return string 45 | */ 46 | public function getName() 47 | { 48 | return $this->_name; 49 | } 50 | 51 | /** 52 | * Sets blob name. 53 | * 54 | * @param string $name value. 55 | * 56 | * @return void 57 | */ 58 | public function setName($name) 59 | { 60 | $this->_name = $name; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /azure-storage-blob/src/Blob/Models/BlobType.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Blob\Models; 26 | 27 | /** 28 | * Encapsulates blob types 29 | * 30 | * @category Microsoft 31 | * @package MicrosoftAzure\Storage\Blob\Models 32 | * @author Azure Storage PHP SDK 33 | * @copyright 2016 Microsoft Corporation 34 | * @license https://github.com/azure/azure-storage-php/LICENSE 35 | * @link https://github.com/azure/azure-storage-php 36 | */ 37 | class BlobType 38 | { 39 | const BLOCK_BLOB = 'BlockBlob'; 40 | const PAGE_BLOB = 'PageBlob'; 41 | const APPEND_BLOB = 'AppendBlob'; 42 | } 43 | -------------------------------------------------------------------------------- /azure-storage-blob/src/Blob/Models/ContainerAccessPolicy.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Blob\Models; 26 | 27 | use MicrosoftAzure\Storage\Blob\Internal\BlobResources; 28 | use MicrosoftAzure\Storage\Common\Models\AccessPolicy; 29 | 30 | /** 31 | * Holds access policy elements 32 | * 33 | * @category Microsoft 34 | * @package MicrosoftAzure\Storage\Blob\Models 35 | * @author Azure Storage PHP SDK 36 | * @copyright 2017 Microsoft Corporation 37 | * @license https://github.com/azure/azure-storage-php/LICENSE 38 | * @link https://github.com/azure/azure-storage-php 39 | */ 40 | class ContainerAccessPolicy extends AccessPolicy 41 | { 42 | /** 43 | * Get the valid permissions for the given resource. 44 | * 45 | * @return array 46 | */ 47 | public static function getResourceValidPermissions() 48 | { 49 | return BlobResources::ACCESS_PERMISSIONS[ 50 | BlobResources::RESOURCE_TYPE_CONTAINER 51 | ]; 52 | } 53 | 54 | /** 55 | * Constructor 56 | */ 57 | public function __construct() 58 | { 59 | parent::__construct(BlobResources::RESOURCE_TYPE_CONTAINER); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /azure-storage-blob/src/Blob/Models/CopyBlobOptions.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Blob\Models; 26 | 27 | /** 28 | * optional parameters for CopyBlobOptions wrapper 29 | * 30 | * @category Microsoft 31 | * @package MicrosoftAzure\Storage\Blob\Models 32 | * @author Azure Storage PHP SDK 33 | * @copyright 2016 Microsoft Corporation 34 | * @license https://github.com/azure/azure-storage-php/LICENSE 35 | * @link https://github.com/azure/azure-storage-php 36 | */ 37 | class CopyBlobOptions extends CopyBlobFromURLOptions 38 | { 39 | private $sourceSnapshot; 40 | 41 | /** 42 | * Gets source snapshot. 43 | * 44 | * @return string 45 | */ 46 | public function getSourceSnapshot() 47 | { 48 | return $this->sourceSnapshot; 49 | } 50 | 51 | /** 52 | * Sets source snapshot. 53 | * 54 | * @param string $sourceSnapshot value. 55 | * 56 | * @return void 57 | */ 58 | public function setSourceSnapshot($sourceSnapshot) 59 | { 60 | $this->sourceSnapshot = $sourceSnapshot; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /azure-storage-blob/src/Blob/Models/CreateBlobPagesOptions.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Blob\Models; 26 | 27 | /** 28 | * Optional parameters for create and clear blob pages 29 | * 30 | * @category Microsoft 31 | * @package MicrosoftAzure\Storage\Blob\Models 32 | * @author Azure Storage PHP SDK 33 | * @copyright 2016 Microsoft Corporation 34 | * @license https://github.com/azure/azure-storage-php/LICENSE 35 | * @link https://github.com/azure/azure-storage-php 36 | */ 37 | class CreateBlobPagesOptions extends BlobServiceOptions 38 | { 39 | private $_contentMD5; 40 | 41 | /** 42 | * Gets blob contentMD5. 43 | * 44 | * @return string 45 | */ 46 | public function getContentMD5() 47 | { 48 | return $this->_contentMD5; 49 | } 50 | 51 | /** 52 | * Sets blob contentMD5. 53 | * 54 | * @param string $contentMD5 value. 55 | * 56 | * @return void 57 | */ 58 | public function setContentMD5($contentMD5) 59 | { 60 | $this->_contentMD5 = $contentMD5; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /azure-storage-blob/src/Blob/Models/CreateBlobSnapshotOptions.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Blob\Models; 26 | 27 | /** 28 | * The optional parameters for createBlobSnapshot wrapper. 29 | * 30 | * @category Microsoft 31 | * @package MicrosoftAzure\Storage\Blob\Models 32 | * @author Azure Storage PHP SDK 33 | * @copyright 2016 Microsoft Corporation 34 | * @license https://github.com/azure/azure-storage-php/LICENSE 35 | * @link https://github.com/azure/azure-storage-php 36 | */ 37 | class CreateBlobSnapshotOptions extends BlobServiceOptions 38 | { 39 | private $_metadata; 40 | 41 | /** 42 | * Gets metadata. 43 | * 44 | * @return array 45 | */ 46 | public function getMetadata() 47 | { 48 | return $this->_metadata; 49 | } 50 | 51 | /** 52 | * Sets metadata. 53 | * 54 | * @param array $metadata The metadata array. 55 | * 56 | * @return void 57 | */ 58 | public function setMetadata(array $metadata) 59 | { 60 | $this->_metadata = $metadata; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /azure-storage-blob/src/Blob/Models/CreateBlockBlobOptions.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2018 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Blob\Models; 26 | 27 | use MicrosoftAzure\Storage\Common\Models\TransactionalMD5Trait; 28 | 29 | /** 30 | * Optional parameters for CreateBlockBlob. 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Blob\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2018 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class CreateBlockBlobOptions extends CreateBlobOptions 40 | { 41 | use TransactionalMD5Trait; 42 | } 43 | -------------------------------------------------------------------------------- /azure-storage-blob/src/Blob/Models/CreatePageBlobFromContentOptions.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2018 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Blob\Models; 26 | 27 | use MicrosoftAzure\Storage\Common\Models\TransactionalMD5Trait; 28 | 29 | /** 30 | * Optional parameters for createPageBlobFromContent. 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Blob\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2018 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class CreatePageBlobFromContentOptions extends CreatePageBlobOptions 40 | { 41 | use TransactionalMD5Trait; 42 | } 43 | -------------------------------------------------------------------------------- /azure-storage-blob/src/Blob/Models/CreatePageBlobOptions.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2018 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Blob\Models; 26 | 27 | /** 28 | * Optional parameters for CreatePageBlob. 29 | * 30 | * @category Microsoft 31 | * @package MicrosoftAzure\Storage\Blob\Models 32 | * @author Azure Storage PHP SDK 33 | * @copyright 2018 Microsoft Corporation 34 | * @license https://github.com/azure/azure-storage-php/LICENSE 35 | * @link https://github.com/azure/azure-storage-php 36 | */ 37 | class CreatePageBlobOptions extends CreateBlobOptions 38 | { 39 | use AccessTierTrait; 40 | } 41 | -------------------------------------------------------------------------------- /azure-storage-blob/src/Blob/Models/GetBlobMetadataOptions.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Blob\Models; 26 | 27 | /** 28 | * Optional parameters for getBlobMetadata wrapper 29 | * 30 | * @category Microsoft 31 | * @package MicrosoftAzure\Storage\Blob\Models 32 | * @author Azure Storage PHP SDK 33 | * @copyright 2016 Microsoft Corporation 34 | * @license https://github.com/azure/azure-storage-php/LICENSE 35 | * @link https://github.com/azure/azure-storage-php 36 | */ 37 | class GetBlobMetadataOptions extends BlobServiceOptions 38 | { 39 | private $_snapshot; 40 | 41 | /** 42 | * Gets blob snapshot. 43 | * 44 | * @return string 45 | */ 46 | public function getSnapshot() 47 | { 48 | return $this->_snapshot; 49 | } 50 | 51 | /** 52 | * Sets blob snapshot. 53 | * 54 | * @param string $snapshot value. 55 | * 56 | * @return void 57 | */ 58 | public function setSnapshot($snapshot) 59 | { 60 | $this->_snapshot = $snapshot; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /azure-storage-blob/src/Blob/Models/GetBlobMetadataResult.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Blob\Models; 26 | 27 | use MicrosoftAzure\Storage\Common\Internal\MetadataTrait; 28 | 29 | /** 30 | * Holds results of calling getBlobMetadata wrapper 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Blob\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2016 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class GetBlobMetadataResult 40 | { 41 | use MetadataTrait; 42 | 43 | /** 44 | * Creates the instance from the parsed headers. 45 | * 46 | * @param array $parsed Parsed headers 47 | * 48 | * @return GetBlobMetadataResult 49 | */ 50 | public static function create(array $parsed) 51 | { 52 | return static::createMetadataResult($parsed); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /azure-storage-blob/src/Blob/Models/GetBlobPropertiesOptions.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Blob\Models; 26 | 27 | /** 28 | * Optional parameters for getBlobProperties wrapper 29 | * 30 | * @category Microsoft 31 | * @package MicrosoftAzure\Storage\Blob\Models 32 | * @author Azure Storage PHP SDK 33 | * @copyright 2016 Microsoft Corporation 34 | * @license https://github.com/azure/azure-storage-php/LICENSE 35 | * @link https://github.com/azure/azure-storage-php 36 | */ 37 | class GetBlobPropertiesOptions extends BlobServiceOptions 38 | { 39 | private $_snapshot; 40 | 41 | /** 42 | * Gets blob snapshot. 43 | * 44 | * @return string 45 | */ 46 | public function getSnapshot() 47 | { 48 | return $this->_snapshot; 49 | } 50 | 51 | /** 52 | * Sets blob snapshot. 53 | * 54 | * @param string $snapshot value. 55 | * 56 | * @return void 57 | */ 58 | public function setSnapshot($snapshot) 59 | { 60 | $this->_snapshot = $snapshot; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /azure-storage-blob/src/Blob/Models/LeaseMode.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Blob\Models; 26 | 27 | /** 28 | * Modes for leasing a blob 29 | * 30 | * @category Microsoft 31 | * @package MicrosoftAzure\Storage\Blob\Models 32 | * @author Azure Storage PHP SDK 33 | * @copyright 2016 Microsoft Corporation 34 | * @license https://github.com/azure/azure-storage-php/LICENSE 35 | * @link https://github.com/azure/azure-storage-php 36 | */ 37 | class LeaseMode 38 | { 39 | const ACQUIRE_ACTION = 'acquire'; 40 | const RENEW_ACTION = 'renew'; 41 | const RELEASE_ACTION = 'release'; 42 | const BREAK_ACTION = 'break'; 43 | const CHANGE_ACTION = 'change'; 44 | } 45 | -------------------------------------------------------------------------------- /azure-storage-blob/src/Blob/Models/PageWriteOption.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Blob\Models; 26 | 27 | /** 28 | * Holds available blob page write options 29 | * 30 | * @category Microsoft 31 | * @package MicrosoftAzure\Storage\Blob\Models 32 | * @author Azure Storage PHP SDK 33 | * @copyright 2016 Microsoft Corporation 34 | * @license https://github.com/azure/azure-storage-php/LICENSE 35 | * @link https://github.com/azure/azure-storage-php 36 | */ 37 | class PageWriteOption 38 | { 39 | const CLEAR_OPTION = 'clear'; 40 | const UPDATE_OPTION = 'update'; 41 | } 42 | -------------------------------------------------------------------------------- /azure-storage-blob/src/Blob/Models/PublicAccessType.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Blob\Models; 26 | 27 | use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources; 28 | 29 | /** 30 | * Holds public access types for a container. 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Blob\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2016 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class PublicAccessType 40 | { 41 | const NONE = null; 42 | const BLOBS_ONLY = 'blob'; 43 | const CONTAINER_AND_BLOBS = 'container'; 44 | 45 | /** 46 | * Validates the public access. 47 | * 48 | * @param string $type The public access type. 49 | * 50 | * @internal 51 | * 52 | * @return boolean 53 | */ 54 | public static function isValid($type) 55 | { 56 | // When $type is null, switch statement will take it 57 | // equal to self::NONE (EMPTY_STRING) 58 | switch ($type) { 59 | case self::NONE: 60 | case self::BLOBS_ONLY: 61 | case self::CONTAINER_AND_BLOBS: 62 | return true; 63 | default: 64 | return false; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /azure-storage-blob/src/Blob/Models/SetBlobTierOptions.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2018 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Blob\Models; 26 | 27 | use MicrosoftAzure\Storage\Common\Models\ServiceOptions; 28 | 29 | /** 30 | * Optional parameters for SetBlobTier. 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Blob\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2018 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class SetBlobTierOptions extends ServiceOptions 40 | { 41 | use AccessTierTrait; 42 | } 43 | -------------------------------------------------------------------------------- /azure-storage-blob/src/Blob/Models/UndeleteBlobOptions.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Blob\Models; 26 | 27 | /** 28 | * Optional parameters for deleteBlob wrapper 29 | * 30 | * @category Microsoft 31 | * @package MicrosoftAzure\Storage\Blob\Models 32 | * @author Azure Storage PHP SDK 33 | * @copyright 2016 Microsoft Corporation 34 | * @license https://github.com/azure/azure-storage-php/LICENSE 35 | * @link https://github.com/azure/azure-storage-php 36 | */ 37 | class UndeleteBlobOptions extends BlobServiceOptions 38 | { 39 | } 40 | -------------------------------------------------------------------------------- /azure-storage-common/BreakingChanges.md: -------------------------------------------------------------------------------- 1 | Tracking Breaking changes in 1.0.0 2 | 3 | * Removed `ServiceBuilder.php`, moved static builder methods into `BlobRestProxy`, `TableRestProxy`, `QueueRestProxy` and `FileRestProxy`. 4 | * Moved method `SharedAccessSignatureHelper::generateBlobServiceSharedAccessSignatureToken()` into `BlobSharedAccessSignatureHelper`. 5 | * Moved method `SharedAccessSignatureHelper::generateTableServiceSharedAccessSignatureToken()` into `TableSharedAccessSignatureHelper`. 6 | * Moved method `SharedAccessSignatureHelper::generateQueueServiceSharedAccessSignatureToken()` into `QueueSharedAccessSignatureHelper`. 7 | * Moved method `SharedAccessSignatureHelper::generateFileServiceSharedAccessSignatureToken()` into `FileSharedAccessSignatureHelper`. 8 | * `CommonMiddleWare` constructor requires storage service version as parameter now. 9 | * `AccessPolicy` class is now an abstract class, added children classes `BlobAccessPolicy`, `ContainerAccessPolicy`, `TableAccessPolicy`, `QueueAccessPolicy`, `FileAccessPolicy` and `ShareAccessPolicy`. 10 | * Deprecated PHP 5.5 support. -------------------------------------------------------------------------------- /azure-storage-common/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | This [repository](https://github.com/azure/azure-storage-common-php) is currently used for releasing only, please go to [azure-storage-php](https://github.com/azure/azure-storage-php) for submitting issues or contribution. -------------------------------------------------------------------------------- /azure-storage-common/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Microsoft Corporation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /azure-storage-common/README.md: -------------------------------------------------------------------------------- 1 | # Microsoft Azure Storage Common PHP Client Library 2 | 3 | This project provides a set of common PHP code shared by Azure Storage Blob, Table, Queue and File PHP client libraries. For how to access Microsoft Azure Storage services (blobs, tables, queues and files), please refer to the [Microsoft Azure Storage PHP Client Library](https://github.com/Azure/azure-storage-php). For documentation on how to host PHP applications on Microsoft Azure, please see the [Microsoft Azure PHP Developer Center](http://www.windowsazure.com/en-us/develop/php/). 4 | 5 | [![Latest Stable Version](https://poser.pugx.org/microsoft/azure-storage-common/v/stable)](https://packagist.org/packages/microsoft/azure-storage-common) 6 | 7 | > **Note** 8 | > 9 | > * This [repository](https://github.com/azure/azure-storage-common-php) is currently used for releasing only, please go to [azure-storage-php](https://github.com/azure/azure-storage-php) for submitting issues or contribution. 10 | -------------------------------------------------------------------------------- /azure-storage-common/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "microsoft/azure-storage-common", 3 | "version": "1.5.2", 4 | "description": "This project provides a set of common code shared by Azure Storage Blob, Table, Queue and File PHP client libraries.", 5 | "keywords": [ "php", "azure", "storage", "sdk", "common" ], 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "Azure Storage PHP Client Library", 10 | "email": "dmsh@microsoft.com" 11 | } 12 | ], 13 | "require": { 14 | "php": ">=5.6.0", 15 | "guzzlehttp/guzzle": "~6.0|^7.0" 16 | }, 17 | "autoload": { 18 | "psr-4": { 19 | "MicrosoftAzure\\Storage\\Common\\": "src/Common" 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /azure-storage-common/src/Common/Exceptions/InvalidArgumentTypeException.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Common\Exceptions; 26 | 27 | use MicrosoftAzure\Storage\Common\Internal\Resources; 28 | 29 | /** 30 | * Exception thrown if an argument type does not match with the expected type. 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Common\Exceptions 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2016 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class InvalidArgumentTypeException extends \InvalidArgumentException 40 | { 41 | /** 42 | * Constructor. 43 | * 44 | * @param string $validType The valid type that should be provided by the user. 45 | * @param string $name The parameter name. 46 | * 47 | * @return InvalidArgumentTypeException 48 | */ 49 | public function __construct($validType, $name = null) 50 | { 51 | parent::__construct( 52 | sprintf(Resources::INVALID_PARAM_MSG, $name, $validType) 53 | ); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /azure-storage-common/src/Common/Internal/Authentication/IAuthScheme.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Common\Internal\Authentication; 26 | 27 | use GuzzleHttp\Psr7\Request; 28 | 29 | /** 30 | * Interface for azure authentication schemes. 31 | * 32 | * @ignore 33 | * @category Microsoft 34 | * @package MicrosoftAzure\Storage\Common\Internal\Authentication 35 | * @author Azure Storage PHP SDK 36 | * @copyright Microsoft Corporation 37 | * @license https://github.com/azure/azure-storage-php/LICENSE 38 | * @link https://github.com/azure/azure-storage-php 39 | */ 40 | interface IAuthScheme 41 | { 42 | /** 43 | * Signs a request. 44 | * 45 | * @param \GuzzleHttp\Psr7\Request $request HTTP request object. 46 | * 47 | * @abstract 48 | * 49 | * @return \GuzzleHttp\Psr7\Request 50 | */ 51 | public function signRequest(Request $request); 52 | } 53 | -------------------------------------------------------------------------------- /azure-storage-common/src/Common/Internal/Http/HttpFormatter.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2016 Microsoft Corporation 20 | * @license https://github.com/azure/azure-storage-php/LICENSE 21 | * @link https://github.com/azure/azure-storage-php 22 | */ 23 | 24 | namespace MicrosoftAzure\Storage\Common\Internal\Http; 25 | 26 | /** 27 | * Helper class to format the http headers 28 | * 29 | * @ignore 30 | * @category Microsoft 31 | * @package MicrosoftAzure\Storage\Common\Internal\Http 32 | * @author Azure Storage PHP SDK 33 | * @copyright 2016 Microsoft Corporation 34 | * @license https://github.com/azure/azure-storage-php/LICENSE 35 | * @link https://github.com/azure/azure-storage-php 36 | */ 37 | class HttpFormatter 38 | { 39 | /** 40 | * Convert a http headers array into an uniformed format for further process 41 | * 42 | * @param array $headers headers for format 43 | * 44 | * @return array 45 | */ 46 | public static function formatHeaders(array $headers) 47 | { 48 | $result = array(); 49 | foreach ($headers as $key => $value) { 50 | if (is_array($value) && count($value) == 1) { 51 | $result[strtolower($key)] = $value[0]; 52 | } else { 53 | $result[strtolower($key)] = $value; 54 | } 55 | } 56 | 57 | return $result; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /azure-storage-common/src/Common/LocationMode.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Common; 26 | 27 | /** 28 | * Location mode for the service. 29 | * 30 | * @category Microsoft 31 | * @package MicrosoftAzure\Storage\Common 32 | * @author Azure Storage PHP SDK 33 | * @copyright 2017 Microsoft Corporation 34 | * @license https://github.com/azure/azure-storage-php/LICENSE 35 | * @link https://github.com/azure/azure-storage-php 36 | */ 37 | class LocationMode 38 | { 39 | //Request will only be sent to primary endpoint, except for 40 | //getServiceStats APIs. 41 | const PRIMARY_ONLY = 'PrimaryOnly'; 42 | 43 | //Request will only be sent to secondary endpoint. 44 | const SECONDARY_ONLY = 'SecondaryOnly'; 45 | 46 | //Request will be sent to primary endpoint first, and retry for secondary 47 | //endpoint. 48 | const PRIMARY_THEN_SECONDARY = 'PrimaryThenSecondary'; 49 | 50 | //Request will be sent to secondary endpoint first, and retry for primary 51 | //endpoint. 52 | const SECONDARY_THEN_PRIMARY = 'SecondaryThenPrimary'; 53 | } 54 | -------------------------------------------------------------------------------- /azure-storage-common/src/Common/Models/TransactionalMD5Trait.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2018 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Common\Models; 26 | 27 | /** 28 | * Trait implementing setting and getting useTransactionalMD5 for 29 | * option classes which need support transactional MD5 validation 30 | * during data transferring. 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Common\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2018 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | trait TransactionalMD5Trait 40 | { 41 | /** @var $useTransactionalMD5 boolean */ 42 | private $useTransactionalMD5; 43 | 44 | /** 45 | * Gets whether using transactional MD5 validation. 46 | * 47 | * @return boolean 48 | */ 49 | public function getUseTransactionalMD5() 50 | { 51 | return $this->useTransactionalMD5; 52 | } 53 | 54 | /** 55 | * Sets whether using transactional MD5 validation. 56 | * 57 | * @param boolean $useTransactionalMD5 whether enable transactional 58 | * MD5 validation. 59 | */ 60 | public function setUseTransactionalMD5($useTransactionalMD5) 61 | { 62 | $this->useTransactionalMD5 = $useTransactionalMD5; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /azure-storage-file/BreakingChanges.md: -------------------------------------------------------------------------------- 1 | Tracking Breaking changes in 1.0.0 2 | 3 | * Removed `dataSerializer` parameter from `FileRextProxy` constructor. 4 | * Option parameter type of `FileRestProxy::CreateFileFromContent` changed and added `setUseTransactionalMD5` method. 5 | * Deprecated PHP 5.5 support. -------------------------------------------------------------------------------- /azure-storage-file/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | This [repository](https://github.com/azure/azure-storage-file-php) is currently used for releasing only, please go to [azure-storage-php](https://github.com/azure/azure-storage-php) for submitting issues or contribution. -------------------------------------------------------------------------------- /azure-storage-file/ChangeLog.md: -------------------------------------------------------------------------------- 1 | 2021.09 - version 1.2.5 2 | * Upgraded dependency for `azure-storage-common` to version 1.5.2. 3 | 4 | 2020.12 - version 1.2.4 5 | * Fixed an issue where 400 is reported for some curl versions. 6 | * Guzzle version is now updated to support both 6.x and 7.x. 7 | 8 | 2020.08 - version 1.2.3 9 | * Lower case query parameter names. 10 | 11 | 2020.01 - version 1.2.2 12 | * Fixed the issue in SAS token where special characters were not correctly encoded. 13 | * Fixed `createFileFromContent` authentication failure when uploading some local file stream types. 14 | * Fixed `createFileFromContent` fail to upload from empty content issue. 15 | 16 | 2019.04 - version 1.2.1 17 | * Resolved some issues on Linux platform. 18 | 19 | 2019.03 - version 1.2.0 20 | * Fixed a bug where file name '0' cannot be created. 21 | * Documentation refinement. 22 | 23 | 2018.04 - version 1.1.0 24 | 25 | * MD files are modified for better readability and formatting. 26 | * CACERT can now be set when creating RestProxies using `$options` parameter. 27 | * Removed unnecessary trailing spaces. 28 | * Assertions are re-factored in test cases. 29 | * Now the test framework uses `PHPUnit\Framework\TestCase` instead of `PHPUnit_Framework_TestCase`. 30 | 31 | 2018.01 - version 1.0.0 32 | 33 | * Created `FileSharedAccessSignatureHelper` and moved method `SharedAccessSignatureHelper::generateFileServiceSharedAccessSignatureToken()` into `FileSharedAccessSignatureHelper`. 34 | * Added static builder methods `createFileService` into `FileRestProxy`. 35 | * Removed `dataSerializer` parameter from `FileRextProxy` constructor. 36 | * Added `setUseTransactionalMD5` method for option of `FileRestProxy::CreateFileFromContent`. Default false, enabling transactional MD5 validation will take more cpu and memory resources. 37 | * Deprecated PHP 5.5 support. -------------------------------------------------------------------------------- /azure-storage-file/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Microsoft Corporation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /azure-storage-file/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "microsoft/azure-storage-file", 3 | "version": "1.2.5", 4 | "description": "This project provides a set of PHP client libraries that make it easy to access Microsoft Azure Storage File APIs.", 5 | "keywords": [ "php", "azure", "storage", "sdk", "file" ], 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "Azure Storage PHP Client Library", 10 | "email": "dmsh@microsoft.com" 11 | } 12 | ], 13 | "require": { 14 | "php": ">=5.6.0", 15 | "microsoft/azure-storage-common": "~1.5" 16 | }, 17 | "autoload": { 18 | "psr-4": { 19 | "MicrosoftAzure\\Storage\\File\\": "src/File" 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /azure-storage-file/src/File/Models/CreateFileFromContentOptions.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2018 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\File\Models; 26 | 27 | use MicrosoftAzure\Storage\Common\Models\TransactionalMD5Trait; 28 | 29 | /** 30 | * Optional parameters for createFileFromContent. 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\File\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2018 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class CreateFileFromContentOptions extends CreateFileOptions 40 | { 41 | use TransactionalMD5Trait; 42 | } 43 | -------------------------------------------------------------------------------- /azure-storage-file/src/File/Models/FileAccessPolicy.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\File\Models; 26 | 27 | use MicrosoftAzure\Storage\Common\Models\AccessPolicy; 28 | use MicrosoftAzure\Storage\File\Internal\FileResources; 29 | 30 | /** 31 | * Holds access policy elements 32 | * 33 | * @category Microsoft 34 | * @package MicrosoftAzure\Storage\File\Models 35 | * @author Azure Storage PHP SDK 36 | * @copyright 2017 Microsoft Corporation 37 | * @license https://github.com/azure/azure-storage-php/LICENSE 38 | * @link https://github.com/azure/azure-storage-php 39 | */ 40 | class FileAccessPolicy extends AccessPolicy 41 | { 42 | /** 43 | * Get the valid permissions for the given resource. 44 | * 45 | * @return array 46 | */ 47 | public static function getResourceValidPermissions() 48 | { 49 | return FileResources::ACCESS_PERMISSIONS[ 50 | FileResources::RESOURCE_TYPE_FILE 51 | ]; 52 | } 53 | 54 | /** 55 | * Constructor 56 | */ 57 | public function __construct() 58 | { 59 | parent::__construct(FileResources::RESOURCE_TYPE_FILE); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /azure-storage-file/src/File/Models/FileServiceOptions.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\File\Models; 26 | 27 | use MicrosoftAzure\Storage\Common\LocationMode; 28 | use MicrosoftAzure\Storage\Common\Models\ServiceOptions; 29 | use MicrosoftAzure\Storage\Common\Internal\Validate; 30 | use MicrosoftAzure\Storage\File\Internal\FileResources as Resources; 31 | 32 | /** 33 | * File service options. 34 | * 35 | * @category Microsoft 36 | * @package MicrosoftAzure\Storage\File\Models 37 | * @author Azure Storage PHP SDK 38 | * @copyright 2017 Microsoft Corporation 39 | * @license https://github.com/azure/azure-storage-php/LICENSE 40 | * @link https://github.com/azure/azure-storage-php 41 | */ 42 | class FileServiceOptions extends ServiceOptions 43 | { 44 | public function setLocationMode($locationMode) 45 | { 46 | Validate::canCastAsString($locationMode, 'locationMode'); 47 | Validate::isTrue( 48 | $locationMode == LocationMode::PRIMARY_ONLY, 49 | Resources::FILE_LOCATION_IS_PRIMARY_ONLY 50 | ); 51 | 52 | $this->locationMode = $locationMode; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /azure-storage-file/src/File/Models/GetDirectoryMetadataResult.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\File\Models; 26 | 27 | use MicrosoftAzure\Storage\Common\Internal\MetadataTrait; 28 | 29 | /** 30 | * Holds result of getDirectoryMetadata. 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\File\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2017 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class GetDirectoryMetadataResult 40 | { 41 | use MetadataTrait; 42 | 43 | /** 44 | * Creates the instance from the parsed headers. 45 | * 46 | * @param array $parsed Parsed headers 47 | * 48 | * @return GetDirectoryMetadataResult 49 | */ 50 | public static function create(array $parsed) 51 | { 52 | return static::createMetadataResult($parsed); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /azure-storage-file/src/File/Models/GetFileMetadataResult.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\File\Models; 26 | 27 | use MicrosoftAzure\Storage\Common\Internal\MetadataTrait; 28 | 29 | /** 30 | * Holds result of getFileMetadata. 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\File\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2017 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class GetFileMetadataResult 40 | { 41 | use MetadataTrait; 42 | 43 | /** 44 | * Creates the instance from the parsed headers. 45 | * 46 | * @param array $parsed Parsed headers 47 | * 48 | * @return GetFileMetadataResult 49 | */ 50 | public static function create(array $parsed) 51 | { 52 | return static::createMetadataResult($parsed); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /azure-storage-file/src/File/Models/PutFileRangeOptions.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\File\Models; 26 | 27 | /** 28 | * Optional parameters for putFileRange. 29 | * 30 | * @category Microsoft 31 | * @package MicrosoftAzure\Storage\File\Models 32 | * @author Azure Storage PHP SDK 33 | * @copyright 2017 Microsoft Corporation 34 | * @license https://github.com/azure/azure-storage-php/LICENSE 35 | * @link https://github.com/azure/azure-storage-php 36 | */ 37 | class PutFileRangeOptions extends FileServiceOptions 38 | { 39 | private $contentMD5; 40 | 41 | /** 42 | * Gets contentMD5. 43 | * 44 | * @return string 45 | */ 46 | public function getContentMD5() 47 | { 48 | return $this->contentMD5; 49 | } 50 | 51 | /** 52 | * Sets contentMD5. 53 | * 54 | * @param string $contentMD5 value. 55 | * 56 | * @return void 57 | */ 58 | public function setContentMD5($contentMD5) 59 | { 60 | $this->contentMD5 = $contentMD5; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /azure-storage-file/src/File/Models/ShareAccessPolicy.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\File\Models; 26 | 27 | use MicrosoftAzure\Storage\Common\Models\AccessPolicy; 28 | use MicrosoftAzure\Storage\File\Internal\FileResources; 29 | 30 | /** 31 | * Holds access policy elements 32 | * 33 | * @category Microsoft 34 | * @package MicrosoftAzure\Storage\File\Models 35 | * @author Azure Storage PHP SDK 36 | * @copyright 2017 Microsoft Corporation 37 | * @license https://github.com/azure/azure-storage-php/LICENSE 38 | * @link https://github.com/azure/azure-storage-php 39 | */ 40 | class ShareAccessPolicy extends AccessPolicy 41 | { 42 | /** 43 | * Get the valid permissions for the given resource. 44 | * 45 | * @return array 46 | */ 47 | public static function getResourceValidPermissions() 48 | { 49 | return FileResources::ACCESS_PERMISSIONS[ 50 | FileResources::RESOURCE_TYPE_SHARE 51 | ]; 52 | } 53 | 54 | /** 55 | * Constructor 56 | */ 57 | public function __construct() 58 | { 59 | parent::__construct(FileResources::RESOURCE_TYPE_SHARE); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /azure-storage-queue/BreakingChanges.md: -------------------------------------------------------------------------------- 1 | Tracking Breaking changes in 1.0.0 2 | 3 | * Removed `dataSerializer` parameter from `QueueRextProxy` constructor. 4 | * Deprecated PHP 5.5 support. -------------------------------------------------------------------------------- /azure-storage-queue/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | This [repository](https://github.com/azure/azure-storage-queue-php) is currently used for releasing only, please go to [azure-storage-php](https://github.com/azure/azure-storage-php) for submitting issues or contribution. -------------------------------------------------------------------------------- /azure-storage-queue/ChangeLog.md: -------------------------------------------------------------------------------- 1 | 2021.09 - version 1.3.4 2 | * Upgraded dependency for `azure-storage-common` to version 1.5.2. 3 | 4 | 2020.12 - version 1.3.3 5 | * Guzzle version is now updated to support both 6.x and 7.x. 6 | 7 | 2020.08 - version 1.3.2 8 | * Lower case query parameter names. 9 | 10 | 2020.01 - version 1.3.1 11 | * Fixed the issue in SAS token where special characters were not correctly encoded. 12 | 13 | 2019.04 - version 1.3.0 14 | * Added support for OAuth authentication. 15 | * Resolved some issues on Linux platform. 16 | 17 | 2019.03 - version 1.2.0 18 | * Documentation refinement. 19 | 20 | 2018.08 - version 1.1.1 21 | 22 | * Fixed a bug in documents that `getMessageId` method should return string instead of integer. 23 | 24 | 2018.04 - version 1.1.0 25 | 26 | * MD files are modified for better readability and formatting. 27 | * CACERT can now be set when creating RestProxies using `$options` parameter. 28 | * Removed unnecessary trailing spaces. 29 | * Assertions are re-factored in test cases. 30 | * Now the test framework uses `PHPUnit\Framework\TestCase` instead of `PHPUnit_Framework_TestCase`. 31 | 32 | 2018.01 - version 1.0.0 33 | 34 | * Created `QueueSharedAccessSignatureHelper` and moved method `SharedAccessSignatureHelper::generateQueueServiceSharedAccessSignatureToken()` into `QueueSharedAccessSignatureHelper`. 35 | * Added static builder methods `createQueueService` into `QueueRestProxy`. 36 | * Removed `dataSerializer` parameter from `QueueRextProxy` constructor. 37 | * Deprecated PHP 5.5 support. -------------------------------------------------------------------------------- /azure-storage-queue/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Microsoft Corporation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /azure-storage-queue/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "microsoft/azure-storage-queue", 3 | "version": "1.3.4", 4 | "description": "This project provides a set of PHP client libraries that make it easy to access Microsoft Azure Storage Queue APIs.", 5 | "keywords": [ "php", "azure", "storage", "sdk", "queue" ], 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "Azure Storage PHP Client Library", 10 | "email": "dmsh@microsoft.com" 11 | } 12 | ], 13 | "require": { 14 | "php": ">=5.6.0", 15 | "microsoft/azure-storage-common": "~1.5" 16 | }, 17 | "autoload": { 18 | "psr-4": { 19 | "MicrosoftAzure\\Storage\\Queue\\": "src/Queue" 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /azure-storage-queue/src/Queue/Models/PeekMessagesOptions.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Queue\Models; 26 | 27 | /** 28 | * Short description 29 | * 30 | * @category Microsoft 31 | * @package MicrosoftAzure\Storage\Queue\Models 32 | * @author Azure Storage PHP SDK 33 | * @copyright 2016 Microsoft Corporation 34 | * @license https://github.com/azure/azure-storage-php/LICENSE 35 | * @link https://github.com/azure/azure-storage-php 36 | */ 37 | class PeekMessagesOptions extends QueueServiceOptions 38 | { 39 | private $_numberOfMessages; 40 | 41 | /** 42 | * Gets numberOfMessages field. 43 | * 44 | * @return integer 45 | */ 46 | public function getNumberOfMessages() 47 | { 48 | return $this->_numberOfMessages; 49 | } 50 | 51 | /** 52 | * Sets numberOfMessages field. 53 | * 54 | * @param integer $numberOfMessages value to use. 55 | * 56 | * @return void 57 | */ 58 | public function setNumberOfMessages($numberOfMessages) 59 | { 60 | $this->_numberOfMessages = $numberOfMessages; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /azure-storage-queue/src/Queue/Models/QueueAccessPolicy.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Queue\Models; 26 | 27 | use MicrosoftAzure\Storage\Common\Models\AccessPolicy; 28 | use MicrosoftAzure\Storage\Queue\Internal\QueueResources; 29 | 30 | /** 31 | * Holds access policy elements 32 | * 33 | * @category Microsoft 34 | * @package MicrosoftAzure\Storage\Queue\Models 35 | * @author Azure Storage PHP SDK 36 | * @copyright 2017 Microsoft Corporation 37 | * @license https://github.com/azure/azure-storage-php/LICENSE 38 | * @link https://github.com/azure/azure-storage-php 39 | */ 40 | class QueueAccessPolicy extends AccessPolicy 41 | { 42 | /** 43 | * Get the valid permissions for the given resource. 44 | * 45 | * @return array 46 | */ 47 | public static function getResourceValidPermissions() 48 | { 49 | return QueueResources::ACCESS_PERMISSIONS[ 50 | QueueResources::RESOURCE_TYPE_QUEUE 51 | ]; 52 | } 53 | 54 | /** 55 | * Constructor 56 | */ 57 | public function __construct() 58 | { 59 | parent::__construct(QueueResources::RESOURCE_TYPE_QUEUE); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /azure-storage-queue/src/Queue/Models/QueueServiceOptions.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Queue\Models; 26 | 27 | use MicrosoftAzure\Storage\Common\Models\ServiceOptions; 28 | 29 | /** 30 | * Queue service options. 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Queue\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2016 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class QueueServiceOptions extends ServiceOptions 40 | { 41 | } 42 | -------------------------------------------------------------------------------- /azure-storage-table/BreakingChanges.md: -------------------------------------------------------------------------------- 1 | Tracking Breaking changes in 1.0.0 2 | 3 | * Removed `dataSerializer` parameter from `TableRextProxy` constructor. 4 | * Will change variable type according to EdmType specified when serializing table entity values. 5 | * Deprecated PHP 5.5 support. -------------------------------------------------------------------------------- /azure-storage-table/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | This [repository](https://github.com/azure/azure-storage-table-php) is currently used for releasing only, please go to [azure-storage-php](https://github.com/azure/azure-storage-php) for submitting issues or contribution. -------------------------------------------------------------------------------- /azure-storage-table/ChangeLog.md: -------------------------------------------------------------------------------- 1 | 2022.08 - version 1.1.6 2 | * Removed EOL from Content-Type header in batch API. 3 | 4 | 2021.09 - version 1.1.5 5 | * Upgraded dependency for `azure-storage-common` to version 1.5.2. 6 | * Fixed a bug where `QueryEnttitiesResult` with a null `NextRowKey` won't work. 7 | * Return integer from a sorting callback, not bool. 8 | 9 | 2020.12 - version 1.1.4 10 | * Guzzle version is now updated to support both 6.x and 7.x. 11 | 12 | 2020.08 - version 1.1.3 13 | * Lower case query parameter names. 14 | 15 | 2020.01 - version 1.1.2 16 | * Fixed the issue in SAS token where special characters were not correctly encoded. 17 | * Empty lines no longer treated as headers in Batch operation. 18 | 19 | 20 | 2019.04 - version 1.1.1 21 | * Resolved some issues on Linux platform. 22 | 23 | 2018.04 - version 1.1.0 24 | 25 | * MD files are modified for better readability and formatting. 26 | * CACERT can now be set when creating RestProxies using `$options` parameter. 27 | * Removed unnecessary trailing spaces. 28 | * Assertions are re-factored in test cases. 29 | * Now the test framework uses `PHPUnit\Framework\TestCase` instead of `PHPUnit_Framework_TestCase`. 30 | 31 | 2018.01 - version 1.0.0 32 | 33 | * Created `TableSharedAccessSignatureHelper` and moved method `SharedAccessSignatureHelper::generateTableServiceSharedAccessSignatureToken()` into `TableSharedAccessSignatureHelper`. 34 | * Added static builder methods `createTableService` into `TableRestProxy`. 35 | * Removed `dataSerializer` parameter from `TableRextProxy` constructor. 36 | * Will change variable type according to EdmType specified when serializing table entity values. 37 | * Deprecated PHP 5.5 support. -------------------------------------------------------------------------------- /azure-storage-table/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Microsoft Corporation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /azure-storage-table/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "microsoft/azure-storage-table", 3 | "version": "1.1.6", 4 | "description": "This project provides a set of PHP client libraries that make it easy to access Microsoft Azure Storage Table APIs.", 5 | "keywords": [ "php", "azure", "storage", "sdk", "table" ], 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "Azure Storage PHP Client Library", 10 | "email": "dmsh@microsoft.com" 11 | } 12 | ], 13 | "require": { 14 | "php": ">=5.6.0", 15 | "microsoft/azure-storage-common": "~1.5" 16 | }, 17 | "autoload": { 18 | "psr-4": { 19 | "MicrosoftAzure\\Storage\\Table\\": "src/Table" 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /azure-storage-table/src/Table/Internal/AcceptOptionTrait.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Table\Internal; 26 | 27 | use MicrosoftAzure\Storage\Table\Models\AcceptJSONContentType; 28 | 29 | /** 30 | * Holds code logic for optional option: Accept 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Table\Internal 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2017 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | trait AcceptOptionTrait 40 | { 41 | private $accept = AcceptJSONContentType::MINIMAL_METADATA; 42 | 43 | /** 44 | * Sets accept content type. 45 | * AcceptableJSONContentType::NO_METADATA 46 | * AcceptableJSONContentType::MINIMAL_METADATA 47 | * AcceptableJSONContentType::FULL_METADATA 48 | * 49 | * @param string $accept The accept content type to be set. 50 | */ 51 | public function setAccept($accept) 52 | { 53 | AcceptJSONContentType::validateAcceptContentType($accept); 54 | $this->accept = $accept; 55 | } 56 | 57 | /** 58 | * Gets accept content type. 59 | * 60 | * @return string 61 | */ 62 | public function getAccept() 63 | { 64 | return $this->accept; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /azure-storage-table/src/Table/Internal/IMimeReaderWriter.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Table\Internal; 26 | 27 | /** 28 | * Interface for MIME reading and writing. 29 | * 30 | * @ignore 31 | * @category Microsoft 32 | * @package MicrosoftAzure\Storage\Table\Internal 33 | * @author Azure Storage PHP SDK 34 | * @copyright 2016 Microsoft Corporation 35 | * @license https://github.com/azure/azure-storage-php/LICENSE 36 | * @link https://github.com/azure/azure-storage-php 37 | */ 38 | interface IMimeReaderWriter 39 | { 40 | /** 41 | * Given array of MIME parts in raw string, this function converts them into MIME 42 | * representation. 43 | * 44 | * @param array $bodyPartContents The MIME body parts. 45 | * 46 | * @return array Returns array with two elements 'headers' and 'body' which 47 | * represents the MIME message. 48 | */ 49 | public function encodeMimeMultipart(array $bodyPartContents); 50 | 51 | /** 52 | * Parses given mime HTTP response body into array. Each array element 53 | * represents a change set result. 54 | * 55 | * @param string $mimeBody The raw MIME body result. 56 | * 57 | * @return array 58 | */ 59 | public function decodeMimeMultipart($mimeBody); 60 | } 61 | -------------------------------------------------------------------------------- /azure-storage-table/src/Table/Models/AcceptJSONContentType.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Table\Models; 26 | 27 | use MicrosoftAzure\Storage\Common\Internal\Validate; 28 | use MicrosoftAzure\Storage\Table\Internal\TableResources as Resources; 29 | 30 | /** 31 | * Holds constant and logic for accept JSON content type. 32 | * 33 | * @category Microsoft 34 | * @package MicrosoftAzure\Storage\Table\Models 35 | * @author Azure Storage PHP SDK 36 | * @copyright 2017 Microsoft Corporation 37 | * @license https://github.com/azure/azure-storage-php/LICENSE 38 | * @link https://github.com/azure/azure-storage-php 39 | */ 40 | class AcceptJSONContentType 41 | { 42 | const NO_METADATA = Resources::JSON_NO_METADATA_CONTENT_TYPE; 43 | const MINIMAL_METADATA = Resources::JSON_MINIMAL_METADATA_CONTENT_TYPE; 44 | const FULL_METADATA = Resources::JSON_FULL_METADATA_CONTENT_TYPE; 45 | 46 | public static function validateAcceptContentType($contentType) 47 | { 48 | Validate::isTrue( 49 | $contentType == self::NO_METADATA || 50 | $contentType == self::MINIMAL_METADATA || 51 | $contentType == self::FULL_METADATA, 52 | Resources::INVALID_ACCEPT_CONTENT_TYPE 53 | ); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /azure-storage-table/src/Table/Models/DeleteEntityOptions.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Table\Models; 26 | 27 | /** 28 | * Holds optional parameters for deleteEntity API. 29 | * 30 | * @category Microsoft 31 | * @package MicrosoftAzure\Storage\Table\Models 32 | * @author Azure Storage PHP SDK 33 | * @copyright 2016 Microsoft Corporation 34 | * @license https://github.com/azure/azure-storage-php/LICENSE 35 | * @link https://github.com/azure/azure-storage-php 36 | */ 37 | class DeleteEntityOptions extends TableServiceOptions 38 | { 39 | private $_etag; 40 | 41 | /** 42 | * Gets entity etag. 43 | * 44 | * @return string 45 | */ 46 | public function getETag() 47 | { 48 | return $this->_etag; 49 | } 50 | 51 | /** 52 | * Sets entity etag. 53 | * 54 | * @param string $etag The entity ETag. 55 | * 56 | * @return void 57 | */ 58 | public function setETag($etag) 59 | { 60 | $this->_etag = $etag; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /azure-storage-table/src/Table/Models/Filters/ConstantFilter.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Table\Models\Filters; 26 | 27 | use MicrosoftAzure\Storage\Table\Models\EdmType; 28 | 29 | /** 30 | * Constant filter 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Table\Models\Filters 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2016 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class ConstantFilter extends Filter 40 | { 41 | private $_value; 42 | private $_edmType; 43 | 44 | /** 45 | * Constructor. 46 | * 47 | * @param string $edmType The EDM type. 48 | * @param string $value The EDM value. 49 | */ 50 | public function __construct($edmType, $value) 51 | { 52 | $this->_edmType = EdmType::processType($edmType); 53 | $this->_value = $value; 54 | } 55 | 56 | /** 57 | * Gets value 58 | * 59 | * @return mixed 60 | */ 61 | public function getValue() 62 | { 63 | return $this->_value; 64 | } 65 | 66 | /** 67 | * Gets the type of the constant. 68 | * 69 | * @return string 70 | */ 71 | public function getEdmType() 72 | { 73 | return $this->_edmType; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /azure-storage-table/src/Table/Models/Filters/PropertyNameFilter.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Table\Models\Filters; 26 | 27 | /** 28 | * Property name filter 29 | * 30 | * @category Microsoft 31 | * @package MicrosoftAzure\Storage\Table\Models\Filters 32 | * @author Azure Storage PHP SDK 33 | * @copyright 2016 Microsoft Corporation 34 | * @license https://github.com/azure/azure-storage-php/LICENSE 35 | * @link https://github.com/azure/azure-storage-php 36 | */ 37 | class PropertyNameFilter extends Filter 38 | { 39 | private $_propertyName; 40 | 41 | /** 42 | * Constructor. 43 | * 44 | * @param string $propertyName The propertyName. 45 | */ 46 | public function __construct($propertyName) 47 | { 48 | $this->_propertyName = $propertyName; 49 | } 50 | 51 | /** 52 | * Gets propertyName 53 | * 54 | * @return string 55 | */ 56 | public function getPropertyName() 57 | { 58 | return $this->_propertyName; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /azure-storage-table/src/Table/Models/Filters/QueryStringFilter.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Table\Models\Filters; 26 | 27 | /** 28 | * Constant filter 29 | * 30 | * @category Microsoft 31 | * @package MicrosoftAzure\Storage\Table\Models\Filters 32 | * @author Azure Storage PHP SDK 33 | * @copyright 2016 Microsoft Corporation 34 | * @license https://github.com/azure/azure-storage-php/LICENSE 35 | * @link https://github.com/azure/azure-storage-php 36 | */ 37 | class QueryStringFilter extends Filter 38 | { 39 | /** 40 | * @var string 41 | */ 42 | private $_queryString; 43 | 44 | /** 45 | * Constructor. 46 | * 47 | * @param string $queryString The OData query string. 48 | */ 49 | public function __construct($queryString) 50 | { 51 | $this->_queryString = $queryString; 52 | } 53 | 54 | 55 | /** 56 | * Gets raw string filter 57 | * 58 | * @return string 59 | */ 60 | public function getQueryString() 61 | { 62 | return $this->_queryString; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /azure-storage-table/src/Table/Models/Filters/UnaryFilter.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Table\Models\Filters; 26 | 27 | /** 28 | * Unary filter 29 | * 30 | * @category Microsoft 31 | * @package MicrosoftAzure\Storage\Table\Models\Filters 32 | * @author Azure Storage PHP SDK 33 | * @copyright 2016 Microsoft Corporation 34 | * @license https://github.com/azure/azure-storage-php/LICENSE 35 | * @link https://github.com/azure/azure-storage-php 36 | */ 37 | class UnaryFilter extends Filter 38 | { 39 | private $_operator; 40 | private $_operand; 41 | 42 | /** 43 | * Constructor. 44 | * 45 | * @param string $operator The operator. 46 | * @param Filter $operand The operand filter. 47 | */ 48 | public function __construct($operator, Filter $operand = null) 49 | { 50 | $this->_operand = $operand; 51 | $this->_operator = $operator; 52 | } 53 | 54 | /** 55 | * Gets operator 56 | * 57 | * @return string 58 | */ 59 | public function getOperator() 60 | { 61 | return $this->_operator; 62 | } 63 | 64 | /** 65 | * Gets operand 66 | * 67 | * @return Filter 68 | */ 69 | public function getOperand() 70 | { 71 | return $this->_operand; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /azure-storage-table/src/Table/Models/GetEntityOptions.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Table\Models; 26 | 27 | use MicrosoftAzure\Storage\Table\Internal\AcceptOptionTrait; 28 | 29 | /** 30 | * Holds optional parameters for getEntity. 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Table\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2017 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class GetEntityOptions extends TableServiceOptions 40 | { 41 | use AcceptOptionTrait; 42 | } 43 | -------------------------------------------------------------------------------- /azure-storage-table/src/Table/Models/GetTableOptions.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Table\Models; 26 | 27 | use MicrosoftAzure\Storage\Table\Internal\AcceptOptionTrait; 28 | 29 | /** 30 | * Holds optional parameters for getTable. 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Table\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2017 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class GetTableOptions extends TableServiceOptions 40 | { 41 | use AcceptOptionTrait; 42 | } 43 | -------------------------------------------------------------------------------- /azure-storage-table/src/Table/Models/TableAccessPolicy.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Table\Models; 26 | 27 | use MicrosoftAzure\Storage\Common\Models\AccessPolicy; 28 | use MicrosoftAzure\Storage\Table\Internal\TableResources; 29 | 30 | /** 31 | * Holds access policy elements 32 | * 33 | * @category Microsoft 34 | * @package MicrosoftAzure\Storage\Table\Models 35 | * @author Azure Storage PHP SDK 36 | * @copyright 2017 Microsoft Corporation 37 | * @license https://github.com/azure/azure-storage-php/LICENSE 38 | * @link https://github.com/azure/azure-storage-php 39 | */ 40 | class TableAccessPolicy extends AccessPolicy 41 | { 42 | /** 43 | * Get the valid permissions for the given resource. 44 | * 45 | * @return array 46 | */ 47 | public static function getResourceValidPermissions() 48 | { 49 | return TableResources::ACCESS_PERMISSIONS[ 50 | TableResources::RESOURCE_TYPE_TABLE 51 | ]; 52 | } 53 | 54 | /** 55 | * Constructor 56 | */ 57 | public function __construct() 58 | { 59 | parent::__construct(TableResources::RESOURCE_TYPE_TABLE); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /azure-storage-table/src/Table/Models/TableServiceOptions.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Table\Models; 26 | 27 | use MicrosoftAzure\Storage\Common\Models\ServiceOptions; 28 | 29 | /** 30 | * Table service options. 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Table\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2016 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class TableServiceOptions extends ServiceOptions 40 | { 41 | } 42 | -------------------------------------------------------------------------------- /build/phpcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Azure Storage SDK for PHP rules 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /build/phpmd.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | Sebastian Bergmann's ruleset 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "microsoft/azure-storage", 3 | "description": "This project provides a set of PHP client libraries that make it easy to access Microsoft Azure storage APIs.", 4 | "keywords": [ "php", "azure", "storage", "sdk" ], 5 | "license": "MIT", 6 | "authors": [ 7 | { 8 | "name": "Azure Storage PHP Client Library", 9 | "email": "dmsh@microsoft.com" 10 | } 11 | ], 12 | "require": { 13 | "php": ">=5.6.0", 14 | "guzzlehttp/guzzle": "~6.0|^7.0" 15 | }, 16 | "require-dev": { 17 | "phpunit/phpunit": "~4.8.35", 18 | "mikey179/vfsstream": "~1.6", 19 | "pdepend/pdepend" : "~2.2", 20 | "sebastian/phpcpd": "~2.0", 21 | "squizlabs/php_codesniffer": "@stable", 22 | "friendsofphp/php-cs-fixer": "@stable", 23 | "phploc/phploc": "~2.1", 24 | "phpmd/phpmd": "@stable", 25 | "phpdocumentor/phpdocumentor": "@stable" 26 | }, 27 | "autoload": { 28 | "psr-4": { 29 | "MicrosoftAzure\\Storage\\Blob\\": "azure-storage-blob/src/Blob", 30 | "MicrosoftAzure\\Storage\\Table\\": "azure-storage-table/src/Table", 31 | "MicrosoftAzure\\Storage\\Queue\\": "azure-storage-queue/src/Queue", 32 | "MicrosoftAzure\\Storage\\File\\": "azure-storage-file/src/File", 33 | "MicrosoftAzure\\Storage\\Common\\": "azure-storage-common/src/Common" 34 | } 35 | }, 36 | "autoload-dev": { 37 | "psr-4": { 38 | "MicrosoftAzure\\Storage\\Tests\\": "tests/" 39 | } 40 | }, 41 | "archive": { 42 | "exclude": ["/tests"] 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /phpdoc.dist.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Windows Azure SDK for PHP 4 | 5 | build/api 6 | 7 | 8 | build/api 9 | 10 | 11 | WindowsAzure/ 12 | 13 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | tests/Unit 12 | 13 | 14 | tests/Functional 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | azure-storage-blob/src 29 | azure-storage-table/src 30 | azure-storage-queue/src 31 | azure-storage-file/src 32 | azure-storage-common/src 33 | 34 | 35 | -------------------------------------------------------------------------------- /tests/Framework/ReflectionTestBase.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | namespace MicrosoftAzure\Storage\Tests\Framework; 25 | 26 | class ReflectionTestBase extends \PHPUnit\Framework\TestCase 27 | { 28 | protected static function getMethod($name, $object) 29 | { 30 | $class = new \ReflectionClass($object); 31 | $method = $class->getMethod($name); 32 | $method->setAccessible(true); 33 | return $method; 34 | } 35 | 36 | protected static function setProperty($name, $object, $value) 37 | { 38 | $reflection = new \ReflectionClass($object); 39 | $reflection_property = $reflection->getProperty($name); 40 | $reflection_property->setAccessible(true); 41 | $reflection_property->setValue($object, $value); 42 | } 43 | 44 | protected static function getProperty($name, $object) 45 | { 46 | $reflection = new \ReflectionClass($object); 47 | $reflection_property = $reflection->getProperty($name); 48 | $reflection_property->setAccessible(true); 49 | return $reflection_property; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /tests/Framework/VirtualFileSystem.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Framework; 26 | 27 | use org\bovigo\vfs\vfsStream; 28 | use org\bovigo\vfs\vfsStreamDirectory; 29 | use org\bovigo\vfs\vfsStreamWrapper; 30 | 31 | /** 32 | * Represents virtual file system for testing purpose. 33 | * 34 | * @category Microsoft 35 | * @package MicrosoftAzure\Storage\Tests\Framework 36 | * @author Azure Storage PHP SDK 37 | * @copyright 2016 Microsoft Corporation 38 | * @license https://github.com/azure/azure-storage-php/LICENSE 39 | * @link https://github.com/azure/azure-storage-php 40 | */ 41 | class VirtualFileSystem 42 | { 43 | public static function newFile($contents, $fileName = null, $root = null) 44 | { 45 | $root = is_null($root) ? 'root' : $root; 46 | $fileName = is_null($fileName) ? 'test.txt' : $fileName; 47 | 48 | vfsStreamWrapper::register(); 49 | vfsStreamWrapper::setRoot(new vfsStreamDirectory($root)); 50 | 51 | $file = vfsStream::newFile($fileName); 52 | $file->setContent($contents); 53 | 54 | vfsStreamWrapper::getRoot()->addChild($file); 55 | $virtualPath = vfsStream::url($root . '/' . $fileName); 56 | 57 | return $virtualPath; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /tests/Functional/Blob/BlobSharedAccessSignatureHelperMock.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Functional\Blob; 26 | 27 | use MicrosoftAzure\Storage\Blob\BlobSharedAccessSignatureHelper; 28 | 29 | /** 30 | * Provides methods to access the account name and key for the 31 | * SharedAccessSignatureHelper. 32 | * 33 | * @category Microsoft 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2017 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class BlobSharedAccessSignatureHelperMock extends BlobSharedAccessSignatureHelper 40 | { 41 | public function getAccountName() 42 | { 43 | return $this->accountName; 44 | } 45 | 46 | public function getAccountKey() 47 | { 48 | return $this->accountKey; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/Functional/Common/SharedAccessSignatureHelperMock.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Functional\Common; 26 | 27 | use MicrosoftAzure\Storage\Common\SharedAccessSignatureHelper; 28 | 29 | /** 30 | * Provides methods to access the account name and key for the 31 | * SharedAccessSignatureHelper. 32 | * 33 | * @category Microsoft 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2017 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class SharedAccessSignatureHelperMock extends SharedAccessSignatureHelper 40 | { 41 | public function getAccountName() 42 | { 43 | return $this->accountName; 44 | } 45 | 46 | public function getAccountKey() 47 | { 48 | return $this->accountKey; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/Functional/File/FileSharedAccessSignatureHelperMock.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Functional\File; 26 | 27 | use MicrosoftAzure\Storage\File\FileSharedAccessSignatureHelper; 28 | 29 | /** 30 | * Provides methods to access the account name and key for the 31 | * SharedAccessSignatureHelper. 32 | * 33 | * @category Microsoft 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2017 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class FileSharedAccessSignatureHelperMock extends FileSharedAccessSignatureHelper 40 | { 41 | public function getAccountName() 42 | { 43 | return $this->accountName; 44 | } 45 | 46 | public function getAccountKey() 47 | { 48 | return $this->accountKey; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/Functional/Queue/IntegrationTestBase.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Functional\Queue; 26 | 27 | use MicrosoftAzure\Storage\Tests\Framework\QueueServiceRestProxyTestBase; 28 | 29 | class IntegrationTestBase extends QueueServiceRestProxyTestBase 30 | { 31 | private static $isOneTimeSetup = false; 32 | 33 | public function setUp() 34 | { 35 | parent::setUp(); 36 | if (!self::$isOneTimeSetup) { 37 | self::$isOneTimeSetup = true; 38 | } 39 | } 40 | 41 | public static function tearDownAfterClass() 42 | { 43 | if (self::$isOneTimeSetup) { 44 | $integrationTestBase = new IntegrationTestBase(); 45 | $integrationTestBase->setUp(); 46 | if (!$integrationTestBase->isEmulated()) { 47 | $serviceProperties = QueueServiceFunctionalTestData::getDefaultServiceProperties(); 48 | $integrationTestBase->restProxy->setServiceProperties($serviceProperties); 49 | } 50 | self::$isOneTimeSetup = false; 51 | } 52 | parent::tearDownAfterClass(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /tests/Functional/Queue/QueueSharedAccessSignatureHelperMock.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Functional\Queue; 26 | 27 | use MicrosoftAzure\Storage\Queue\QueueSharedAccessSignatureHelper; 28 | 29 | /** 30 | * Provides methods to access the account name and key for the 31 | * SharedAccessSignatureHelper. 32 | * 33 | * @category Microsoft 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2017 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class QueueSharedAccessSignatureHelperMock extends QueueSharedAccessSignatureHelper 40 | { 41 | public function getAccountName() 42 | { 43 | return $this->accountName; 44 | } 45 | 46 | public function getAccountKey() 47 | { 48 | return $this->accountKey; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/Functional/Table/Enums/ConcurType.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Functional\Table\Enums; 26 | 27 | class ConcurType 28 | { 29 | const NO_KEY_MATCH = 'NoKeyMatch'; 30 | const KEY_MATCH_NO_ETAG = 'KeyMatchNoETag'; 31 | const KEY_MATCH_ETAG_MISMATCH = 'KeyMatchETagMismatch'; 32 | const KEY_MATCH_ETAG_MATCH = 'KeyMatchETagMatch'; 33 | public static function values() 34 | { 35 | return array('NoKeyMatch', 'KeyMatchNoETag', 'KeyMatchETagMismatch', 'KeyMatchETagMatch'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/Functional/Table/Enums/MutatePivot.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Functional\Table\Enums; 26 | 27 | class MutatePivot 28 | { 29 | const CHANGE_VALUES = 'ChangeValues'; 30 | const ADD_PROPERTY = 'AddProperty'; 31 | const REMOVE_PROPERTY = 'RemoveProperty'; 32 | const NULL_PROPERTY = 'NullProperty'; 33 | public static function values() 34 | { 35 | return array('ChangeValues', 'AddProperty', 'RemoveProperty', 'NullProperty'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/Functional/Table/Enums/OpType.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Functional\Table\Enums; 26 | 27 | class OpType 28 | { 29 | const DELETE_ENTITY = 'deleteEntity'; 30 | const INSERT_ENTITY = 'insertEntity'; 31 | const INSERT_OR_MERGE_ENTITY = 'insertOrMergeEntity'; 32 | const INSERT_OR_REPLACE_ENTITY = 'insertOrReplaceEntity'; 33 | const MERGE_ENTITY = 'mergeEntity'; 34 | const UPDATE_ENTITY = 'updateEntity'; 35 | public static function values() 36 | { 37 | return array('deleteEntity', 'insertEntity', 'insertOrMergeEntity', 'insertOrReplaceEntity', 'mergeEntity', 'updateEntity'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/Functional/Table/IntegrationTestBase.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Functional\Table; 26 | 27 | use MicrosoftAzure\Storage\Tests\Framework\TableServiceRestProxyTestBase; 28 | 29 | class IntegrationTestBase extends TableServiceRestProxyTestBase 30 | { 31 | private static $isOneTimeSetup = false; 32 | 33 | public function setUp() 34 | { 35 | parent::setUp(); 36 | if (!self::$isOneTimeSetup) { 37 | self::$isOneTimeSetup = true; 38 | } 39 | } 40 | 41 | public static function tearDownAfterClass() 42 | { 43 | if (self::$isOneTimeSetup) { 44 | $integrationTestBase = new IntegrationTestBase(); 45 | $integrationTestBase->setUp(); 46 | if (!$integrationTestBase->isEmulated()) { 47 | $serviceProperties = TableServiceFunctionalTestData::getDefaultServiceProperties(); 48 | $integrationTestBase->restProxy->setServiceProperties($serviceProperties); 49 | } 50 | self::$isOneTimeSetup = false; 51 | } 52 | parent::tearDownAfterClass(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /tests/Functional/Table/Models/BatchWorkerConfig.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Functional\Table\Models; 26 | 27 | class BatchWorkerConfig 28 | { 29 | public $opType; 30 | public $concurType; 31 | public $mutatePivot; 32 | public $ent; 33 | public $options; 34 | } 35 | -------------------------------------------------------------------------------- /tests/Functional/Table/Models/FakeTableInfoEntry.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Functional\Table\Models; 26 | 27 | class FakeTableInfoEntry 28 | { 29 | public $TableName; 30 | } 31 | -------------------------------------------------------------------------------- /tests/Functional/Table/TableSharedAccessSignatureHelperMock.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Functional\Table; 26 | 27 | use MicrosoftAzure\Storage\Table\TableSharedAccessSignatureHelper; 28 | 29 | /** 30 | * Provides methods to access the account name and key for the 31 | * SharedAccessSignatureHelper. 32 | * 33 | * @category Microsoft 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2017 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class TableSharedAccessSignatureHelperMock extends TableSharedAccessSignatureHelper 40 | { 41 | public function getAccountName() 42 | { 43 | return $this->accountName; 44 | } 45 | 46 | public function getAccountKey() 47 | { 48 | return $this->accountKey; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/Mock/Common/Internal/Authentication/OAuthSchemeMock.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Mock\Common\Internal\Authentication; 26 | 27 | use MicrosoftAzure\Storage\Common\Internal\Authentication\OAuthScheme; 28 | 29 | /** 30 | * Mock class to wrap OAuthScheme class. 31 | * 32 | * @package WindowsAzure-sdk-for-php 33 | * @author Azure Storage PHP SDK 34 | * @copyright 2016 Microsoft Corporation 35 | * @license https://github.com/azure/azure-storage-php/LICENSE 36 | * @link https://github.com/azure/azure-storage-php 37 | */ 38 | class OAuthSchemeMock extends OAuthScheme 39 | { 40 | public function __construct($accountName, $accountKey, $grantType, $scope, $oauthService) 41 | { 42 | parent::__construct($accountName, $accountKey, $grantType, $scope, $oauthService); 43 | } 44 | 45 | public function getAccountName() 46 | { 47 | return $this->accountName; 48 | } 49 | 50 | public function getAccountKey() 51 | { 52 | return $this->accountKey; 53 | } 54 | 55 | public function getGrantType() 56 | { 57 | return $this->grantType; 58 | } 59 | 60 | public function getScope() 61 | { 62 | return $this->scope; 63 | } 64 | 65 | public function getOAuthService() 66 | { 67 | return $this->oauthService; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /tests/Mock/Common/Internal/Authentication/SharedAccessSignatureAuthSchemeMock.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Mock\Common\Internal\Authentication; 26 | 27 | use MicrosoftAzure\Storage\Common\Internal\Authentication\SharedAccessSignatureAuthScheme; 28 | 29 | /** 30 | * Mock class to wrap SharedAccessSignatureAuthScheme class. 31 | * 32 | * @package WindowsAzure-sdk-for-php 33 | * @author Azure Storage PHP SDK 34 | * @copyright 2016 Microsoft Corporation 35 | * @license https://github.com/azure/azure-storage-php/LICENSE 36 | * @link https://github.com/azure/azure-storage-php 37 | */ 38 | class SharedAccessSignatureAuthSchemeMock extends SharedAccessSignatureAuthScheme 39 | { 40 | public function __construct($sasToken) 41 | { 42 | parent::__construct($sasToken); 43 | } 44 | 45 | public function getSasToken() 46 | { 47 | return $this->sasToken; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /tests/Mock/Table/Internal/Authentication/TableSharedKeyLiteAuthSchemeMock.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Mock\Table\Internal\Authentication; 26 | 27 | use MicrosoftAzure\Storage\Table\Internal\Authentication\TableSharedKeyLiteAuthScheme; 28 | 29 | /** 30 | * Mock class to wrap SharedKeyAuthScheme class. 31 | * 32 | * @package WindowsAzure-sdk-for-php 33 | * @author Azure Storage PHP SDK 34 | * @copyright 2016 Microsoft Corporation 35 | * @license https://github.com/azure/azure-storage-php/LICENSE 36 | * @link https://github.com/azure/azure-storage-php 37 | */ 38 | class TableSharedKeyLiteAuthSchemeMock extends TableSharedKeyLiteAuthScheme 39 | { 40 | public function getIncludedHeaders() 41 | { 42 | return $this->includedHeaders; 43 | } 44 | 45 | public function computeSignatureMock($headers, $url, $queryParams, $httpMethod) 46 | { 47 | return parent::computeSignature($headers, $url, $queryParams, $httpMethod); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /tests/Unit/Blob/Models/BlobBlockTypeTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | namespace MicrosoftAzure\Storage\Tests\Unit\Blob\Models; 25 | 26 | use MicrosoftAzure\Storage\Blob\Models\BlobBlockType; 27 | 28 | /** 29 | * Unit tests for class BlobBlockType 30 | * 31 | * @category Microsoft 32 | * @package MicrosoftAzure\Storage\Tests\Unit\Blob\Models 33 | * @author Azure Storage PHP SDK 34 | * @copyright 2016 Microsoft Corporation 35 | * @license https://github.com/azure/azure-storage-php/LICENSE 36 | * @link https://github.com/azure/azure-storage-php 37 | */ 38 | class BlobBlockTypeTest extends \PHPUnit\Framework\TestCase 39 | { 40 | public function testBlobBlockType() 41 | { 42 | $this->assertEquals(BlobBlockType::COMMITTED_TYPE, 'Committed'); 43 | $this->assertEquals(BlobBlockType::UNCOMMITTED_TYPE, 'Uncommitted'); 44 | $this->assertEquals(BlobBlockType::LATEST_TYPE, 'Latest'); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /tests/Unit/Blob/Models/BlobPolicyTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Unit\Blob\Models; 26 | 27 | use MicrosoftAzure\Storage\Blob\Internal\BlobResources; 28 | use MicrosoftAzure\Storage\Blob\Models\BlobAccessPolicy; 29 | use MicrosoftAzure\Storage\Tests\Unit\Common\Models\AccessPolicyTest; 30 | 31 | /** 32 | * Unit tests for class BlobAccessPolicy 33 | * 34 | * @category Microsoft 35 | * @package MicrosoftAzure\Storage\Tests\Unit\Blob\Models 36 | * @author Azure Storage PHP SDK 37 | * @copyright 2017 Microsoft Corporation 38 | * @license https://github.com/azure/azure-storage-php/LICENSE 39 | * @link https://github.com/azure/azure-storage-php 40 | */ 41 | class BlobAccessPolicyTest extends AccessPolicyTest 42 | { 43 | protected function createAccessPolicy() 44 | { 45 | return new BlobAccessPolicy(); 46 | } 47 | 48 | protected function getResourceType() 49 | { 50 | return BlobResources::RESOURCE_TYPE_BLOB; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /tests/Unit/Blob/Models/BlobPrefixTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | namespace MicrosoftAzure\Storage\Tests\Unit\Blob\Models; 25 | 26 | use MicrosoftAzure\Storage\Blob\Models\BlobPrefix; 27 | use MicrosoftAzure\Storage\Tests\Framework\TestResources; 28 | 29 | /** 30 | * Unit tests for class BlobPrefix 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Tests\Unit\Blob\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2016 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class BlobPrefixTest extends \PHPUnit\Framework\TestCase 40 | { 41 | public function testSetName() 42 | { 43 | // Setup 44 | $blob = new BlobPrefix(); 45 | $expected = TestResources::QUEUE1_NAME; 46 | 47 | // Test 48 | $blob->setName($expected); 49 | 50 | // Assert 51 | $this->assertEquals($expected, $blob->getName()); 52 | } 53 | 54 | public function testGetName() 55 | { 56 | // Setup 57 | $blob = new BlobPrefix(); 58 | $expected = TestResources::QUEUE1_NAME; 59 | $blob->setName($expected); 60 | 61 | // Test 62 | $actual = $blob->getName(); 63 | 64 | // Assert 65 | $this->assertEquals($expected, $actual); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /tests/Unit/Blob/Models/BlobTypeTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | namespace MicrosoftAzure\Storage\Tests\Unit\Blob\Models; 25 | 26 | use MicrosoftAzure\Storage\Blob\Models\BlobType; 27 | 28 | /** 29 | * Unit tests for class BlobType 30 | * 31 | * @category Microsoft 32 | * @package MicrosoftAzure\Storage\Tests\Unit\Blob\Models 33 | * @author Azure Storage PHP SDK 34 | * @copyright 2016 Microsoft Corporation 35 | * @license https://github.com/azure/azure-storage-php/LICENSE 36 | * @link https://github.com/azure/azure-storage-php 37 | */ 38 | class BlobTypeTest extends \PHPUnit\Framework\TestCase 39 | { 40 | public function testBlobType() 41 | { 42 | $this->assertEquals(BlobType::BLOCK_BLOB, 'BlockBlob'); 43 | $this->assertEquals(BlobType::PAGE_BLOB, 'PageBlob'); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /tests/Unit/Blob/Models/BlockTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Unit\Blob\Models; 26 | 27 | use MicrosoftAzure\Storage\Blob\Models\Block; 28 | 29 | /** 30 | * Unit tests for class Block. 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Tests\Unit\Blob\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2016 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class BlockTest extends \PHPUnit\Framework\TestCase 40 | { 41 | public function testSetBlockId() 42 | { 43 | // Setup 44 | $block = new Block(); 45 | $expected = '1234'; 46 | 47 | // Test 48 | $block->setBlockId($expected); 49 | 50 | // Assert 51 | $this->assertEquals($expected, $block->getBlockId()); 52 | } 53 | 54 | public function testSetType() 55 | { 56 | // Setup 57 | $block = new Block(); 58 | $expected = 'BlockType'; 59 | 60 | // Test 61 | $block->setType($expected); 62 | 63 | // Assert 64 | $this->assertEquals($expected, $block->getType()); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /tests/Unit/Blob/Models/BreakLeaseResultTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | namespace MicrosoftAzure\Storage\Tests\Unit\Blob\Models; 25 | 26 | use MicrosoftAzure\Storage\Blob\Models\BreakLeaseResult; 27 | 28 | /** 29 | * Unit tests for class BreakLeaseResult 30 | * 31 | * @category Microsoft 32 | * @package MicrosoftAzure\Storage\Tests\Unit\Blob\Models 33 | * @author Azure Storage PHP SDK 34 | * @copyright 2016 Microsoft Corporation 35 | * @license https://github.com/azure/azure-storage-php/LICENSE 36 | * @link https://github.com/azure/azure-storage-php 37 | */ 38 | class BreakLeaseResultTest extends \PHPUnit\Framework\TestCase 39 | { 40 | public function testCreate() 41 | { 42 | // Setup 43 | $expected = '10'; 44 | $headers = array('x-ms-lease-time' => $expected); 45 | 46 | // Test 47 | $result = BreakLeaseResult::create($headers); 48 | 49 | // Assert 50 | $this->assertEquals($expected, $result->getLeaseTime()); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /tests/Unit/Blob/Models/ContainerPolicyTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Unit\Blob\Models; 26 | 27 | use MicrosoftAzure\Storage\Blob\Internal\BlobResources; 28 | use MicrosoftAzure\Storage\Blob\Models\ContainerAccessPolicy; 29 | use MicrosoftAzure\Storage\Tests\Unit\Common\Models\AccessPolicyTest; 30 | 31 | /** 32 | * Unit tests for class ContainerAccessPolicy 33 | * 34 | * @category Microsoft 35 | * @package MicrosoftAzure\Storage\Tests\Unit\Blob\Models 36 | * @author Azure Storage PHP SDK 37 | * @copyright 2017 Microsoft Corporation 38 | * @license https://github.com/azure/azure-storage-php/LICENSE 39 | * @link https://github.com/azure/azure-storage-php 40 | */ 41 | class ContainerAccessPolicyTest extends AccessPolicyTest 42 | { 43 | protected function createAccessPolicy() 44 | { 45 | return new ContainerAccessPolicy(); 46 | } 47 | 48 | protected function getResourceType() 49 | { 50 | return BlobResources::RESOURCE_TYPE_CONTAINER; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /tests/Unit/Blob/Models/LeaseModeTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | namespace MicrosoftAzure\Storage\Tests\Unit\Blob\Models; 25 | 26 | use MicrosoftAzure\Storage\Blob\Models\LeaseMode; 27 | 28 | /** 29 | * Unit tests for class LeaseMode 30 | * 31 | * @category Microsoft 32 | * @package MicrosoftAzure\Storage\Tests\Unit\Blob\Models 33 | * @author Azure Storage PHP SDK 34 | * @copyright 2016 Microsoft Corporation 35 | * @license https://github.com/azure/azure-storage-php/LICENSE 36 | * @link https://github.com/azure/azure-storage-php 37 | */ 38 | class LeaseModeTest extends \PHPUnit\Framework\TestCase 39 | { 40 | public function testLeaseMode() 41 | { 42 | $this->assertEquals(LeaseMode::ACQUIRE_ACTION, 'acquire'); 43 | $this->assertEquals(LeaseMode::BREAK_ACTION, 'break'); 44 | $this->assertEquals(LeaseMode::RELEASE_ACTION, 'release'); 45 | $this->assertEquals(LeaseMode::RENEW_ACTION, 'renew'); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/Unit/Blob/Models/LeaseResultTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | namespace MicrosoftAzure\Storage\Tests\Unit\Blob\Models; 25 | 26 | use MicrosoftAzure\Storage\Blob\Models\LeaseResult; 27 | 28 | /** 29 | * Unit tests for class LeaseResult 30 | * 31 | * @category Microsoft 32 | * @package MicrosoftAzure\Storage\Tests\Unit\Blob\Models 33 | * @author Azure Storage PHP SDK 34 | * @copyright 2016 Microsoft Corporation 35 | * @license https://github.com/azure/azure-storage-php/LICENSE 36 | * @link https://github.com/azure/azure-storage-php 37 | */ 38 | class LeaseResultTest extends \PHPUnit\Framework\TestCase 39 | { 40 | public function testCreate() 41 | { 42 | // Setup 43 | $expected = '0x8CAFB82EFF70C46'; 44 | $headers = array('x-ms-lease-id' => $expected); 45 | 46 | // Test 47 | $result = LeaseResult::create($headers); 48 | 49 | // Assert 50 | $this->assertEquals($expected, $result->getLeaseId()); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /tests/Unit/Blob/Models/PublicAccessTypeTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | namespace MicrosoftAzure\Storage\Tests\Unit\Blob\Models; 25 | 26 | use MicrosoftAzure\Storage\Blob\Models\PublicAccessType; 27 | use MicrosoftAzure\Storage\Common\Internal\Resources; 28 | 29 | /** 30 | * Unit tests for class PublicAccessType 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Tests\Unit\Blob\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2016 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class PublicAccessTypeTest extends \PHPUnit\Framework\TestCase 40 | { 41 | public function testPublicAccessType() 42 | { 43 | $this->assertEquals(PublicAccessType::BLOBS_ONLY, 'blob'); 44 | $this->assertEquals(PublicAccessType::CONTAINER_AND_BLOBS, 'container'); 45 | $this->assertEquals(PublicAccessType::NONE, Resources::EMPTY_STRING); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/Unit/Blob/Models/PutBlockResultTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | namespace MicrosoftAzure\Storage\Tests\Unit\Blob\Models; 25 | 26 | use MicrosoftAzure\Storage\Common\Internal\Utilities; 27 | use MicrosoftAzure\Storage\Tests\Framework\TestResources; 28 | use MicrosoftAzure\Storage\Blob\Models\PutBlockResult; 29 | 30 | /** 31 | * Unit tests for class PutBlockResult 32 | * 33 | * @category Microsoft 34 | * @package MicrosoftAzure\Storage\Tests\Unit\Blob\Models 35 | * @author Azure Storage PHP SDK 36 | * @copyright 2016 Microsoft Corporation 37 | * @license https://github.com/azure/azure-storage-php/LICENSE 38 | * @link https://github.com/azure/azure-storage-php 39 | */ 40 | class PutBlockResultTest extends \PHPUnit\Framework\TestCase 41 | { 42 | public function testCreate() 43 | { 44 | // Setup 45 | $sample = TestResources::listBlobsOneEntry(); 46 | $expected = $sample['Blobs']['Blob']['Properties']; 47 | 48 | // Test 49 | $actual = PutBlockResult::create($expected); 50 | 51 | // Assert 52 | $this->assertEquals($expected['Content-MD5'], $actual->getContentMD5()); 53 | $this->assertEquals(Utilities::toBoolean($expected['x-ms-request-server-encrypted']), $actual->getRequestServerEncrypted()); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /tests/Unit/Common/Internal/InvalidArgumentTypeExceptionTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Unit\Common\Internal; 26 | 27 | use MicrosoftAzure\Storage\Common\Exceptions\InvalidArgumentTypeException; 28 | 29 | /** 30 | * Unit tests for class InvalidArgumentTypeException 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Tests\Unit\Common\Internal 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2016 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class InvalidArgumentTypeExceptionTest extends \PHPUnit\Framework\TestCase 40 | { 41 | public function testConstruct() 42 | { 43 | $e = new InvalidArgumentTypeException('string'); 44 | 45 | $this->assertTrue(isset($e)); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/Unit/Common/Internal/Serialization/DummyClass.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Unit\Common\Internal\Serialization; 26 | 27 | use MicrosoftAzure\Storage\Tests\Framework\TestResources; 28 | use MicrosoftAzure\Storage\Common\Internal\Serialization\XmlSerializer; 29 | use MicrosoftAzure\Storage\Common\Models\ServiceProperties; 30 | 31 | /** 32 | * Dummy class for Xml Serializer. 33 | * 34 | * @category Microsoft 35 | * @package MicrosoftAzure\Storage\Tests\Unit\Common\Internal\Serialization 36 | * @author Azure Storage PHP SDK 37 | * @copyright 2016 Microsoft Corporation 38 | * @license https://github.com/azure/azure-storage-php/LICENSE 39 | * @link https://github.com/azure/azure-storage-php 40 | */ 41 | class DummyClass 42 | { 43 | private $_attributes; 44 | 45 | public function __construct() 46 | { 47 | $this->_attributes = array(); 48 | } 49 | 50 | public function addAttribute($attributeKey, $attributeValue) 51 | { 52 | $this->_attributes[$attributeKey] = $attributeValue; 53 | } 54 | 55 | public function getAttributes() 56 | { 57 | return $this->_attributes; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /tests/Unit/Common/Internal/ServiceOptionsTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Unit\Common; 26 | 27 | use MicrosoftAzure\Storage\Common\Models\ServiceOptions; 28 | 29 | /** 30 | * Unit tests for class ServiceOptions 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Tests\Unit\Common\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2016 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class ServiceOptionsTest extends \PHPUnit\Framework\TestCase 40 | { 41 | public function testSetGetTimeout() 42 | { 43 | // Setup 44 | $options = new ServiceOptions(); 45 | $value = 10; 46 | 47 | // Test 48 | $options->setTimeout($value); 49 | 50 | // Assert 51 | $this->assertEquals($value, $options->getTimeout()); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /tests/Unit/Common/Models/GetServicePropertiesResultTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Unit\Common\Models; 26 | 27 | use MicrosoftAzure\Storage\Common\Models\GetServicePropertiesResult; 28 | use MicrosoftAzure\Storage\Common\Models\ServiceProperties; 29 | use MicrosoftAzure\Storage\Tests\Framework\TestResources; 30 | 31 | /** 32 | * Unit tests for class GetServicePropertiesResult 33 | * 34 | * @category Microsoft 35 | * @package MicrosoftAzure\Storage\Tests\Unit\Common\Models 36 | * @author Azure Storage PHP SDK 37 | * @copyright 2016 Microsoft Corporation 38 | * @license https://github.com/azure/azure-storage-php/LICENSE 39 | * @link https://github.com/azure/azure-storage-php 40 | */ 41 | class GetServicePropertiesResultTest extends \PHPUnit\Framework\TestCase 42 | { 43 | public function testCreate() 44 | { 45 | // Test 46 | $result = GetServicePropertiesResult::create(TestResources::getServicePropertiesSample()); 47 | $expected = ServiceProperties::create(TestResources::getServicePropertiesSample()); 48 | 49 | // Assert 50 | $this->assertTrue(isset($result)); 51 | $this->assertEquals($expected, $result->getValue()); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /tests/Unit/File/Models/FilePolicyTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Unit\File\Models; 26 | 27 | use MicrosoftAzure\Storage\File\Internal\FileResources; 28 | use MicrosoftAzure\Storage\File\Models\FileAccessPolicy; 29 | use MicrosoftAzure\Storage\Tests\Unit\Common\Models\AccessPolicyTest; 30 | 31 | /** 32 | * Unit tests for class FileAccessPolicy 33 | * 34 | * @category Microsoft 35 | * @package MicrosoftAzure\Storage\Tests\Unit\File\Models 36 | * @author Azure Storage PHP SDK 37 | * @copyright 2017 Microsoft Corporation 38 | * @license https://github.com/azure/azure-storage-php/LICENSE 39 | * @link https://github.com/azure/azure-storage-php 40 | */ 41 | class FileAccessPolicyTest extends AccessPolicyTest 42 | { 43 | protected function createAccessPolicy() 44 | { 45 | return new FileAccessPolicy(); 46 | } 47 | 48 | protected function getResourceType() 49 | { 50 | return FileResources::RESOURCE_TYPE_FILE; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /tests/Unit/File/Models/SharePolicyTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Unit\File\Models; 26 | 27 | use MicrosoftAzure\Storage\File\Internal\FileResources; 28 | use MicrosoftAzure\Storage\File\Models\ShareAccessPolicy; 29 | use MicrosoftAzure\Storage\Tests\Unit\Common\Models\AccessPolicyTest; 30 | 31 | /** 32 | * Unit tests for class ShareAccessPolicy 33 | * 34 | * @category Microsoft 35 | * @package MicrosoftAzure\Storage\Tests\Unit\File\Models 36 | * @author Azure Storage PHP SDK 37 | * @copyright 2017 Microsoft Corporation 38 | * @license https://github.com/azure/azure-storage-php/LICENSE 39 | * @link https://github.com/azure/azure-storage-php 40 | */ 41 | class ShareAccessPolicyTest extends AccessPolicyTest 42 | { 43 | protected function createAccessPolicy() 44 | { 45 | return new ShareAccessPolicy(); 46 | } 47 | 48 | protected function getResourceType() 49 | { 50 | return FileResources::RESOURCE_TYPE_SHARE; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /tests/Unit/Queue/Models/GetQueueMetadataResultTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Unit\Queue\Models; 26 | 27 | use MicrosoftAzure\Storage\Queue\Models\GetQueueMetadataResult; 28 | 29 | /** 30 | * Unit tests for class GetQueueMetadataResult 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Tests\Unit\Queue\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2016 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class GetQueueMetadataResultTest extends \PHPUnit\Framework\TestCase 40 | { 41 | public function testConstruct() 42 | { 43 | // Setup 44 | $count = 10; 45 | $metadata = array('key1' => 'value1', 'key2' => 'value2'); 46 | 47 | // Test 48 | $actual = new GetQueueMetadataResult($count, $metadata); 49 | 50 | // Assert 51 | $this->assertEquals($count, $actual->getApproximateMessageCount()); 52 | $this->assertEquals($metadata, $actual->getMetadata()); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /tests/Unit/Queue/Models/QueuePolicyTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Unit\Queue\Models; 26 | 27 | use MicrosoftAzure\Storage\Queue\Internal\QueueResources; 28 | use MicrosoftAzure\Storage\Queue\Models\QueueAccessPolicy; 29 | use MicrosoftAzure\Storage\Tests\Unit\Common\Models\AccessPolicyTest; 30 | 31 | /** 32 | * Unit tests for class QueueAccessPolicy 33 | * 34 | * @category Microsoft 35 | * @package MicrosoftAzure\Storage\Tests\Unit\Queue\Models 36 | * @author Azure Storage PHP SDK 37 | * @copyright 2017 Microsoft Corporation 38 | * @license https://github.com/azure/azure-storage-php/LICENSE 39 | * @link https://github.com/azure/azure-storage-php 40 | */ 41 | class QueueAccessPolicyTest extends AccessPolicyTest 42 | { 43 | protected function createAccessPolicy() 44 | { 45 | return new QueueAccessPolicy(); 46 | } 47 | 48 | protected function getResourceType() 49 | { 50 | return QueueResources::RESOURCE_TYPE_QUEUE; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /tests/Unit/Table/Models/BatchOperationParameterNameTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Unit\Table\Models; 26 | 27 | use MicrosoftAzure\Storage\Table\Models\BatchOperationParameterName; 28 | 29 | /** 30 | * Unit tests for class BatchOperationParameterName 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Tests\Unit\Table\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2016 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class BatchOperationParameterNameTest extends \PHPUnit\Framework\TestCase 40 | { 41 | public function testIsValid() 42 | { 43 | // Setup 44 | $name = BatchOperationParameterName::BP_ETAG; 45 | 46 | // Test 47 | $actual = BatchOperationParameterName::isValid($name); 48 | 49 | // Assert 50 | $this->assertTrue($actual); 51 | } 52 | 53 | public function testIsValidWithInvalid() 54 | { 55 | // Setup 56 | $name = 'zeta el senen'; 57 | 58 | // Test 59 | $actual = BatchOperationParameterName::isValid($name); 60 | 61 | // Assert 62 | $this->assertFalse($actual); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /tests/Unit/Table/Models/BatchOperationTypeTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Unit\Table\Models; 26 | 27 | use MicrosoftAzure\Storage\Table\Models\BatchOperationType; 28 | 29 | /** 30 | * Unit tests for class BatchOperationType 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Tests\Unit\Table\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2016 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class BatchOperationTypeTest extends \PHPUnit\Framework\TestCase 40 | { 41 | public function testIsValid() 42 | { 43 | // Setup 44 | $name = BatchOperationType::DELETE_ENTITY_OPERATION; 45 | 46 | // Test 47 | $actual = BatchOperationType::isValid($name); 48 | 49 | // Assert 50 | $this->assertTrue($actual); 51 | } 52 | 53 | public function testIsValidWithInvalid() 54 | { 55 | // Setup 56 | $name = 'zeta el senen'; 57 | 58 | // Test 59 | $actual = BatchOperationType::isValid($name); 60 | 61 | // Assert 62 | $this->assertFalse($actual); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /tests/Unit/Table/Models/DeleteEntityOptionsTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | namespace MicrosoftAzure\Storage\Tests\Unit\Table\Models; 25 | 26 | use MicrosoftAzure\Storage\Table\Models\DeleteEntityOptions; 27 | use MicrosoftAzure\Storage\Table\Models\ETag; 28 | 29 | /** 30 | * Unit tests for class DeleteEntityOptions 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Tests\Unit\Table\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2016 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class DeleteEntityOptionsTest extends \PHPUnit\Framework\TestCase 40 | { 41 | public function testSetETag() 42 | { 43 | // Setup 44 | $options = new DeleteEntityOptions(); 45 | $ETag = 'etag value'; 46 | 47 | // Test 48 | $options->setETag($ETag); 49 | 50 | // Assert 51 | $this->assertEquals($ETag, $options->getETag()); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /tests/Unit/Table/Models/Filters/ConstantFilterTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Unit\Table\Models\Filters; 26 | 27 | use MicrosoftAzure\Storage\Table\Models\Filters\ConstantFilter; 28 | use MicrosoftAzure\Storage\Table\Models\EdmType; 29 | 30 | /** 31 | * Unit tests for class ConstantFilter 32 | * 33 | * @category Microsoft 34 | * @package MicrosoftAzure\Storage\Tests\Unit\Table\Models\Filters 35 | * @author Azure Storage PHP SDK 36 | * @copyright 2016 Microsoft Corporation 37 | * @license https://github.com/azure/azure-storage-php/LICENSE 38 | * @link https://github.com/azure/azure-storage-php 39 | */ 40 | class ConstantFilterTest extends \PHPUnit\Framework\TestCase 41 | { 42 | public function testGetValue() 43 | { 44 | // Setup 45 | $expected = 'x'; 46 | $filter = new ConstantFilter(null, $expected); 47 | 48 | // Assert 49 | $this->assertEquals($expected, $filter->getValue()); 50 | } 51 | 52 | public function testGetEdmType() 53 | { 54 | // Setup 55 | $expected = EdmType::BINARY; 56 | $filter = new ConstantFilter($expected, '1234'); 57 | 58 | // Assert 59 | $this->assertEquals($expected, $filter->getEdmType()); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /tests/Unit/Table/Models/Filters/PropertyNameFilterTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Unit\Table\Models\Filters; 26 | 27 | use MicrosoftAzure\Storage\Table\Models\Filters\PropertyNameFilter; 28 | 29 | /** 30 | * Unit tests for class PropertyNameFilter 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Tests\Unit\Table\Models\Filters 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2016 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class PropertyNameFilterTest extends \PHPUnit\Framework\TestCase 40 | { 41 | public function testGetPropertyName() 42 | { 43 | // Setup 44 | $expected = 'x'; 45 | $filter = new PropertyNameFilter($expected); 46 | 47 | // Assert 48 | $this->assertEquals($expected, $filter->getPropertyName()); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/Unit/Table/Models/Filters/QueryStringFilterTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Unit\Table\Models\Filters; 26 | 27 | use MicrosoftAzure\Storage\Table\Models\Filters\QueryStringFilter; 28 | 29 | /** 30 | * Unit tests for class QueryStringFilter 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Tests\Unit\Table\Models\Filters 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2016 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class QueryStringFilterTest extends \PHPUnit\Framework\TestCase 40 | { 41 | public function testGetQueryString() 42 | { 43 | // Setup 44 | $expected = 'x'; 45 | $filter = new QueryStringFilter($expected); 46 | 47 | // Assert 48 | $this->assertEquals($expected, $filter->getQueryString()); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/Unit/Table/Models/Filters/UnaryFilterTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Unit\Table\Models\Filters; 26 | 27 | use MicrosoftAzure\Storage\Table\Models\Filters\UnaryFilter; 28 | 29 | /** 30 | * Unit tests for class UnaryFilter 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Tests\Unit\Table\Models\Filters 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2016 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class UnaryFilterTest extends \PHPUnit\Framework\TestCase 40 | { 41 | public function testGetOperator() 42 | { 43 | // Setup 44 | $expected = 'x'; 45 | $filter = new UnaryFilter($expected, null); 46 | 47 | // Assert 48 | $this->assertEquals($expected, $filter->getOperator()); 49 | } 50 | 51 | public function testGetOperand() 52 | { 53 | // Setup 54 | $expected = null; 55 | $filter = new UnaryFilter(null, $expected); 56 | 57 | // Assert 58 | $this->assertEquals($expected, $filter->getOperand()); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /tests/Unit/Table/Models/GetEntityResultTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | namespace MicrosoftAzure\Storage\Tests\Unit\Table\Models; 25 | 26 | use MicrosoftAzure\Storage\Table\Models\GetEntityResult; 27 | use MicrosoftAzure\Storage\Table\Internal\JsonODataReaderWriter; 28 | use MicrosoftAzure\Storage\Table\Models\Entity; 29 | use MicrosoftAzure\Storage\Tests\Framework\TestResources; 30 | 31 | /** 32 | * Unit tests for class GetEntityResult 33 | * 34 | * @category Microsoft 35 | * @package MicrosoftAzure\Storage\Tests\Unit\Table\Models 36 | * @author Azure Storage PHP SDK 37 | * @copyright 2016 Microsoft Corporation 38 | * @license https://github.com/azure/azure-storage-php/LICENSE 39 | * @link https://github.com/azure/azure-storage-php 40 | */ 41 | class GetEntityResultTest extends \PHPUnit\Framework\TestCase 42 | { 43 | public function testCreate() 44 | { 45 | // Setup 46 | $sampleBody = TestResources::getEntitySampleBody(); 47 | $serializer = new JsonODataReaderWriter(); 48 | 49 | // Test 50 | $result = GetEntityResult::create($sampleBody, $serializer); 51 | 52 | // Assert 53 | $this->assertEquals( 54 | $serializer->parseEntity($sampleBody), 55 | $result->getEntity() 56 | ); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /tests/Unit/Table/Models/GetTableResultTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | namespace MicrosoftAzure\Storage\Tests\Unit\Table\Models; 25 | 26 | use MicrosoftAzure\Storage\Table\Models\GetTableResult; 27 | use MicrosoftAzure\Storage\Table\Internal\JsonODataReaderWriter; 28 | use MicrosoftAzure\Storage\Tests\Framework\TestResources; 29 | 30 | /** 31 | * Unit tests for class GetTableResult 32 | * 33 | * @category Microsoft 34 | * @package MicrosoftAzure\Storage\Tests\Unit\Table\Models 35 | * @author Azure Storage PHP SDK 36 | * @copyright 2016 Microsoft Corporation 37 | * @license https://github.com/azure/azure-storage-php/LICENSE 38 | * @link https://github.com/azure/azure-storage-php 39 | */ 40 | class GetTableResultTest extends \PHPUnit\Framework\TestCase 41 | { 42 | public function testCreate() 43 | { 44 | // Setup 45 | $sampleBody = TestResources::getTableSampleBody(); 46 | $serializer = new JsonODataReaderWriter(); 47 | 48 | // Test 49 | $result = GetTableResult::create($sampleBody, $serializer); 50 | 51 | // Assert 52 | $this->assertEquals($serializer->parseTable($sampleBody), $result->getName()); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /tests/Unit/Table/Models/PropertyTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | namespace MicrosoftAzure\Storage\Tests\Unit\Table\Models; 25 | 26 | use MicrosoftAzure\Storage\Table\Models\Property; 27 | use MicrosoftAzure\Storage\Table\Models\EdmType; 28 | 29 | /** 30 | * Unit tests for class Property 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Tests\Unit\Table\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2016 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class PropertyTest extends \PHPUnit\Framework\TestCase 40 | { 41 | public function testSetEdmType() 42 | { 43 | // Setup 44 | $pro = new Property(); 45 | $expected = EdmType::BINARY; 46 | 47 | // Test 48 | $pro->setEdmType($expected); 49 | 50 | // Assert 51 | $this->assertEquals($expected, $pro->getEdmType()); 52 | } 53 | 54 | public function testSetValue() 55 | { 56 | // Setup 57 | $pro = new Property(); 58 | $expected = 'wal3a'; 59 | 60 | // Test 61 | $pro->setValue($expected); 62 | 63 | // Assert 64 | $this->assertEquals($expected, $pro->getValue()); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /tests/Unit/Table/Models/QueryEntitiesResultTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | namespace MicrosoftAzure\Storage\Tests\Unit\Table\Models; 25 | 26 | use MicrosoftAzure\Storage\Table\Models\QueryEntitiesResult; 27 | 28 | /** 29 | * Unit tests for class QueryEntitiesResult 30 | * 31 | * @category Microsoft 32 | * @package MicrosoftAzure\Storage\Tests\Unit\Table\Models 33 | * @author Azure Storage PHP SDK 34 | * @copyright 2016 Microsoft Corporation 35 | * @license https://github.com/azure/azure-storage-php/LICENSE 36 | * @link https://github.com/azure/azure-storage-php 37 | */ 38 | class QueryEntitiesResultTest extends \PHPUnit\Framework\TestCase 39 | { 40 | public function testCreate() 41 | { 42 | // Test 43 | $result = QueryEntitiesResult::create(array(), array()); 44 | 45 | // Assert 46 | $this->assertCount(0, $result->getEntities()); 47 | $this->assertNull($result->getNextPartitionKey()); 48 | $this->assertNull($result->getNextRowKey()); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/Unit/Table/Models/QueryTablesResultTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Unit\Table\Models; 26 | 27 | use MicrosoftAzure\Storage\Table\Models\QueryTablesResult; 28 | 29 | /** 30 | * Unit tests for class QueryTablesResult 31 | * 32 | * @category Microsoft 33 | * @package MicrosoftAzure\Storage\Tests\Unit\Table\Models 34 | * @author Azure Storage PHP SDK 35 | * @copyright 2016 Microsoft Corporation 36 | * @license https://github.com/azure/azure-storage-php/LICENSE 37 | * @link https://github.com/azure/azure-storage-php 38 | */ 39 | class QueryTablesResultTest extends \PHPUnit\Framework\TestCase 40 | { 41 | public function testCreate() 42 | { 43 | // Setup 44 | $entries = array('querytablessimple1', 'querytablessimple2'); 45 | $headers = array('x-ms-continuation-nexttablename' => 'nextTable'); 46 | 47 | // Test 48 | $result = QueryTablesResult::create($headers, $entries); 49 | 50 | // Assert 51 | $this->assertEquals($entries, $result->getTables()); 52 | $this->assertEquals($headers['x-ms-continuation-nexttablename'], $result->getNextTableName()); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /tests/Unit/Table/Models/TablePolicyTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2017 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | 25 | namespace MicrosoftAzure\Storage\Tests\Unit\Table\Models; 26 | 27 | use MicrosoftAzure\Storage\Table\Internal\TableResources; 28 | use MicrosoftAzure\Storage\Table\Models\TableAccessPolicy; 29 | use MicrosoftAzure\Storage\Tests\Unit\Common\Models\AccessPolicyTest; 30 | 31 | /** 32 | * Unit tests for class TableAccessPolicy 33 | * 34 | * @category Microsoft 35 | * @package MicrosoftAzure\Storage\Tests\Unit\Table\Models 36 | * @author Azure Storage PHP SDK 37 | * @copyright 2017 Microsoft Corporation 38 | * @license https://github.com/azure/azure-storage-php/LICENSE 39 | * @link https://github.com/azure/azure-storage-php 40 | */ 41 | class TableAccessPolicyTest extends AccessPolicyTest 42 | { 43 | protected function createAccessPolicy() 44 | { 45 | return new TableAccessPolicy(); 46 | } 47 | 48 | protected function getResourceType() 49 | { 50 | return TableResources::RESOURCE_TYPE_TABLE; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /tests/Unit/Table/Models/UpdateEntityResultTest.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2016 Microsoft Corporation 21 | * @license https://github.com/azure/azure-storage-php/LICENSE 22 | * @link https://github.com/azure/azure-storage-php 23 | */ 24 | namespace MicrosoftAzure\Storage\Tests\Unit\Table\Models; 25 | 26 | use MicrosoftAzure\Storage\Table\Models\UpdateEntityResult; 27 | 28 | /** 29 | * Unit tests for class UpdateEntityResult 30 | * 31 | * @category Microsoft 32 | * @package MicrosoftAzure\Storage\Tests\Unit\Table\Models 33 | * @author Azure Storage PHP SDK 34 | * @copyright 2016 Microsoft Corporation 35 | * @license https://github.com/azure/azure-storage-php/LICENSE 36 | * @link https://github.com/azure/azure-storage-php 37 | */ 38 | class UpdateEntityResultTest extends \PHPUnit\Framework\TestCase 39 | { 40 | public function testCreate() 41 | { 42 | // Setup 43 | $headers = array('ETag' => '0x8CACB9BD7C6B1B2'); 44 | 45 | // Test 46 | $result = UpdateEntityResult::create($headers); 47 | 48 | // Assert 49 | $this->assertEquals($headers['ETag'], $result->getETag()); 50 | } 51 | } 52 | --------------------------------------------------------------------------------