PaginatorTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 1
eloc 22
c 1
b 1
f 0
dl 0
loc 30
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testDebugInfo() 0 28 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Lampager\Cake\Test\TestCase;
6
7
use Lampager\Cake\ORM\Query;
8
use Lampager\Cake\Paginator;
9
use Lampager\Query\Order;
10
use PHPUnit\Framework\MockObject\MockObject;
11
12
class PaginatorTest extends TestCase
13
{
14
    public function testDebugInfo(): void
15
    {
16
        /** @var MockObject&Query */
17
        $builder = $this->getMockBuilder(Query::class)
18
            ->disableOriginalConstructor()
19
            ->getMock();
20
21
        $paginator = (new Paginator($builder))
22
            ->orderBy('modified')
23
            ->orderBy('id')
24
            ->limit(3)
25
            ->forward()
26
            ->inclusive()
27
            ->seekable();
28
29
        $actual = $paginator->__debugInfo();
30
        $this->assertEquals([
31
            'query' => [
32
                'orders' => [
33
                    new Order('modified', 'asc'),
34
                    new Order('id', 'asc'),
35
                ],
36
                'limit' => 3,
37
                'forward' => true,
38
                'inclusive' => true,
39
                'seekable' => true,
40
            ],
41
        ], $actual);
42
    }
43
}
44