You are here

public function WebformTestCase::testWebformPost in Webform 7.3

Same name and namespace in other branches
  1. 6.3 tests/webform.test \WebformTestCase::testWebformPost()
  2. 6.2 tests/webform.test \WebformTestCase::testWebformPost()

Generate a list of all values that would result in a valid submission.

1 call to WebformTestCase::testWebformPost()
WebformSubmissionTestCase::webformSubmissionExecute in tests/submission.test
Execute the submission test.

File

tests/webform.test, line 712
Webform module tests.

Class

WebformTestCase

Code

public function testWebformPost() {
  $edit = array();
  foreach ($this
    ->testWebformComponents() as $key => $component_info) {
    if (is_array($component_info['sample values'])) {
      foreach ($component_info['sample values'] as $subkey => $value) {
        $edit["submitted[{$key}][{$subkey}]"] = $value;
      }
    }
    elseif ($component_info['sample values'] != NULL) {
      $value = $component_info['sample values'];

      // Multiple selects have a funky extra empty bracket in the name.
      $extra = $key == 'select_multiple' ? '[]' : '';
      $edit["submitted[{$key}]{$extra}"] = $value;
    }
  }
  return $edit;
}