@@ -14,6 +14,43 @@ public function setUp()
1414 $ this ->bucket = getenv ("QINIU_BUCKET_NAME " );
1515 }
1616
17+ public function testRput ()
18+ {
19+ $ key = 'tmp/testRput ' . getTid ();
20+ $ err = Qiniu_RS_Delete ($ this ->client , $ this ->bucket , $ key );
21+
22+ $ reader = new MockReader ;
23+ list ($ ret , $ err ) = Qiniu_RS_Rput ($ this ->client , $ this ->bucket , $ key , $ reader , 5 , null );
24+ $ this ->assertNull ($ err );
25+ var_dump ($ ret );
26+ $ this ->assertEquals ($ ret ['hash ' ], "Fnvgeq9GDVk6Mj0Nsz2gW2S_3LOl " );
27+
28+ list ($ ret , $ err ) = Qiniu_RS_Stat ($ this ->client , $ this ->bucket , $ key );
29+ $ this ->assertNull ($ err );
30+ var_dump ($ ret );
31+
32+ $ err = Qiniu_RS_Delete ($ this ->client , $ this ->bucket , $ key );
33+ $ this ->assertNull ($ err );
34+ }
35+
36+ public function testRputFile ()
37+ {
38+ $ key = 'tmp/testRputFile ' . getTid ();
39+ $ err = Qiniu_RS_Delete ($ this ->client , $ this ->bucket , $ key );
40+
41+ list ($ ret , $ err ) = Qiniu_RS_RputFile ($ this ->client , $ this ->bucket , $ key , __file__, null );
42+ $ this ->assertNull ($ err );
43+ var_dump ($ ret );
44+ $ this ->assertArrayHasKey ('hash ' , $ ret );
45+
46+ list ($ ret , $ err ) = Qiniu_RS_Stat ($ this ->client , $ this ->bucket , $ key );
47+ $ this ->assertNull ($ err );
48+ var_dump ($ ret );
49+
50+ $ err = Qiniu_RS_Delete ($ this ->client , $ this ->bucket , $ key );
51+ $ this ->assertNull ($ err );
52+ }
53+
1754 public function testPutFile ()
1855 {
1956 $ key = 'tmp/testPutFile ' . getTid ();
@@ -39,7 +76,7 @@ public function testPut()
3976 $ key = 'tmp/testPut ' . getTid ();
4077 $ err = Qiniu_RS_Delete ($ this ->client , $ this ->bucket , $ key );
4178
42- list ($ ret , $ err ) = Qiniu_RS_Put ($ this ->client , $ this ->bucket , $ key , " hello world! " , null );
79+ list ($ ret , $ err ) = Qiniu_RS_Put ($ this ->client , $ this ->bucket , $ key , ' hello world! ' , null );
4380 $ this ->assertNull ($ err );
4481 $ this ->assertArrayHasKey ('hash ' , $ ret );
4582 var_dump ($ ret );
0 commit comments