You are here

protected function UCXFApiTestCase::createFieldThroughAPI in Extra Fields Checkout Pane 7

Same name and namespace in other branches
  1. 6.2 uc_extra_fields_pane.test \UCXFApiTestCase::createFieldThroughAPI()

Creates a field through the API and sets default values.

Parameters

string $pane_type: The pane the field must go into. Can be multiple panes.

array $values: (optional) a list of values to set.

Return value

UCXF_Field

1 call to UCXFApiTestCase::createFieldThroughAPI()
UCXFApiTestCase::testUCXF_FieldList in ./uc_extra_fields_pane.test
Test if UCXF_FieldList behaves as excepted.

File

./uc_extra_fields_pane.test, line 528
Automated tests for Extra Fields Pane

Class

UCXFApiTestCase
API Test

Code

protected function createFieldThroughAPI($pane_type, $values = array()) {
  $field = UCXF_FieldList::createField($pane_type);
  $field->pane_type = $pane_type;
  $field->db_name = 'ucxf_' . drupal_strtolower($this
    ->randomName());
  $field->label = $this
    ->randomName();
  $field
    ->from_array($values);
  return $field;
}