Passed
Pull Request — master (#14)
by Pavel
05:12
created

CustomRepositoryTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 5
dl 0
loc 26
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testCustomRepository() 0 23 1
1
<?php
2
3
namespace Bankiru\Api\Doctrine\Tests;
4
5
use Bankiru\Api\Doctrine\Test\Entity\CustomEntity;
6
use Bankiru\Api\Doctrine\Test\Repository\CustomTestRepository;
7
use ScayTrase\Api\Rpc\RpcRequestInterface;
8
9
final class CustomRepositoryTest extends AbstractEntityManagerTest
10
{
11
    public function testCustomRepository()
12
    {
13
        /** @var CustomTestRepository $repository */
14
        $repository = $this->getManager()->getRepository(CustomEntity::class);
15
        $this->getClient()->push(
16
            $this->getResponseMock(true, (object)['customField' => 'custom-response']),
17
            function (RpcRequestInterface $request) {
18
                self::assertEquals('custom-entity/custom', $request->getMethod());
19
                self::assertEquals(
20
                    ['param1' => 'value1'],
21
                    $request->getParameters()
22
                );
23
24
                return true;
25
            }
26
        );
27
28
        /** @var \StdClass $data */
29
        $data = $repository->doCustomStuff();
30
31
        self::assertInstanceOf(\stdClass::class, $data);
32
        self::assertEquals('custom-response', $data->customField);
33
    }
34
}
35