2009-04-17 04:26:40 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Various tests for the user defined forms.
|
|
|
|
* Does not test the user interface in the admin.
|
|
|
|
*
|
|
|
|
* @todo Add more comprehensive tests
|
|
|
|
* @package userforms
|
|
|
|
*/
|
|
|
|
|
2009-09-23 00:36:53 +02:00
|
|
|
class UserDefinedFormFieldTest extends SapphireTest {
|
2009-04-17 04:26:40 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Basic Test creating all the editable form fields
|
|
|
|
*/
|
|
|
|
function testCreatingAllFields() {
|
|
|
|
$fields = ClassInfo::subclassesFor('EditableFormField');
|
|
|
|
foreach($fields as $field) {
|
|
|
|
$object = new $field();
|
|
|
|
$object->Name = "$field";
|
|
|
|
$object->Title = "$field";
|
|
|
|
$object->write();
|
|
|
|
|
|
|
|
$this->assertEquals($field, $object->Name);
|
2009-04-17 04:29:40 +02:00
|
|
|
$object->delete();
|
2009-04-17 04:26:40 +02:00
|
|
|
}
|
|
|
|
}
|
2009-09-23 00:36:53 +02:00
|
|
|
}
|