mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge branch '5.0' into 5
This commit is contained in:
commit
0c40cc9b3d
@ -428,7 +428,7 @@ class PaginatedList extends ListDecorator
|
|||||||
*/
|
*/
|
||||||
public function LastPage()
|
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 = new PaginatedList(new ArrayList());
|
||||||
$list->setTotalItems(50);
|
$list->setTotalItems(50);
|
||||||
|
|
||||||
|
$this->assertFalse($list->LastPage());
|
||||||
|
$list->setCurrentPage(4);
|
||||||
$this->assertFalse($list->LastPage());
|
$this->assertFalse($list->LastPage());
|
||||||
$list->setCurrentPage(5);
|
$list->setCurrentPage(5);
|
||||||
$this->assertTrue($list->LastPage());
|
$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()
|
public function testNotLastPage()
|
||||||
|
Loading…
Reference in New Issue
Block a user