/** * @param boolean $isValid * @param boolean $inStorage * @param int $position * @param array $entityIds * @param array $expected * * @dataProvider getCurrentNumberDataProvider */ public function testGetCurrentNumber($isValid, $inStorage, $position, array $entityIds, $expected) { $this->assertPrepareNavigation($isValid, $inStorage, $entityIds); $this->storage->expects($this->any())->method('getCurrentPosition')->with($this->entity)->will($this->returnValue($position)); $result = $this->navigation->getCurrentNumber($this->entity); $this->assertSame($expected, $result); }
/** * Null - pager data is not accessible * Array('total' => <int>, 'current' => <int>) - used to generate string "<current> of <total>" * * @param object $entity * @param string $scope * @return null|array */ public function getPager($entity, $scope) { $totalCount = $this->paginationNavigation->getTotalCount($entity, $scope); if (!$totalCount) { return null; } $currentNumber = $this->paginationNavigation->getCurrentNumber($entity, $scope); if (!$currentNumber) { return null; } return ['total' => $totalCount, 'current' => $currentNumber]; }