public function RulesTestCase::testActionSetup in Rules 7.2
Same name and namespace in other branches
- 8.3 d7-tests/rules_test_case.test \RulesTestCase::testActionSetup()
Tests setting up an action, serializing, and executing it.
File
- tests/
rules.test, line 164 - Rules tests.
Class
- RulesTestCase
- Rules test cases.
Code
public function testActionSetup() {
$action = rules_action('rules_node_publish_action');
$s = serialize($action);
$action2 = unserialize($s);
$node = (object) array(
'status' => 0,
'type' => 'page',
);
$node->title = 'test';
$action2
->execute($node);
$this
->assertEqual($node->status, 1, 'Action executed correctly');
$this
->assertTrue(in_array('node', array_keys($action2
->parameterInfo())), 'Parameter info returned.');
$node->status = 0;
$action2
->integrityCheck();
$action2
->executeByArgs(array(
'node' => $node,
));
$this
->assertEqual($node->status, 1, 'Action executed correctly');
// Test calling an extended + overridden method.
$this
->assertEqual($action2
->help(), 'custom', 'Using custom help callback.');
// Inspect the cache
// $this->pass(serialize(rules_get_cache()));
RulesLog::logger()
->checkLog();
}