3
3
4
4
use Qiniu \Storage \FormUploader ;
5
5
use Qiniu \Storage \UploadManager ;
6
+ use Qiniu \Config ;
6
7
7
8
class FormUpTest extends \PHPUnit_Framework_TestCase
8
9
{
9
10
protected $ bucketName ;
10
11
protected $ auth ;
12
+ protected $ cfg ;
13
+
11
14
protected function setUp ()
12
15
{
13
16
global $ bucketName ;
14
17
$ this ->bucketName = $ bucketName ;
15
18
16
19
global $ testAuth ;
17
20
$ this ->auth = $ testAuth ;
21
+ $ this ->cfg = new Config ();
18
22
}
23
+
19
24
public function testData ()
20
25
{
21
26
$ 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 );
23
28
$ this ->assertNull ($ error );
24
29
$ this ->assertNotNull ($ ret ['hash ' ]);
25
30
}
@@ -37,7 +42,7 @@ public function testFile()
37
42
{
38
43
$ key = 'formPutFile ' ;
39
44
$ 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 );
41
46
$ this ->assertNull ($ error );
42
47
$ this ->assertNotNull ($ ret ['hash ' ]);
43
48
}
0 commit comments