Completed
Push — develop ( c8d2e9...9b1d71 )
by Adam
03:00
created

ArrayHydratorSpec::it_is_initializable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace spec\IBM\Watson\Common\Hydrator;
4
5
use IBM\Watson\Common\Hydrator\ArrayHydrator;
6
use PhpSpec\ObjectBehavior;
7
use Mockery as m;
8
use Psr\Http\Message\ResponseInterface;
9
use Psr\Http\Message\StreamInterface;
10
11
class ArrayHydratorSpec extends ObjectBehavior
12
{
13
    function it_is_initializable()
14
    {
15
        $this->shouldHaveType(ArrayHydrator::class);
16
    }
17
18
    function it_should_hydrate_response()
19
    {
20
        $stream = m::mock(StreamInterface::class);
21
        $stream->shouldReceive('__toString')->once()->andReturn('{"param": "value","param2": 99}');
22
23
        $response = m::mock(ResponseInterface::class);
24
        $response->shouldReceive('getHeaderLine')->with('Content-Type')->andReturn('application/json');
25
        $response->shouldReceive('getBody')->andReturn($stream);
26
27
        $hydrated = $this->hydrate($response);
28
        $hydrated->shouldBeArray();
29
    }
30
}
31