function RulesTestCase::testAbortOnNULLValues

Same name in other branches
  1. 7.x-2.x tests/rules.test \RulesTestCase::testAbortOnNULLValues()

Make sure Rules aborts when NULL values are used.

File

d7-tests/rules_test_case.test, line 898

Class

RulesTestCase

Code

function testAbortOnNULLValues() {
    $rule = rule(array(
        'node' => array(
            'type' => 'node',
        ),
    ));
    $rule->action('drupal_message', array(
        'message:select' => 'node:log',
    ));
    $rule->integrityCheck();
    // Test the rule.
    $node = $this->drupalCreateNode();
    $node->log = NULL;
    $rule->execute($node);
    $text = RulesLog::logger()->render();
    $msg = RulesTestCase::t('The variable or parameter %message is empty.', array(
        'message',
    ));
    $this->assertTrue(strpos($text, $msg) !== FALSE, 'Evaluation aborted due to an empty argument value.');
}