Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PagerRenderer::getPageCount() #4198

Merged
merged 2 commits into from
Feb 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions system/Pager/PagerRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,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