function RulesTestCase::testClassBasedActions

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

Tests making use of class based actions.

File

d7-tests/rules_test_case.test, line 197

Class

RulesTestCase

Code

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