public function RulesTestCase::testClassBasedActions in Rules 7.2
Same name and namespace in other branches
- 8.3 d7-tests/rules_test_case.test \RulesTestCase::testClassBasedActions()
Tests making use of class based actions.
File
- tests/
rules.test, line 229 - Rules tests.
Class
- RulesTestCase
- Rules test cases.
Code
public function testClassBasedActions() {
$cache = rules_get_cache();
$this
->assertTrue(!empty($cache['action_info']['rules_test_class_action']), 'Action has been discovered.');
$action = rules_action('rules_test_class_action');
$parameters = $action
->parameterInfo();
$this
->assertTrue($parameters['node'], 'Action parameter needs a value.');
$node = $this
->drupalCreateNode();
$action
->execute($node);
$log = RulesLog::logger()
->get();
$last = array_pop($log);
$last = array_pop($log);
$this
->assertEqual($last[0], 'Action called with node ' . $node->nid, 'Action called');
RulesLog::logger()
->checkLog();
}