Passed
Push — master ( 063866...82c940 )
by Darío
02:54 queued 01:26
created

AbstractClientTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 11
c 1
b 0
f 1
dl 0
loc 27
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A itExecutesAPreparedRequest() 0 10 1
A itPreparesARequestForExecution() 0 7 1
1
<?php
2
3
namespace EasyHttp\LayerContracts\Tests\Unit;
4
5
use EasyHttp\LayerContracts\Tests\Unit\Example\SomeClient;
6
use PHPUnit\Framework\TestCase;
7
8
class AbstractClientTest extends TestCase
9
{
10
    /**
11
     * @test
12
     */
13
    public function itPreparesARequestForExecution()
14
    {
15
        $client = new SomeClient();
16
        $client->prepareRequest('GET', 'http://example.com/api');
17
18
        $this->assertSame('GET', $client->getRequest()->getMethod());
19
        $this->assertSame('http://example.com/api', $client->getRequest()->getUri());
20
    }
21
22
    /**
23
     * @test
24
     */
25
    public function itExecutesAPreparedRequest()
26
    {
27
        $client = new SomeClient();
28
        $client->prepareRequest('GET', 'http://example.com/api');
29
30
        $response = $client->execute();
31
32
        $this->assertSame(200, $response->getStatusCode());
33
        $this->assertSame(['key' => 'value'], $response->toJson());
34
        $this->assertSame(['Server' => 'Apache/2.4.38 (Debian)'], $response->getHeaders());
35
    }
36
}