Completed
Push — master ( bfc0cc...f0e226 )
by sabaku
04:05
created

MultiTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
namespace Upyun\Tests\Api;
3
4
use Upyun\Config;
5
use Upyun\Api\Multi;
6
use GuzzleHttp\Psr7;
7
use Upyun\Upyun;
8
9
class MultiTest extends \PHPUnit_Framework_TestCase{
10
11
    /**
12
     * @var Multi;
13
     */
14
    public $multiPart;
15
16
    public function setUp() {
17
        $config = new Config(BUCKET, USER_NAME, PWD);
18
        $config->setFormApiKey('Mv83tlocuzkmfKKUFbz2s04FzTw=');
19
        $this->multiPart = new Multi($config);
20
    }
21
22
    public function testUpload() {
23
        $filePath = __DIR__ . '/../assets/sample.jpeg';
24
        $stream = Psr7\stream_for(fopen($filePath, 'rb'));
25
        $r = $this->multiPart->upload('test-sample.jpeg', $stream, md5_file($filePath));
26
        $this->assertEquals($r->getStatusCode(), 200);
27
    }
28
}
29