You are here

public function CommerceWebformTestCase::addTextFieldToWebform in Commerce Webform 7.2

Parameters

$node:

$label:

$key:

string $default_value:

bool|FALSE $required:

bool|FALSE $unique:

1 call to CommerceWebformTestCase::addTextFieldToWebform()
CommerceWebformTestCase::testSingleProductNoQuantitiesCommerceWebform in tests/commerce_webform.test
Test the ability to create a webform and add a product to it.

File

tests/commerce_webform.test, line 135
Commerce Webform tests.

Class

CommerceWebformTestCase
Test Commerce Webform module's features.

Code

public function addTextFieldToWebform($node, $label, $key, $default_value = '', $required = FALSE, $unique = FALSE) {
  $settings = array(
    'name' => $label,
    'form_key' => $key,
    'extra[description]' => 'This is a description',
    'value' => $default_value,
    'required' => $required,
    'extra[unique]' => $unique,
  );
  $this
    ->drupalPost("node/{$node->nid}/webform/components/new/textfield", $settings, 'Save component', array(
    'query' => array(
      'name' => $label,
      'required' => $required ? 1 : 0,
      'pid' => 0,
      'weight' => 0,
    ),
  ));
}