public function RulesFormsEventsTestCase::testFormValidate in Rules Forms Support 7
Same name and namespace in other branches
- 7.2 rules_forms.test \RulesFormsEventsTestCase::testFormValidate()
Tests the form validate event.
File
- ./
rules_forms.test, line 278 - Stores tests related to Rules Form.
Class
- RulesFormsEventsTestCase
- Tests Rules Forms events.
Code
public function testFormValidate() {
// We use the site information page to perform form validation since
// the node edit form uses button level validation.
$edit = array();
$edit['form_id_label'] = 'Article node form';
$edit['button_validate_submit'] = 1;
$this
->drupalPost('admin/config/workflow/rules/forms/system_site_information_settings/activate/admin%25252Fconfig%25252Fsystem%25252Fsite-information', $edit, t('Activate'));
$rule = rules_reaction_rule();
$rule
->event('rules_forms_system_site_information_settings_form_validate')
->action('drupal_message', array(
'message' => 'Form validate successful!',
));
$edit = array();
$edit['site_name'] = 'test';
$edit['site_mail'] = 'test@test.com';
$this
->drupalPost('admin/config/system/site-information', $edit, t('Save configuration'));
$this
->assertNoText('Form validate successful!');
$rule
->save('test');
$this
->drupalPost('admin/config/system/site-information', $edit, t('Save configuration'));
$this
->assertText('Form validate successful!');
}