function RulesTriggerTestCase::testBasicReactionRule in Rules 8.3
Same name and namespace in other branches
- 7.2 tests/rules.test \RulesTriggerTestCase::testBasicReactionRule()
Tests creating and triggering a basic reaction rule.
File
- d7-tests/
rules_test_trigger_case.test, line 69 - Rules 7.x tests.
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());
}