function RulesTestCase::testAbortOnNULLValues

Same name in other branches
  1. 8.x-3.x d7-tests/rules_test_case.test \RulesTestCase::testAbortOnNULLValues()

Makes sure Rules aborts when NULL values are used.

File

tests/rules.test, line 939

Class

RulesTestCase
Rules test cases.

Code

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