function RulesTestCase::testNamedParameters in Rules 8.3
Same name and namespace in other branches
- 7.2 tests/rules.test \RulesTestCase::testNamedParameters()
Test the named parameter mode.
File
- d7-tests/rules_test_case.test, line 883 
- Rules 7.x tests.
Class
Code
function testNamedParameters() {
  $rule = rule(array(
    'node' => array(
      'type' => 'node',
    ),
  ));
  $rule
    ->action('rules_action_node_set_title', array(
    'title' => 'foo',
  ));
  $rule
    ->integrityCheck();
  // Test the rule.
  $node = $this
    ->drupalCreateNode(array(
    'type' => 'page',
    'sticky' => 0,
  ));
  $rule
    ->execute($node);
  $this
    ->assertTrue($node->title == 'foo', 'Action with named parameters has been correctly executed.');
  RulesLog::logger()
    ->checkLog();
}