You are here

private function WebformDefaultFieldsTestCase::addTestComponent in Webform Default Fields 7.4

Add field to node.

2 calls to WebformDefaultFieldsTestCase::addTestComponent()
WebformDefaultFieldsTestCase::testNodeAdding in tests/webform_default_fields.test
Test adding field to node.
WebformDefaultFieldsTestCase::testNodeAddingWithTwoFields in tests/webform_default_fields.test
Test adding two fields to node.

File

tests/webform_default_fields.test, line 39
Webform Default Fields module tests.

Class

WebformDefaultFieldsTestCase
Tests the module functionality.

Code

private function addTestComponent() {
  $nid = _webform_default_fields_container_node($this->contentType);
  $component = array(
    'nid' => $nid,
    'pid' => 0,
    'form_key' => $this->fieldCounter . uniqid(),
    'name' => 'Test field ' . $this->fieldCounter,
    'type' => 'textfield',
    'extra' => array(
      'title_display' => 'before',
      'disabled' => 0,
      'unique' => 0,
      'conditional_operator' => '=',
    ),
    'mandatory' => 0,
    'weight' => $this->fieldCounter,
  );
  webform_component_insert($component);
  $this->fieldCounter++;
}