Completed
Pull Request — master (#14)
by Pavel
03:40
created

IndirectFieldsTestAbstract   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 6
dl 0
loc 29
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B testIndirectId() 0 26 1
1
<?php
2
3
namespace Bankiru\Api\Doctrine\Tests;
4
5
use Bankiru\Api\Doctrine\Test\Entity\IndirectIdEntity;
6
use ScayTrase\Api\Rpc\RpcRequestInterface;
7
8
class IndirectFieldsTestAbstract extends AbstractEntityManagerTest
9
{
10
    public function testIndirectId()
11
    {
12
        $repository = $this->getManager()->getRepository(IndirectIdEntity::class);
13
        $this->getClient()->push(
14
            $this->getResponseMock(
15
                true,
16
                (object)[
17
                    'some-long-api-field-name' => 241,
18
                    'payload'                  => 'test',
19
                ]
20
            ),
21
            function (RpcRequestInterface $request) {
22
                self::assertEquals('indirect-entity/find', $request->getMethod());
23
                self::assertEquals(['some-long-api-field-name' => 241], $request->getParameters());
24
25
                return true;
26
            }
27
        );
28
29
        /** @var IndirectIdEntity $entity */
30
        $entity = $repository->find(241);
31
32
        self::assertInstanceOf(IndirectIdEntity::class, $entity);
33
        self::assertEquals(241, $entity->getId());
34
        self::assertEquals('test', $entity->getPayload());
35
    }
36
}
37