Corrected TotalItems() method to use Count(). Added test coverage. (fixes #4646)

This commit is contained in:
Garion Herman 2015-11-03 23:56:30 +13:00
parent e07f80014c
commit 6a1a3bf182
2 changed files with 28 additions and 1 deletions

View File

@ -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() {

View File

@ -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());
}
}