Skip to content

Commit ab37936

Browse files
author
tuunalai
committed
update description
1 parent eb80d3d commit ab37936

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/CosClientObjectTest.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,44 @@ public function testGetObject() {
283283
}
284284
}
285285

286+
/*
287+
* get object,key访问getObject
288+
* 404
289+
*/
290+
public function testGetObjectInvalidKey()
291+
{
292+
try {
293+
$key = "//////";
294+
$this->cosClient->getObject(array(
295+
'Bucket' => $this->bucket,
296+
'Key' => $key,));
297+
$this->assertTrue(False);
298+
} catch (ServiceResponseException $e) {
299+
300+
$this->assertEquals(
301+
404,
302+
$e->getExceptionCode()
303+
);
304+
}
305+
}
306+
307+
public function testGetObjectInvalidOtherKey()
308+
{
309+
try {
310+
$key = "/../";
311+
$this->cosClient->getObject(array(
312+
'Bucket' => $this->bucket,
313+
'Key' => $key,));
314+
$this->assertTrue(False);
315+
} catch (ServiceResponseException $e) {
316+
317+
$this->assertEquals(
318+
404,
319+
$e->getExceptionCode()
320+
);
321+
}
322+
}
323+
286324
/*
287325
* range下载大文件
288326
* 200

0 commit comments

Comments
 (0)