33
44use Qiniu \Storage \FormUploader ;
55use Qiniu \Storage \UploadManager ;
6+ use Qiniu \Config ;
67
78class FormUpTest extends \PHPUnit_Framework_TestCase
89{
910 protected $ bucketName ;
1011 protected $ auth ;
12+ protected $ cfg ;
13+
1114 protected function setUp ()
1215 {
1316 global $ bucketName ;
1417 $ this ->bucketName = $ bucketName ;
1518
1619 global $ testAuth ;
1720 $ this ->auth = $ testAuth ;
21+ $ this ->cfg = new Config ();
1822 }
23+
1924 public function testData ()
2025 {
2126 $ token = $ this ->auth ->uploadToken ($ this ->bucketName );
22- list ($ ret , $ error ) = FormUploader::put ($ token , 'formput ' , 'hello world ' , null , 'text/plain ' , true );
27+ list ($ ret , $ error ) = FormUploader::put ($ token , 'formput ' , 'hello world ' , $ this -> cfg , null , 'text/plain ' , true );
2328 $ this ->assertNull ($ error );
2429 $ this ->assertNotNull ($ ret ['hash ' ]);
2530 }
@@ -37,7 +42,7 @@ public function testFile()
3742 {
3843 $ key = 'formPutFile ' ;
3944 $ token = $ this ->auth ->uploadToken ($ this ->bucketName , $ key );
40- list ($ ret , $ error ) = FormUploader::putFile ($ token , $ key , __file__, null , 'text/plain ' , true );
45+ list ($ ret , $ error ) = FormUploader::putFile ($ token , $ key , __file__, $ this -> cfg , null , 'text/plain ' , true );
4146 $ this ->assertNull ($ error );
4247 $ this ->assertNotNull ($ ret ['hash ' ]);
4348 }
0 commit comments