You are here

public function RulesTriggerTestCase::testVariableHandlerFailing in Rules 7.2

Same name and namespace in other branches
  1. 8.3 d7-tests/rules_test_trigger_case.test \RulesTriggerTestCase::testVariableHandlerFailing()

Tests aborting silently when handlers are not able to load.

File

tests/rules.test, line 1229
Rules tests.

Class

RulesTriggerTestCase
Test triggering rules.

Code

public function testVariableHandlerFailing() {
  $rule = $this
    ->createTestRule(FALSE, 'node_presave');
  $rule
    ->action('rules_node_publish_action_save', array(
    'node:select' => 'node_unchanged',
  ));
  $rule
    ->integrityCheck()
    ->save();

  // On insert it's not possible to get the unchanged node during presave.
  $node = $this
    ->drupalCreateNode(array(
    'type' => 'page',
    'sticky' => 0,
    'status' => 0,
  ));

  // debug(RulesLog::logger()->render());
  $text = RulesTestCase::t('Unable to load variable %node_unchanged, aborting.', array(
    'node_unchanged',
  ));
  $this
    ->assertTrue(strpos(RulesLog::logger()
    ->render(), $text) !== FALSE, "Aborted evaluation.");
}