function RulesTriggerTestCase::testVariableHandlerFailing

Same name in other branches
  1. 8.x-3.x d7-tests/rules_test_trigger_case.test \RulesTriggerTestCase::testVariableHandlerFailing()

Tests aborting silently when handlers are not able to load.

File

tests/rules.test, line 1230

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