Skip to content

Commit

Permalink
Merge branch '4.13' into 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Jun 21, 2023
2 parents 220fee6 + ab4802c commit fb7d225
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ORM/PaginatedList.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ public function NotFirstPage()
*/
public function LastPage()
{
return $this->CurrentPage() == $this->TotalPages();
return $this->CurrentPage() >= $this->TotalPages();
}

/**
Expand Down
11 changes: 11 additions & 0 deletions tests/php/ORM/PaginatedListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,20 @@ public function testLastPage()
$list = new PaginatedList(new ArrayList());
$list->setTotalItems(50);

$this->assertFalse($list->LastPage());
$list->setCurrentPage(4);
$this->assertFalse($list->LastPage());
$list->setCurrentPage(5);
$this->assertTrue($list->LastPage());
$list->setCurrentPage(6);
$this->assertTrue($list->LastPage());

$emptyList = new PaginatedList(new ArrayList());
$emptyList->setTotalItems(0);

$this->assertTrue($emptyList->LastPage());
$emptyList->setCurrentPage(1);
$this->assertTrue($emptyList->LastPage());
}

public function testNotLastPage()
Expand Down

0 comments on commit fb7d225

Please sign in to comment.