function RulesTriggerTestCase::testVariableHandlerFailing

Same name in other branches
  1. 7.x-2.x 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

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