You are here

function RulesTriggerTestCase::testVariableHandlerFailing in Rules 8.3

Same name and namespace in other branches
  1. 7.2 tests/rules.test \RulesTriggerTestCase::testVariableHandlerFailing()

Test aborting silently when handlers are not able to load.

File

d7-tests/rules_test_trigger_case.test, line 123
Rules 7.x tests.

Class

RulesTriggerTestCase
Test triggering rules.

Code

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.");
}