|
Tripal
|
Public Member Functions | |
| __construct ($bundle_name, $machine_names, $entity, $field_info, $instance_info) | |
| getInitializedClass () | |
| getFieldInfo ($field_name) | |
| getInstanceInfo ($bundle_name, $field_name) | |
| mockElement ($delta=0, $langcode=LANGUAGE_NONE, $required=FALSE) | |
| mockForm () | |
| mockFormState ($delta=0, $langcode=LANGUAGE_NONE, $values=NULL) | |
Public Attributes | |
| $initialized_class | |
| $class_name | |
| $field_info | |
| $instance_info | |
| $bundle | |
| $entity | |
| $type | |
| $field_name | |
This class can be included at the top of your TripalTestCase to facillitate testing fields, widgets and formatters.
| TripalFieldTestHelper::__construct | ( | $bundle_name, | |
| $machine_names, | |||
| $entity, | |||
| $field_info, | |||
| $instance_info | |||
| ) |
Create an instance of TripalFieldTestHelper.
Specifcally, initialize the widget class and save it for further testing.
| $bundle_name | The name of the bundle the field should be attached to. This bundle must already exist. |
| $machine_names | An array of machine names including:
|
| $field_info | The Drupal information for the field you want to test. |
| $instance_info | The Drupal information for the field instance you want to test. |
| TripalFieldTestHelper::getFieldInfo | ( | $field_name | ) |
Retrieve the field information for a given field.
| $field_name | The name of the field to retrieve. $field_name can only refer to a non-deleted, active field. |
| TripalFieldTestHelper::getInitializedClass | ( | ) |
Retrieve the initialized class for testing!
| TripalFieldTestHelper::getInstanceInfo | ( | $bundle_name, | |
| $field_name | |||
| ) |
Retrieve the field instance information for a given field.
| $bundle_name | The name of the bundle you want the field attached to. For example, bio_data_1. |
| $field_name | The name of the field to retrieve the instance of. $field_name can only refer to a non-deleted, active field. |
| TripalFieldTestHelper::mockElement | ( | $delta = 0, |
|
$langcode = LANGUAGE_NONE, |
|||
$required = FALSE |
|||
| ) |
Create a fake version of the $element parameter used in many field methods (e.g. TripalFieldWidget::form).
| $delta | The delta for the $element you want to fake. |
| $langcode | The language code for the field/widget. This should usually be LANGUAGE_NONE. |
| $required | True if the widget is required and false otherwise. |
| TripalFieldTestHelper::mockForm | ( | ) |
Create a fake version of the create/edit content form with the current entity attached.
| TripalFieldTestHelper::mockFormState | ( | $delta = 0, |
|
$langcode = LANGUAGE_NONE, |
|||
$values = NULL |
|||
| ) |
Create a fake version of the create/edit content form_state with the current entity attached.
| $delta | The delta for the $element you want to fake. |
| $langcode | The language code for the field/widget. This should usually be LANGUAGE_NONE. |
| $values | An array of values where the key is the form element name and the value is the fake user submmitted value. |