testPaginationAdapter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 9.584
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace League\Fractal\Test\Pagination;
4
5
use League\Fractal\Pagination\PhalconFrameworkPaginatorAdapter;
6
use League\Fractal\Test\TestCase;
7
8
class PhalconFrameworkPaginatorAdapterTest extends TestCase
9
{
10
    public function testPaginationAdapter()
11
    {
12
        $resultset = new \stdClass();
13
        $resultset->items       = array_fill(1, 10, 'fractal');
14
        $resultset->current     = 3;
15
        $resultset->first       = 1;
16
        $resultset->last        = 5;
17
        $resultset->next        = 4;
18
        $resultset->previous    = 2;
19
        $resultset->total_items = 50;
20
        $resultset->total_pages = 10;
21
22
        $adapter = new PhalconFrameworkPaginatorAdapter($resultset);
23
        $this->assertInstanceOf('League\Fractal\Pagination\PaginatorInterface', $adapter);
24
        $this->assertSame(3, $adapter->getCurrentPage());
25
        $this->assertSame(10, $adapter->getCount());
26
        $this->assertSame(50, $adapter->getTotal());
27
        $this->assertSame(10, $adapter->getPerPage());
28
        $this->assertSame(5, $adapter->getLastPage());
29
        $this->assertSame(4, $adapter->getNext());
30
    }
31
}
32