protected function WebformWorkflowBaseTestCase::enableWorkflow in Webform Workflow 7
Enable workflow for a webform (programmatically).
2 calls to WebformWorkflowBaseTestCase::enableWorkflow()
- WebformWorkflowBaseTestCase::addStateToWebform in tests/
webform_workflow_base.test - Add a workflow state to a webform (programmatically).
- WebformWorkflowPermissionsTestCase::testFromTo in tests/
webform_workflow_permissions.test - Test permissions for changing a submission's state.
File
- tests/
webform_workflow_base.test, line 50 - Base class for Webform Workflow tests.
Class
- WebformWorkflowBaseTestCase
- @file Base class for Webform Workflow tests.
Code
protected function enableWorkflow($node, array $data = array()) {
if (webform_workflow_is_enabled($node)) {
return;
}
if (!in_array($node->type, webform_node_types())) {
throw new Exception('Cannot enable workflow for a non-webform node');
}
$data += array(
'emails' => webform_workflow_get_default_email(),
);
db_merge('webform_workflow')
->key(array(
'nid' => $node->nid,
))
->fields(array(
'workflow' => 1,
'data' => serialize($data),
))
->execute();
$node->webform_workflow = (object) array(
'workflow' => 1,
'data' => $data,
);
}