From ab37936e870459d662281e5a3e9756ce97f8a4d3 Mon Sep 17 00:00:00 2001 From: tuunalai Date: Fri, 17 May 2024 15:44:52 +0800 Subject: [PATCH] update description --- tests/CosClientObjectTest.php | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/CosClientObjectTest.php b/tests/CosClientObjectTest.php index 0f1df22..12621dc 100644 --- a/tests/CosClientObjectTest.php +++ b/tests/CosClientObjectTest.php @@ -283,6 +283,44 @@ public function testGetObject() { } } + /* + * get object,key访问getObject + * 404 + */ + public function testGetObjectInvalidKey() + { + try { + $key = "//////"; + $this->cosClient->getObject(array( + 'Bucket' => $this->bucket, + 'Key' => $key,)); + $this->assertTrue(False); + } catch (ServiceResponseException $e) { + + $this->assertEquals( + 404, + $e->getExceptionCode() + ); + } + } + + public function testGetObjectInvalidOtherKey() + { + try { + $key = "/../"; + $this->cosClient->getObject(array( + 'Bucket' => $this->bucket, + 'Key' => $key,)); + $this->assertTrue(False); + } catch (ServiceResponseException $e) { + + $this->assertEquals( + 404, + $e->getExceptionCode() + ); + } + } + /* * range下载大文件 * 200