function RulesTriggerTestCase::testBasicReactionRule

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

Tests creating and triggering a basic reaction rule.

File

d7-tests/rules_test_trigger_case.test, line 69

Class

RulesTriggerTestCase
Test triggering rules.

Code

function testBasicReactionRule() {
    $node = $this->drupalCreateNode(array(
        'type' => 'page',
    ));
    $rule = $this->createTestRule();
    $rule->integrityCheck()
        ->save();
    // Test the basics of the event set work right.
    $event = rules_get_cache('event_node_presave');
    $this->assertEqual(array_keys($event->parameterInfo()), array(
        'node',
    ), 'EventSet returns correct argument info.');
    // Trigger the rule by updating the node.
    $nid = $node->nid;
    $node->status = 0;
    node_save($node);
    RulesLog::logger()->checkLog();
    $this->assertFalse(node_load($nid), 'Rule successfully triggered and executed');
    
    //debug(RulesLog::logger()->render());
}