public function testrun_actions() { $aowWorkFlow = new AOW_WorkFlow(); //prepare the required objects and variables $aowWorkFlow->id = 1; $call = new Call(); $call->id = 1; //execute the method and verify if it creates records in processed table $result = $aowWorkFlow->run_actions($call); //test for a entry in AOW_Processed table. $processed = new AOW_Processed(); $processed->retrieve_by_string_fields(array('aow_workflow_id' => 1, 'parent_id' => 1)); //test for record ID to verify that record is saved $this->assertTrue(isset($processed->id)); $this->assertEquals(36, strlen($processed->id)); //mark the record as deleted and verify that this record cannot be retrieved anymore. $processed->mark_deleted($processed->id); $result = $processed->retrieve($processed->id); $this->assertEquals(null, $result); }
/** * Select and run all active flows for the specified bean */ function run_bean_flows(SugarBean &$bean) { if ($_REQUEST['module'] != 'Import') { $query = "SELECT id FROM aow_workflow WHERE aow_workflow.flow_module = '" . $bean->module_dir . "' AND aow_workflow.status = 'Active' AND aow_workflow.deleted = 0 "; $result = $this->db->query($query, false); $flow = new AOW_WorkFlow(); while (($row = $bean->db->fetchByAssoc($result)) != null) { $flow->retrieve($row['id']); if ($flow->check_valid_bean($bean)) { $flow->run_actions($bean, true); } } } return true; }