public function RulesFormsAPITestCase::testEventButtonSubmit in Rules Forms Support 7
Same name and namespace in other branches
- 7.2 rules_forms.test \RulesFormsAPITestCase::testEventButtonSubmit()
 
Tests rules_forms_event_button_submit().
File
- ./
rules_forms.test, line 822  - Stores tests related to Rules Form.
 
Class
- RulesFormsAPITestCase
 - Tests Rules Forms actions.
 
Code
public function testEventButtonSubmit() {
  // Add the button to the $form_info array.
  $form_info = self::$formInfo;
  $form_info[self::$formId]['submit']['fieldset:button:test'] = array();
  variable_set('rules_forms_form_info', $form_info);
  // Indicate that this button was clicked.
  $form_state = self::$formState;
  $form_state['triggering_element'] = array(
    '#rules_forms_element_id' => 'fieldset:button:test',
  );
  // Ensure that the build information variables are unset for the form.
  self::$formState['rules_forms']['form_values'] = array(
    'textfield:title' => 'tset',
    'textarea:body:und:0:value' => 'tset',
  );
  rules_forms_event_button_submit(self::$form, $form_state);
  $this
    ->assertFalse(isset(self::$formState['rules_forms']), 'Ensure the form build info is unset.');
}