Completed
Pull Request — master (#14)
by Pavel
04:11
created

CountingTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testEntityCounting() 0 23 1
1
<?php
2
3
namespace Bankiru\Api\Doctrine\Tests;
4
5
use Bankiru\Api\Doctrine\Test\Entity\PrefixedEntity;
6
use ScayTrase\Api\Rpc\RpcRequestInterface;
7
8
class CountingTest extends AbstractEntityManagerTest
9
{
10
    public function testEntityCounting()
11
    {
12
        $this->getClient()->push(
13
            $this->getResponseMock(true, 5),
14
            function (RpcRequestInterface $request) {
15
                self::assertEquals('prefixed-entity/count', $request->getMethod());
16
                self::assertEquals(
17
                    [
18
                        'criteria' => ['prefix_payload' => 'test'],
19
                    ],
20
                    $request->getParameters()
21
                );
22
23
                return true;
24
            }
25
        );
26
27
        $count = $this->getManager()->getUnitOfWork()->getEntityPersister(PrefixedEntity::class)->count(
28
            ['payload' => 'test']
29
        );
30
31
        self::assertEquals(5, $count);
32
    }
33
}
34