diff --git a/system/Pager/PagerRenderer.php b/system/Pager/PagerRenderer.php index b0ba80b0322b..37f289e9affe 100644 --- a/system/Pager/PagerRenderer.php +++ b/system/Pager/PagerRenderer.php @@ -434,6 +434,16 @@ public function getLastPageNumber(): int return $this->last; } + /** + * Returns total number of pages. + * + * @return integer + */ + public function getPageCount(): int + { + return $this->pageCount; + } + /** * Returns the previous page number. * diff --git a/tests/system/Pager/PagerRendererTest.php b/tests/system/Pager/PagerRendererTest.php index 513da74d140b..45f17f3ab7c1 100644 --- a/tests/system/Pager/PagerRendererTest.php +++ b/tests/system/Pager/PagerRendererTest.php @@ -563,9 +563,8 @@ public function testGetNextPageWithSegmentHigherThanZero() public function testGetPageNumber() { - $uri = $this->uri; $details = [ - 'uri' => $uri, + 'uri' => $this->uri, 'pageCount' => 10, 'currentPage' => 3, 'total' => 100, @@ -576,13 +575,13 @@ public function testGetPageNumber() $this->assertEquals(1, $pager->getFirstPageNumber()); $this->assertEquals(3, $pager->getCurrentPageNumber()); $this->assertEquals(10, $pager->getLastPageNumber()); + $this->assertEquals(10, $pager->getPageCount()); } public function testGetPageNumberSetSurroundCount() { - $uri = $this->uri; $details = [ - 'uri' => $uri, + 'uri' => $this->uri, 'pageCount' => 10, 'currentPage' => 5, 'total' => 100, @@ -598,9 +597,8 @@ public function testGetPageNumberSetSurroundCount() public function testGetPreviousPageNumber() { - $uri = $this->uri; $details = [ - 'uri' => $uri, + 'uri' => $this->uri, 'pageCount' => 10, 'currentPage' => 5, 'total' => 100, @@ -614,9 +612,8 @@ public function testGetPreviousPageNumber() public function testGetPreviousPageNumberNull() { - $uri = $this->uri; $details = [ - 'uri' => $uri, + 'uri' => $this->uri, 'pageCount' => 10, 'currentPage' => 1, 'total' => 100, @@ -630,9 +627,8 @@ public function testGetPreviousPageNumberNull() public function testGetNextPageNumber() { - $uri = $this->uri; $details = [ - 'uri' => $uri, + 'uri' => $this->uri, 'pageCount' => 10, 'currentPage' => 5, 'total' => 100, @@ -646,9 +642,8 @@ public function testGetNextPageNumber() public function testGetNextPageNumberNull() { - $uri = $this->uri; $details = [ - 'uri' => $uri, + 'uri' => $this->uri, 'pageCount' => 10, 'currentPage' => 10, 'total' => 100,