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

IndirectFieldsTestAbstract::testIndirectId()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 27
Code Lines 15

Duplication

Lines 27
Ratio 100 %

Code Coverage

Tests 20
CRAP Score 1

Importance

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