Passed
Pull Request — master (#17)
by Mihail
15:10
created

ClientRequestBodyTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A test_with_string_body() 0 5 1
A test_without_body_attribute() 0 5 1
1
<?php
2
3
namespace Tests\Koded\Http;
4
5
use Koded\Http\ClientRequest;
6
use Koded\Http\Interfaces\HttpMethod;
7
use PHPUnit\Framework\TestCase;
8
use Psr\Http\Message\StreamInterface;
9
10
class ClientRequestBodyTest extends TestCase
11
{
12
    const URI = 'https://example.org';
13
14
    public function test_with_string_body()
15
    {
16
        $request = new ClientRequest(HttpMethod::POST, self::URI, 'TDD');
17
        $this->assertInstanceOf(StreamInterface::class, $request->getBody());
18
        $this->assertSame('TDD', (string)$request->getBody());
19
    }
20
21
    public function test_without_body_attribute()
22
    {
23
        $request = new ClientRequest(HttpMethod::GET, self::URI);
24
        $this->assertInstanceOf(StreamInterface::class, $request->getBody());
25
        $this->assertSame('', (string)$request->getBody());
26
    }
27
}
28