function RulesTriggerTestCase::testDefaultRule
Same name in other branches
- 7.x-2.x tests/rules.test \RulesTriggerTestCase::testDefaultRule()
Tests the provided default rule 'rules_test_default_1'.
File
-
d7-tests/
rules_test_trigger_case.test, line 192
Class
- RulesTriggerTestCase
- Test triggering rules.
Code
function testDefaultRule() {
$rule = rules_config_load('rules_test_default_1');
$this->assertTrue($rule->status & ENTITY_IN_CODE && !($rule->status & ENTITY_IN_DB), 'Default rule can be loaded and has the right status.');
// Enable.
$rule->active = TRUE;
$rule->save();
// Create a node that triggers the rule.
$node = $this->drupalCreateNode(array(
'type' => 'page',
'sticky' => 0,
'status' => 0,
));
// Clear messages.
drupal_get_messages();
// Let event node_update occur.
node_save($node);
$msg = drupal_get_messages();
$this->assertEqual($msg['status'][0], 'A node has been updated.', 'Default rule has been triggered.');
}