function RulesTestCase::testNamedParameters

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

Test the named parameter mode.

File

d7-tests/rules_test_case.test, line 883

Class

RulesTestCase

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();
}