You are here

public function RulesFormsEventsTestCase::testFormSubmit in Rules Forms Support 7.2

Same name and namespace in other branches
  1. 7 rules_forms.test \RulesFormsEventsTestCase::testFormSubmit()

Tests the form submit event.

File

./rules_forms.test, line 288
Rules Forms Support tests.

Class

RulesFormsEventsTestCase
Tests Rules Forms events.

Code

public function testFormSubmit() {
  $rule = rules_reaction_rule();
  $rule
    ->event('rules_forms_article_node_form_form_submit')
    ->action('drupal_message', array(
    'message' => 'Form submit successful!',
  ));
  $edit = array();
  $edit['title'] = 'test';
  $this
    ->drupalPost('node/add/article', $edit, t('Save'));
  $this
    ->assertNoText('Form submit successful!');
  $rule
    ->save('test');
  $this
    ->drupalPost('node/add/article', $edit, t('Save'));
  $this
    ->assertText('Form submit successful!');
}