Test Setup Failed
Push — develop ( e0b6c5...2b0ae3 )
by Jaime
04:53 queued 02:15
created

HttpClientTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 43
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testGet() 0 6 1
A testPost() 0 6 1
A testConstruct() 0 7 1
A createHttpClient() 0 9 1
1
<?php
2
3
namespace Cobak78\RancherApi\Tests\Clients;
4
5
use Cobak78\RancherApi\Clients\HttpClient;
6
use GuzzleHttp\Client;
7
use GuzzleHttp\ClientInterface;
8
use GuzzleHttp\Exception\ClientException;
9
use Psr\Http\Message\ResponseInterface;
10
11
/**
12
 * Class HttpClientTest
13
 * @package Cobak78\RancherApi\Tests\Clients
14
 */
15
class HttpClientTest extends \PHPUnit_Framework_TestCase
16
{
17
    const
18
        ACCESS_HOST = 'http://rancher.fake.com',
19
        ACCESS_APIKEY = '123456789',
20
        ACCESS_SHARED = '123456789'
21
    ;
22
23
    public function testGet()
24
    {
25
        $client = static::createHttpClient();
26
27
        $this->assertEquals($client->get('fake'), 404);
28
    }
29
30
    public function testPost()
31
    {
32
        $client = static::createHttpClient();
33
34
        $this->assertEquals($client->post('fake'), 404);
35
    }
36
37
    public function testConstruct()
38
    {
39
        $client = static::createHttpClient();
40
41
        $this->assertInstanceOf($client, HttpClient::class);
42
        $this->assertFalse($client->isSocket());
43
    }
44
45
    /**
46
     * @return HttpClient
47
     */
48
    public static function createHttpClient()
49
    {
50
        return new HttpClient(
51
            static::ACCESS_APIKEY,
52
            new Client(),
53
            static::ACCESS_SHARED,
54
            static::ACCESS_HOST
55
        );
56
    }
57
}
58