You are here

public function RulesFormsAPITestCase::testGetFormInfo in Rules Forms Support 7

Same name and namespace in other branches
  1. 7.2 rules_forms.test \RulesFormsAPITestCase::testGetFormInfo()

Tests rules_forms_get_form_info().

File

./rules_forms.test, line 717
Stores tests related to Rules Form.

Class

RulesFormsAPITestCase
Tests Rules Forms actions.

Code

public function testGetFormInfo() {
  variable_set('rules_forms_form_info', self::$formInfo);

  // Test getting all form info.
  $info = rules_forms_get_form_info();
  $this
    ->assertEqual($info, self::$formInfo);

  // Test getting info by form ID.
  $form_id = key(self::$formInfo);
  $form_info = rules_forms_get_form_info($form_id);
  $this
    ->assertEqual($form_info, self::$formInfo[$form_id]);

  // Test getting info by $form array.
  $form_info = rules_forms_get_form_info(self::$form);
  $this
    ->assertEqual($form_info, self::$formInfo[self::$form['form_id']['#value']]);
}