Completed
Push — master ( 9e925c...214c62 )
by Pavel
03:41
created

CustomRepositoryTest::testCustomRepository()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 18
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 26
ccs 18
cts 18
cp 1
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 13
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Bankiru\Api\Tests;
4
5
use Bankiru\Api\Test\Entity\CustomEntity;
6
use Bankiru\Api\Test\Repository\CustomTestRepository;
7
use GuzzleHttp\Psr7\Response;
8
9
class CustomRepositoryTest extends AbstractEntityManagerTest
10
{
11 1
    public function testCustomRepository()
12
    {
13
        /** @var CustomTestRepository $repository */
14 1
        $repository = $this->getManager()->getRepository(CustomEntity::class);
15 1
        $this->getResponseMock()->append(
16 1
            new Response(
17 1
                200,
18 1
                [],
19 1
                json_encode(
20
                    [
21 1
                        'jsonrpc' => '2.0',
22 1
                        'id'      => 'test',
23
                        'result'  => [
24 1
                            'customField' => 'custom-response',
25 1
                        ],
26
                    ]
27 1
                )
28 1
            )
29 1
        );
30
31
        /** @var \StdClass $data */
32 1
        $data = $repository->doCustomStuff();
33
34 1
        self::assertInstanceOf(\stdClass::class, $data);
35 1
        self::assertEquals('custom-response', $data->customField);
36 1
    }
37
}
38