function RulesTestCase::testNamedParameters

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

Tests the named parameter mode.

File

tests/rules.test, line 924

Class

RulesTestCase
Rules test cases.

Code

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