Skip to content

Commit

Permalink
Merge pull request #4198 from kenjis/add-getPageCount
Browse files Browse the repository at this point in the history
Add PagerRenderer::getPageCount()
  • Loading branch information
paulbalandan authored Feb 6, 2021
2 parents fa0ea55 + ba05600 commit 6660ce9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
10 changes: 10 additions & 0 deletions system/Pager/PagerRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
19 changes: 7 additions & 12 deletions tests/system/Pager/PagerRendererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 6660ce9

Please sign in to comment.