mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge branch '4.13' into 5.0
This commit is contained in:
commit
fb7d2256f1
@ -428,7 +428,7 @@ class PaginatedList extends ListDecorator
|
||||
*/
|
||||
public function LastPage()
|
||||
{
|
||||
return $this->CurrentPage() == $this->TotalPages();
|
||||
return $this->CurrentPage() >= $this->TotalPages();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user