Passed
Push — master ( 9dbeef...fdd166 )
by Petr
07:45
created

CliExpandPagerTest::end()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace BasicTests;
4
5
6
use CommonTestClass;
7
use kalanis\kw_paging\Render;
8
9
10
class CliExpandPagerTest extends CommonTestClass
11
{
12
    public function testMiddle(): void
13
    {
14
        $position = $this->getPositions();
15
        $position->getPager()->setActualPage(4);
16
        $pager = new Render\CliExpandPager($position);
17
        $this->assertEquals($this->middle(), strval($pager));
18
    }
19
20
    protected function middle(): string
21
    {
22
        return '<< 1 | < 3 | 1 | 2 | 3 | *4* | 5 | 6 | 7 | 5 > | 7 >>' . PHP_EOL . 'Showing results 37 - 48 of total 75';
23
    }
24
25
    public function testStart(): void
26
    {
27
        $position = $this->getPositions();
28
        $position->getPager()->setActualPage($position->getFirstPage());
29
        $pager = new Render\CliExpandPager($position);
30
        $this->assertEquals($this->start(), strval($pager));
31
    }
32
33
    protected function start(): string
34
    {
35
        return '-- | - | *1* | 2 | 3 | 4 | 5 | 6 | 7 | 2 > | 7 >>' . PHP_EOL . 'Showing results 1 - 12 of total 75';
36
    }
37
38
    public function testEnd(): void
39
    {
40
        $position = $this->getPositions();
41
        $position->getPager()->setActualPage($position->getLastPage());
42
        $pager = new Render\CliExpandPager($position);
43
        $this->assertEquals($this->end(), strval($pager));
44
    }
45
46
    protected function end(): string
47
    {
48
        return '<< 1 | < 6 | 1 | 2 | 3 | 4 | 5 | 6 | *7* | - | --' . PHP_EOL . 'Showing results 73 - 75 of total 75';
49
    }
50
51
    public function testNothing(): void
52
    {
53
        $position = $this->getPositions();
54
        $position->getPager()->setMaxResults(10)->setActualPage($position->getFirstPage());
55
        $pager = new Render\CliExpandPager($position);
56
        $this->assertEquals($this->nothing(), strval($pager));
57
    }
58
59
    protected function nothing(): string
60
    {
61
        return 'Showing results 1 - 10 of total 10';
62
    }
63
}
64