Skip to content

Commit 14fbf5a

Browse files
committed
Merge pull request #124 from rwifeng/list_fix
add mkzip test
2 parents 99a2ed8 + 6391958 commit 14fbf5a

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

tests/Qiniu/Tests/PfopTest.php

+26-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class PfopTest extends \PHPUnit_Framework_TestCase
88
{
9-
public function testExecute1()
9+
public function testPfop()
1010
{
1111
global $testAuth;
1212
$bucket = 'testres';
@@ -22,7 +22,7 @@ public function testExecute1()
2222
}
2323

2424

25-
public function testExecute2()
25+
public function testPfops()
2626
{
2727
global $testAuth;
2828
$bucket = 'testres';
@@ -35,6 +35,30 @@ public function testExecute2()
3535

3636
list($id, $error) = $pfop->execute($key, $fops);
3737
$this->assertNull($error);
38+
39+
list($status, $error) = PersistentFop::status($id);
40+
$this->assertNotNull($status);
41+
$this->assertNull($error);
42+
}
43+
44+
public function testMkzip()
45+
{
46+
global $testAuth;
47+
$bucket = 'phpsdk';
48+
$key = 'php-logo.png';
49+
$pfop = new PersistentFop($testAuth, $bucket);
50+
51+
$url1 = 'http://phpsdk.qiniudn.com/php-logo.png';
52+
$url2 = 'http://phpsdk.qiniudn.com/php-sdk.html';
53+
$zipKey = 'test.zip';
54+
55+
$fops = 'mkzip/2/url/' . \Qiniu\base64_urlSafeEncode($url1);
56+
$fops .= '/url/' . \Qiniu\base64_urlSafeEncode($url2);
57+
$fops .= '|saveas/' . \Qiniu\base64_urlSafeEncode("$bucket:$zipKey");
58+
59+
list($id, $error) = $pfop->execute($key, $fops);
60+
$this->assertNull($error);
61+
3862
list($status, $error) = PersistentFop::status($id);
3963
$this->assertNotNull($status);
4064
$this->assertNull($error);

0 commit comments

Comments
 (0)