You are here

public function RulesTestCase::testAbortOnNULLValues in Rules 7.2

Same name and namespace in other branches
  1. 8.3 d7-tests/rules_test_case.test \RulesTestCase::testAbortOnNULLValues()

Makes sure Rules aborts when NULL values are used.

File

tests/rules.test, line 938
Rules tests.

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