11<?php
2+
23namespace Qiniu \Tests ;
34
45use Qiniu \Config ;
@@ -200,8 +201,9 @@ public function testStat()
200201
201202 public function testDelete ()
202203 {
203- $ error = $ this ->bucketManager ->delete ($ this ->bucketName , 'del ' );
204- $ this ->assertEquals (612 , $ error ->code ());
204+ list ($ ret , $ error ) = $ this ->bucketManager ->delete ($ this ->bucketName , 'del ' );
205+ $ this ->assertNull ($ ret );
206+ $ this ->assertNotNull ($ error );
205207 }
206208
207209
@@ -210,9 +212,9 @@ public function testRename()
210212 $ key = 'renamefrom ' . rand ();
211213 $ this ->bucketManager ->copy ($ this ->bucketName , $ this ->key , $ this ->bucketName , $ key );
212214 $ key2 = 'renameto ' . $ key ;
213- $ error = $ this ->bucketManager ->rename ($ this ->bucketName , $ key , $ key2 );
215+ list ( $ ret , $ error) = $ this ->bucketManager ->rename ($ this ->bucketName , $ key , $ key2 );
214216 $ this ->assertNull ($ error );
215- $ error = $ this ->bucketManager ->delete ($ this ->bucketName , $ key2 );
217+ list ( $ ret , $ error) = $ this ->bucketManager ->delete ($ this ->bucketName , $ key2 );
216218 $ this ->assertNull ($ error );
217219 }
218220
@@ -222,7 +224,7 @@ public function testCopy()
222224 $ key = 'copyto ' . rand ();
223225 $ this ->bucketManager ->delete ($ this ->bucketName , $ key );
224226
225- $ error = $ this ->bucketManager ->copy (
227+ list ( $ ret , $ error) = $ this ->bucketManager ->copy (
226228 $ this ->bucketName ,
227229 $ this ->key ,
228230 $ this ->bucketName ,
@@ -231,7 +233,7 @@ public function testCopy()
231233 $ this ->assertNull ($ error );
232234
233235 //test force copy
234- $ error = $ this ->bucketManager ->copy (
236+ list ( $ ret , $ error) = $ this ->bucketManager ->copy (
235237 $ this ->bucketName ,
236238 $ this ->key2 ,
237239 $ this ->bucketName ,
@@ -245,14 +247,14 @@ public function testCopy()
245247
246248 $ this ->assertEquals ($ key2Stat ['hash ' ], $ key2CopiedStat ['hash ' ]);
247249
248- $ error = $ this ->bucketManager ->delete ($ this ->bucketName , $ key );
250+ list ( $ ret , $ error) = $ this ->bucketManager ->delete ($ this ->bucketName , $ key );
249251 $ this ->assertNull ($ error );
250252 }
251253
252254
253255 public function testChangeMime ()
254256 {
255- $ error = $ this ->bucketManager ->changeMime (
257+ list ( $ ret , $ error) = $ this ->bucketManager ->changeMime (
256258 $ this ->bucketName ,
257259 'php-sdk.html ' ,
258260 'text/html '
@@ -262,7 +264,7 @@ public function testChangeMime()
262264
263265 public function testPrefetch ()
264266 {
265- $ error = $ this ->bucketManager ->prefetch (
267+ list ( $ ret , $ error) = $ this ->bucketManager ->prefetch (
266268 $ this ->bucketName ,
267269 'php-sdk.html '
268270 );
@@ -353,7 +355,7 @@ public function testBatchMove()
353355 );
354356 list ($ ret , $ error ) = $ this ->bucketManager ->batch ($ ops );
355357 $ this ->assertEquals (200 , $ ret [0 ]['code ' ]);
356- $ error = $ this ->bucketManager ->delete ($ this ->bucketName , $ key2 );
358+ list ( $ ret , $ error) = $ this ->bucketManager ->delete ($ this ->bucketName , $ key2 );
357359 $ this ->assertNull ($ error );
358360 }
359361
@@ -365,7 +367,7 @@ public function testBatchRename()
365367 $ ops = BucketManager::buildBatchRename ($ this ->bucketName , array ($ key => $ key2 ), true );
366368 list ($ ret , $ error ) = $ this ->bucketManager ->batch ($ ops );
367369 $ this ->assertEquals (200 , $ ret [0 ]['code ' ]);
368- $ error = $ this ->bucketManager ->delete ($ this ->bucketName , $ key2 );
370+ list ( $ ret , $ error) = $ this ->bucketManager ->delete ($ this ->bucketName , $ key2 );
369371 $ this ->assertNull ($ error );
370372 }
371373
@@ -379,11 +381,11 @@ public function testBatchStat()
379381 public function testDeleteAfterDays ()
380382 {
381383 $ key = rand ();
382- $ err = $ this ->bucketManager ->deleteAfterDays ($ this ->bucketName , $ key , 1 );
383- $ this ->assertEquals ( 612 , $ err -> code () );
384+ list ( $ ret , $ error ) = $ this ->bucketManager ->deleteAfterDays ($ this ->bucketName , $ key , 1 );
385+ $ this ->assertNotNull ( $ error );
384386
385387 $ this ->bucketManager ->copy ($ this ->bucketName , $ this ->key , $ this ->bucketName , $ key );
386- $ err = $ this ->bucketManager ->deleteAfterDays ($ this ->bucketName , $ key , 1 );
387- $ this ->assertEquals (null , $ err );
388+ list ( $ ret , $ error ) = $ this ->bucketManager ->deleteAfterDays ($ this ->bucketName , $ key , 1 );
389+ $ this ->assertEquals (null , $ ret );
388390 }
389391}
0 commit comments