Completed
Push — master ( e03925...d40975 )
by Matt
17s queued 12s
created

PhalconFrameworkPaginatorAdapterTest.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace League\Fractal\Test\Pagination;
4
5
use League\Fractal\Pagination\PhalconFrameworkPaginatorAdapter;
6
use PHPUnit\Framework\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);
0 ignored issues
show
$resultset is of type object<stdClass>, but the function expects a object<League\Fractal\Pagination\stdClass>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
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