Skip to content

Commit 1247201

Browse files
committed
add copy force param test case
1 parent 3730921 commit 1247201

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

tests/Qiniu/Tests/BucketTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,30 @@ public function testRename()
8383
public function testCopy()
8484
{
8585
$key = 'copyto' . rand();
86+
$this->bucketManager->delete($this->bucketName, $key);
87+
8688
$error = $this->bucketManager->copy(
8789
$this->bucketName,
8890
$this->key,
8991
$this->bucketName,
9092
$key
9193
);
9294
$this->assertNull($error);
95+
96+
//test force copy
97+
$error = $this->bucketManager->copy(
98+
$this->bucketName,
99+
$this->key2,
100+
$this->bucketName,
101+
$key,
102+
true
103+
);
104+
$this->assertNull($error);
105+
106+
$key2Stat = $this->bucketManager->stat($this->bucketName, $this->key2);
107+
$key2CopiedStat = $this->bucketManager->stat($this->bucketName, $key);
108+
$this->assertEquals($key2Stat['hash'], $key2CopiedStat['hash']);
109+
93110
$error = $this->bucketManager->delete($this->bucketName, $key);
94111
$this->assertNull($error);
95112
}

tests/bootstrap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
$testAuth = new Auth($accessKey, $secretKey);
1010
$bucketName = 'phpsdk';
1111
$key = 'php-logo.png';
12+
$key2 = 'niu.png';
1213
$bucketNameBC = 'phpsdk-bc';
1314

1415
$dummyAccessKey = 'abcdefghklmnopq';

0 commit comments

Comments
 (0)