Skip to content

Commit a96066f

Browse files
authored
fix ut (#249)
* pre-release 2.4.3
1 parent ba3cad7 commit a96066f

File tree

3 files changed

+15
-29
lines changed

3 files changed

+15
-29
lines changed

tests/CosClientCiTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
use Qcloud\Cos\Client;
1010

11-
class CosClientCiTest extends TestCosClientBase
12-
{
13-
//TODO
14-
}
11+
//class CosClientCiTest extends TestCosClientBase
12+
//{
13+
// //TODO
14+
//}
15+

tests/CosClientObjectTest.php

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class CosClientObjectTest extends TestCosClientBase {
99

1010
private $key;
1111
private $appendKey;
12+
private $aclKey;
1213
/**********************************
1314
* TestObject
1415
**********************************/
@@ -482,11 +483,10 @@ public function testCopyLargeObject() {
482483
*/
483484
public function testPutObjectACL() {
484485
try {
485-
$this->cosClient->upload($this->bucket, '11', 'hello.txt');
486486
$this->cosClient->PutObjectAcl(
487487
array(
488488
'Bucket' => $this->bucket,
489-
'Key' => '11',
489+
'Key' => $this->key,
490490
'Grants' => array(
491491
array(
492492
'Grantee' => array(
@@ -506,10 +506,9 @@ public function testPutObjectACL() {
506506
);
507507
$this->assertTrue(True);
508508
} catch (ServiceResponseException $e) {
509-
509+
510510
$this->assertFalse(True);
511511
}
512-
513512
}
514513

515514
/*
@@ -519,11 +518,10 @@ public function testPutObjectACL() {
519518
public function testGetObjectACL()
520519
{
521520
try {
522-
$this->cosClient->upload($this->bucket, '11', 'hello.txt');
523521
$this->cosClient->PutObjectAcl(
524522
array(
525523
'Bucket' => $this->bucket,
526-
'Key' => '11',
524+
'Key' => $this->key,
527525
'Grants' => array(
528526
array(
529527
'Grantee' => array(
@@ -542,7 +540,7 @@ public function testGetObjectACL()
542540
);
543541
$this->assertTrue(True);
544542
} catch (ServiceResponseException $e) {
545-
543+
546544
$this->assertFalse(True);
547545
}
548546
}
@@ -554,7 +552,6 @@ public function testGetObjectACL()
554552
public function testPutObjectAclPrivate()
555553
{
556554
try {
557-
$this->cosClient->putObject(array('Bucket' => $this->bucket,'Key' => $this->key, 'Body' => '123'));
558555
$this->cosClient->PutObjectAcl(
559556
array(
560557
'Bucket' => $this->bucket,
@@ -564,7 +561,6 @@ public function testPutObjectAclPrivate()
564561
);
565562
$this->assertTrue(True);
566563
} catch (ServiceResponseException $e) {
567-
568564
$this->assertFalse(True);
569565
}
570566
}
@@ -576,7 +572,6 @@ public function testPutObjectAclPrivate()
576572
public function testPutObjectAclPublicRead()
577573
{
578574
try {
579-
$this->cosClient->putObject(array('Bucket' => $this->bucket,'Key' => $this->key, 'Body' => '123'));
580575
$this->cosClient->PutObjectAcl(
581576
array(
582577
'Bucket' => $this->bucket,
@@ -599,7 +594,6 @@ public function testPutObjectAclPublicRead()
599594
public function testPutObjectAclInvalid()
600595
{
601596
try {
602-
$this->cosClient->putObject(array('Bucket' => $this->bucket,'Key' => $this->key, 'Body' => '123'));
603597
$this->cosClient->PutObjectAcl(
604598
array(
605599
'Bucket' => $this->bucket,
@@ -620,7 +614,6 @@ public function testPutObjectAclInvalid()
620614
public function testPutObjectAclReadToUser()
621615
{
622616
try {
623-
$this->cosClient->putObject(array('Bucket' => $this->bucket,'Key' => $this->key, 'Body' => '123'));
624617
$this->cosClient->PutObjectAcl(
625618
array(
626619
'Bucket' => $this->bucket,
@@ -643,7 +636,6 @@ public function testPutObjectAclReadToUser()
643636
public function testPutObjectAclFullToUser()
644637
{
645638
try {
646-
$this->cosClient->putObject(array('Bucket' => $this->bucket,'Key' => $this->key, 'Body' => '123'));
647639
$this->cosClient->PutObjectAcl(
648640
array(
649641
'Bucket' => $this->bucket,
@@ -665,7 +657,6 @@ public function testPutObjectAclFullToUser()
665657
public function testPutObjectAclToUsers()
666658
{
667659
try {
668-
$this->cosClient->putObject(array('Bucket' => $this->bucket,'Key' => $this->key, 'Body' => '123'));
669660
$this->cosClient->PutObjectAcl(
670661
array(
671662
'Bucket' => $this->bucket,
@@ -687,7 +678,6 @@ public function testPutObjectAclToUsers()
687678
public function testPutObjectAclToSubuser()
688679
{
689680
try {
690-
$this->cosClient->putObject(array('Bucket' => $this->bucket,'Key' => $this->key, 'Body' => '123'));
691681
$this->cosClient->PutObjectAcl(
692682
array(
693683
'Bucket' => $this->bucket,
@@ -710,7 +700,6 @@ public function testPutObjectAclToSubuser()
710700
public function testPutObjectAclInvalidGrant()
711701
{
712702
try {
713-
$this->cosClient->putObject(array('Bucket' => $this->bucket,'Key' => $this->key, 'Body' => '123'));
714703
$this->cosClient->PutObjectAcl(
715704
array(
716705
'Bucket' => $this->bucket,
@@ -731,7 +720,6 @@ public function testPutObjectAclInvalidGrant()
731720
public function testPutObjectAclByBody()
732721
{
733722
try {
734-
$this->cosClient->putObject(array('Bucket' => $this->bucket,'Key' => $this->key, 'Body' => '123'));
735723
$this->cosClient->PutObjectAcl(
736724
array(
737725
'Bucket' => $this->bucket,
@@ -755,7 +743,7 @@ public function testPutObjectAclByBody()
755743
);
756744
$this->assertTrue(True);
757745
} catch (ServiceResponseException $e) {
758-
746+
759747
$this->assertFalse(True);
760748
}
761749
}
@@ -767,7 +755,6 @@ public function testPutObjectAclByBody()
767755
public function testPutObjectAclByBodyToAnyone()
768756
{
769757
try {
770-
$this->cosClient->putObject(array('Bucket' => $this->bucket,'Key' => $this->key, 'Body' => '123'));
771758
$this->cosClient->putObjectAcl(
772759
array(
773760
'Bucket' => $this->bucket,
@@ -791,7 +778,7 @@ public function testPutObjectAclByBodyToAnyone()
791778
);
792779
$this->assertTrue(True);
793780
} catch (ServiceResponseException $e) {
794-
781+
795782
$this->assertFalse(True);
796783
}
797784
}
@@ -912,7 +899,6 @@ public function testPutObjectTagging()
912899
'Key' => $this->key
913900
));
914901
$this->assertEquals($rt['TagSet'], $tagSet);
915-
$this->assertTrue(True);
916902
} catch (ServiceResponseException $e) {
917903
$this->assertFalse(True);
918904
}
@@ -954,6 +940,7 @@ public function testDeleteObjectTagging()
954940
'Key' => $this->key,
955941
'TagSet' => $tagSet
956942
));
943+
Common::waitSync();
957944
$this->cosClient->deleteObjectTagging(array(
958945
'Bucket' => $this->bucket,
959946
'Key' => $this->key
@@ -969,14 +956,11 @@ protected function setUp(): void
969956
parent::setUp();
970957
$this->key = Common::FILE_NAME;
971958
$this->appendKey = $this->key.'append';
959+
$this->cosClient->putObject(array('Bucket' => $this->bucket,'Key' => $this->key, 'Body' => '123'));
972960
}
973961

974962
protected function tearDown(): void {
975963
parent::tearDown();
976-
try {
977-
$this->cosClient->deleteObject(array('Bucket' => $this->bucket, 'Key' => $this->appendKey));
978-
} catch(\Exception $e) {
979-
}
980964
}
981965

982966
}

tests/TestCosClientBase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ protected function tearDown(): void {
2626

2727
$result = $this->cosClient->listObjects(
2828
array('Bucket' => $this->bucket));
29+
2930
if (isset($result['Contents'])) {
3031
foreach ($result['Contents'] as $content) {
3132
$this->cosClient->deleteObject(array('Bucket' => $this->bucket, 'Key' => $content['Key']));

0 commit comments

Comments
 (0)