mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
Updated frameworktest to allow for testing of DateField_Disabled, and to allow for testing both inside and outside the CMS
This commit is contained in:
parent
236711fe4d
commit
32730154e1
@ -9,6 +9,7 @@ class BasicFieldsTestPage extends TestPage {
|
||||
'CalendarDate' => 'Date',
|
||||
'CompositeDate' => 'Date',
|
||||
'Date' => 'Date',
|
||||
"DateDisabled" => "Date",
|
||||
'DMYCalendarDate' => 'Date',
|
||||
'DMYDate' => 'Date',
|
||||
'DropdownTime' => 'Time',
|
||||
@ -46,6 +47,7 @@ class BasicFieldsTestPage extends TestPage {
|
||||
|
||||
static $defaults = array(
|
||||
'Readonly' => 'Default value for \'readonly\'',
|
||||
"DateDisabled" => "2002-10-23",
|
||||
);
|
||||
|
||||
function getCMSFields() {
|
||||
@ -83,6 +85,7 @@ class BasicFieldsTestPage extends TestPage {
|
||||
new CalendarDateField('CalendarDate','CalendarDateField'),
|
||||
new CompositeDateField('CompositeDate','CompsiteDateField'),
|
||||
new DateField('Date','DateField'),
|
||||
new DateField_Disabled("DateDisabled","DateField_Disabled (should be 2002-10-23)"),
|
||||
new DMYCalendarDateField('DMYCalendarDate','DMYCalendarDateField'),
|
||||
new DMYDateField('DMYDate','DMYDateField'),
|
||||
new DropdownTimeField('DropdownTime','DropdownTimeField'),
|
||||
@ -114,4 +117,4 @@ class BasicFieldsTestPage_Controller extends TestPage_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@ -31,6 +31,21 @@ class TestPage extends Page {
|
||||
* Parent class of all test page controllers
|
||||
*/
|
||||
class TestPage_Controller extends Page_Controller {
|
||||
/**
|
||||
* This form is exactly like the CMS form. It gives us an opportunity to test the fields outside of the CMS context
|
||||
*/
|
||||
function Form() {
|
||||
$fields = $this->getCMSFields();
|
||||
$actions = new FieldSet(new FormAction("save", "Save"));
|
||||
$form = new Form($this, "Form", $fields, $actions);
|
||||
$form->loadDataFrom($this->dataRecord);
|
||||
return $form;
|
||||
}
|
||||
|
||||
function save($data, $form) {
|
||||
$form->saveInto($this->dataRecord);
|
||||
$this->dataRecord->write();
|
||||
Director::redirectBack();
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue
Block a user