diff --git a/model/ListDecorator.php b/model/ListDecorator.php index 83bf7ad35..6ba6edb90 100644 --- a/model/ListDecorator.php +++ b/model/ListDecorator.php @@ -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() { diff --git a/tests/model/GroupedListTest.php b/tests/model/GroupedListTest.php index e5c426692..4d5c5cd41 100644 --- a/tests/model/GroupedListTest.php +++ b/tests/model/GroupedListTest.php @@ -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()); + } + }