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

MultiTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 1 Features 0
Metric Value
dl 0
loc 20
rs 10
c 1
b 1
f 0
wmc 2
lcom 1
cbo 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testUpload() 0 6 1
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