Completed
Push — master ( 22d3fd...d7530b )
by Risan Bagja
02:43
created

HttpClientTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A http_client_has_base_uri() 0 6 1
A http_client_has_post_request() 0 8 1
1
<?php
2
3
use Ktp\HttpClient;
4
use Psr\Http\Message\ResponseInterface;
5
6
class HttpClientTest extends PHPUnit_Framework_TestCase {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
7
    /** @test */
8
    function http_client_has_base_uri()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
9
    {
10
        $httpClient = new HttpClient('http://foo.bar');
11
12
        $this->assertEquals('http://foo.bar', $httpClient->baseUri());
13
    }
14
15
    /** @test */
16
    function http_client_has_post_request()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
17
    {
18
        $httpClient = new HttpClient('http://www.mocky.io/v2/');
19
20
        $response = $httpClient->post('5678638b0f00006a2a500861');
21
22
        $this->assertInstanceOf(ResponseInterface::class, $response);
23
    }
24
}
25