silverstripe-framework/tests/forms/GridFieldFunctionalTest.php
Stig Lindqvist 83e90aaafe ENHANCEMENT Release of DataGridPagination
This class extends the DataGridPresenter with the behaviour and looks of a paginated Datagrid.
2011-10-28 17:34:15 +13:00

45 lines
1.1 KiB
PHP

<?php
/**
* This is a functional test for GridFieldFunctionalTest
*
*/
class GridFieldFunctionalTest extends FunctionalTest {
/**
*
* @var string
*/
static $fixture_file = 'sapphire/tests/forms/GridFieldTest.yml';
/**
*
* @var array
*/
protected $extraDataObjects = array(
'GridFieldTest_Person',
);
public function testAddToForm() {
$firstPerson = $this->objFromFixture('GridFieldTest_Person', 'first');
$response = $this->get("GridFieldFunctionalTest_Controller/");
$this->assertContains($firstPerson->Name, $response->getBody());
}
}
class GridFieldFunctionalTest_Controller extends Controller {
protected $template = 'BlankPage';
function Link($action = null) {
return Controller::join_links('GridFieldFunctionalTest_Controller', $action);
}
public function index() {
$grid = new GridField('testgrid');
$dataSource = DataList::create("GridFieldTest_Person")->sort("Name");
$grid->setList($dataSource);
$form = new Form($this, 'gridform', new FieldList($grid), new FieldList(new FormAction('rerender', 'rerender')));
return array('Form'=>$form);
}
}