2011-09-30 00:59:44 +02:00
|
|
|
<?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");
|
2011-10-27 05:11:26 +02:00
|
|
|
$grid->setList($dataSource);
|
2011-09-30 00:59:44 +02:00
|
|
|
$form = new Form($this, 'gridform', new FieldList($grid), new FieldList(new FormAction('rerender', 'rerender')));
|
|
|
|
return array('Form'=>$form);
|
|
|
|
}
|
|
|
|
}
|