You are here

public function RulesFormsEventsTestCase::testButtonValidate in Rules Forms Support 7.2

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

Tests the button validate event.

File

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

Class

RulesFormsEventsTestCase
Tests Rules Forms events.

Code

public function testButtonValidate() {
  $rule = rules_reaction_rule();
  $rule
    ->event('rules_forms_article_node_form_button_submit_actions_preview_validate')
    ->action('drupal_message', array(
    'message' => 'Button level validate successful!',
  ));
  $edit = array();
  $edit['title'] = 'test';
  $this
    ->drupalPost('node/add/article', $edit, t('Preview'));
  $this
    ->assertNoText('Button level validate successful!');
  $rule
    ->save('test');
  $this
    ->drupalPost('node/add/article', $edit, t('Preview'));
  $this
    ->assertText('Button level validate successful!');
}