diff --git a/tests/forms/gridfield/GridFieldToolbarHeaderTest.php b/tests/forms/gridfield/GridFieldToolbarHeaderTest.php index 2f67df433..f4634522b 100644 --- a/tests/forms/gridfield/GridFieldToolbarHeaderTest.php +++ b/tests/forms/gridfield/GridFieldToolbarHeaderTest.php @@ -1,6 +1,11 @@ logInWithPermission('ADMIN'); @@ -8,7 +13,7 @@ class GridFieldToolbarHeaderTest extends SapphireTest { $config = new GridFieldConfig(); $config->addComponent($titleField = new GridFieldToolbarHeader()); $actions = new FieldList(); - $grid = new GridField('TestField', 'Test Field', new DataList('Company'),$config); + $grid = new GridField('TestField', 'Test Field', new DataList('GridFieldDetailFormTest_Company'),$config); $fields = new FieldList($rootTab = new TabSet("Root",$tabMain = new Tab('Main',$grid))); $form = new Form(Controller::curr(), "TestForm", $fields, $actions); @@ -23,7 +28,7 @@ class GridFieldToolbarHeaderTest extends SapphireTest { $config = new GridFieldConfig(); $config->addComponent($titleField = new GridFieldToolbarHeader()); $actions = new FieldList(); - $grid = new GridField('TestField', 'Test Field', new DataList('Company'),$config); + $grid = new GridField('TestField', 'Test Field', new DataList('GridFieldDetailFormTest_Company'),$config); $fields = new FieldList($rootTab = new TabSet("Root",$tabMain = new Tab('Main',$grid))); $form = new Form(Controller::curr(), "TestForm", $fields, $actions); @@ -36,11 +41,18 @@ class GridFieldToolbarHeaderTest extends SapphireTest { if(Member::currentUser()) { Member::currentUser()->logOut(); } $config = new GridFieldConfig(); $config->addComponent($titleField = new GridFieldToolbarHeader()); - $grid = new GridField('TestField', 'Test Field', new DataList('Company'),$config); + $grid = new GridField('TestField', 'Test Field', new DataList('GridFieldDetailFormTest_Company'),$config); $fields = new FieldList(new TabSet("Root",$tabMain = new Tab('Main',$grid))); $form = new Form(Controller::curr(), "TestForm", $fields, new FieldList()); $html = $form->forTemplate(); $this->assertNotContains('data-icon="add"', $html, "HTML should not contain the 'add new' button"); } -} \ No newline at end of file +} +class GridFieldDetailFormTest_Company extends DataObject implements TestOnly { + + public static $db = array( + 'Name' => 'Varchar(100)' + ); + +} diff --git a/tests/forms/gridfield/GridFieldToolbarHeaderTest.yml b/tests/forms/gridfield/GridFieldToolbarHeaderTest.yml new file mode 100644 index 000000000..574d87a62 --- /dev/null +++ b/tests/forms/gridfield/GridFieldToolbarHeaderTest.yml @@ -0,0 +1,5 @@ +GridFieldDetailFormTest_Company: + test-company-1: + Name: Test company 1 + test-company-2: + Name: Test company 2