Completed
Push — v3 ( 862d0b...57b69a )
by Beñat
05:33
created

ResponseNoTransformationDataTransformerSpec   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A it_is_initializable() 0 4 1
A it_implements_response_data_transformer() 0 4 1
A it_writes() 0 4 1
A it_reads() 0 7 1
1
<?php
2
3
/*
4
 * This file is part of the Stack Exchange Api Client library.
5
 *
6
 * Copyright (c) 2014-2016 Beñat Espiña <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace PhpSpec\BenatEspina\StackExchangeApiClient\Application\DataTransformer;
13
14
use BenatEspina\StackExchangeApiClient\Application\DataTransformer\ResponseDataTransformer;
15
use BenatEspina\StackExchangeApiClient\Application\DataTransformer\ResponseNoTransformationDataTransformer;
16
use PhpSpec\ObjectBehavior;
17
use Psr\Http\Message\ResponseInterface;
18
19
/**
20
 * Spec file of ResponseNoTransformationDataTransformer class.
21
 *
22
 * @author Beñat Espiña <[email protected]>
23
 */
24
class ResponseNoTransformationDataTransformerSpec extends ObjectBehavior
25
{
26
    function it_is_initializable()
27
    {
28
        $this->shouldHaveType(ResponseNoTransformationDataTransformer::class);
29
    }
30
31
    function it_implements_response_data_transformer()
32
    {
33
        $this->shouldImplement(ResponseDataTransformer::class);
34
    }
35
36
    function it_writes(ResponseInterface $response)
37
    {
38
        $this->write($response);
39
    }
40
41
    function it_reads(ResponseInterface $response)
42
    {
43
        $this->read($response)->shouldReturn([]);
44
45
        $this->write($response);
46
        $this->read($response)->shouldReturn($response);
47
    }
48
}
49