Conditions | 1 |
Paths | 1 |
Total Lines | 31 |
Code Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
10 | public function testPaginationAdapter() |
||
11 | { |
||
12 | $total = 50; |
||
13 | $count = 10; |
||
14 | $perPage = 10; |
||
|
|||
15 | $currentPage = 2; |
||
16 | $lastPage = 5; |
||
17 | |||
18 | $paginate =[ |
||
19 | 'last' => $lastPage, |
||
20 | 'current' => $currentPage, |
||
21 | 'total_items' => $total, |
||
22 | 'total_pages' => $count, |
||
23 | |||
24 | ]; |
||
25 | |||
26 | $paginator = Mockery::mock('Phalcon\Paginator\Adapter\QueryBuilder'); |
||
27 | $paginator->shouldReceive('currentPage')->andReturn($currentPage); |
||
28 | $paginator->shouldReceive('lastPage')->andReturn($lastPage); |
||
29 | $paginator->shouldReceive('count')->andReturn($count); |
||
30 | $paginator->shouldReceive('total')->andReturn($total); |
||
31 | $paginator->shouldReceive('getPaginate')->andReturn((object) $paginate); |
||
32 | |||
33 | $adapter = new PhalconFrameworkPaginatorAdapter($paginator); |
||
34 | |||
35 | $this->assertInstanceOf('League\Fractal\Pagination\PaginatorInterface', $adapter); |
||
36 | $this->assertSame($currentPage, $adapter->getCurrentPage()); |
||
37 | $this->assertSame($lastPage, $adapter->getLastPage()); |
||
38 | $this->assertSame($count, $adapter->getCount()); |
||
39 | $this->assertSame($total, $adapter->getTotal()); |
||
40 | } |
||
41 | |||
47 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.