protected function UCXFTestCase::generateDefaultValue in Extra Fields Checkout Pane 6.2
Same name and namespace in other branches
- 7 uc_extra_fields_pane.test \UCXFTestCase::generateDefaultValue()
Generates a default value for field $field.
Parameters
UCXF_Field $field:
Return value
string
1 call to UCXFTestCase::generateDefaultValue()
- UCXFTestCase::getEditValues in ./
uc_extra_fields_pane.test - Generates an array of values to post into an address form
File
- ./
uc_extra_fields_pane.test, line 316 - Automated tests for Extra Fields Pane
Class
- UCXFTestCase
- Base class for all Extra Fields Pane test cases.
Code
protected function generateDefaultValue($field) {
switch ($field->value_type) {
case UCXF_Field::UCXF_WIDGET_TYPE_CONSTANT:
case UCXF_Field::UCXF_WIDGET_TYPE_PHP:
return NULL;
case UCXF_Field::UCXF_WIDGET_TYPE_CHECKBOX:
return 1;
case UCXF_Field::UCXF_WIDGET_TYPE_TEXTFIELD:
return $this
->randomString(12);
case UCXF_Field::UCXF_WIDGET_TYPE_SELECT:
case UCXF_Field::UCXF_WIDGET_TYPE_PHP_SELECT:
return 'option2';
}
}