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