/** * @covers SilverStripe\Forms\GridField\GridField::__construct * @covers SilverStripe\Forms\GridField\GridField::getConfig * @covers SilverStripe\Forms\GridField\GridFieldConfig_Base::__construct * @covers SilverStripe\Forms\GridField\GridFieldConfig::addComponent */ public function testGridFieldDefaultConfig() { $obj = new GridField('testfield', 'testfield'); $expectedComponents = new ArrayList(array(new GridFieldToolbarHeader(), $sort = new GridFieldSortableHeader(), $filter = new GridFieldFilterHeader(), new GridFieldDataColumns(), new GridFieldPageCount('toolbar-header-right'), $pagination = new GridFieldPaginator(), new GridState_Component())); $sort->setThrowExceptionOnBadDataType(false); $filter->setThrowExceptionOnBadDataType(false); $pagination->setThrowExceptionOnBadDataType(false); $this->assertEquals($expectedComponents, $obj->getConfig()->getComponents(), 'Testing default Config'); }
/** * * @param int $itemsPerPage - How many items should be displayed per page */ public function __construct($itemsPerPage = null) { $this->itemsPerPage = $itemsPerPage ?: GridFieldPaginator::config()->get('default_items_per_page'); }