From 197901782a6dd41a6719c309afb4a0e8b80b9226 Mon Sep 17 00:00:00 2001 From: Shashankh Kanni Date: Thu, 19 Oct 2023 16:45:48 +0530 Subject: [PATCH] added test files --- tests/Storage/Device/AzureBlobTest.php | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/Storage/Device/AzureBlobTest.php diff --git a/tests/Storage/Device/AzureBlobTest.php b/tests/Storage/Device/AzureBlobTest.php new file mode 100644 index 00000000..b5e785b9 --- /dev/null +++ b/tests/Storage/Device/AzureBlobTest.php @@ -0,0 +1,44 @@ +root = '/root'; + $storageAccount = $_SERVER['AZURE_ACCOUNT'] ?? ''; + $accessKey = $_SERVER['AZURE_ACCESS_KEY'] ?? ''; + $container = 'azurebucket'; + + $this->object = new AzureBlob($this->root, $accessKey, $storageAccount, $container); + } + + protected function getAdapterName(): string + { + return 'Azure Blob Storage'; + } + + protected function getAdapterType(): string + { + return $this->object->getType(); + } + + protected function getAdapterDescription(): string + { + return 'Azure Blob Storage'; + } + + /* It seems like we cannot use the testFileHash() function in S3Base because Azure Blob generates a + different hash value each time, even for the same file. */ + public function testFileHash() + { + $this->assertEquals($this->object->getFileHash($this->object->getPath('testing/kitten-1.jpg')), $this->object->getFileHash($this->object->getPath('testing/kitten-1.jpg'))); + $this->assertEquals($this->object->getFileHash($this->object->getPath('testing/kitten-2.jpg')), $this->object->getFileHash($this->object->getPath('testing/kitten-2.jpg'))); + $this->assertEquals($this->object->getFileHash($this->object->getPath('testing/kitten-1.png')), $this->object->getFileHash($this->object->getPath('testing/kitten-1.png'))); + $this->assertEquals($this->object->getFileHash($this->object->getPath('testing/kitten-2.png')), $this->object->getFileHash($this->object->getPath('testing/kitten-2.png'))); + } +} \ No newline at end of file