Merge branch '5.0' into 5

This commit is contained in:
Guy Sartorelli 2023-06-22 11:19:59 +12:00
commit 0c40cc9b3d
No known key found for this signature in database
GPG Key ID: F313E3B9504D496A
2 changed files with 12 additions and 1 deletions

View File

@ -428,7 +428,7 @@ class PaginatedList extends ListDecorator
*/
public function LastPage()
{
return $this->CurrentPage() == $this->TotalPages();
return $this->CurrentPage() >= $this->TotalPages();
}
/**

View File

@ -300,9 +300,20 @@ class PaginatedListTest extends SapphireTest
$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()