mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Corrected TotalItems() method to use Count(). Added test coverage. (fixes #4646)
This commit is contained in:
parent
e07f80014c
commit
6a1a3bf182
@ -81,7 +81,7 @@ abstract class SS_ListDecorator extends ViewableData implements SS_List, SS_Sort
|
||||
}
|
||||
|
||||
public function TotalItems() {
|
||||
return $this->list->TotalItems();
|
||||
return $this->list->Count();
|
||||
}
|
||||
|
||||
public function Count() {
|
||||
|
@ -123,4 +123,31 @@ class GroupedListTest extends SapphireTest {
|
||||
}
|
||||
}
|
||||
|
||||
public function testTotalItems() {
|
||||
$list = GroupedList::create(
|
||||
ArrayList::create(
|
||||
array(
|
||||
ArrayData::create(array(
|
||||
'Name' => 'AAA',
|
||||
'Number' => '111',
|
||||
)),
|
||||
ArrayData::create(array(
|
||||
'Name' => 'BBB',
|
||||
'Number' => '111',
|
||||
)),
|
||||
ArrayData::create(array(
|
||||
'Name' => 'AAA',
|
||||
'Number' => '222',
|
||||
)),
|
||||
ArrayData::create(array(
|
||||
'Name' => 'BBB',
|
||||
'Number' => '111',
|
||||
))
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals(4, $list->TotalItems());
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user