function test_assignee_field()
 {
     $form = GFAPI::get_form($this->form_id);
     $assignee_field_properties_json = '{"type":"workflow_assignee_select","id":6,"label":"Assignee","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","inputs":null,"formId":93,"pageNumber":1,"choices":"","conditionalLogic":"","displayOnly":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"inputMask":false,"inputMaskValue":"","allowsPrepopulate":false,"gravityflowAssigneeFieldShowUsers":true,"gravityflowAssigneeFieldShowRoles":true,"gravityflowAssigneeFieldShowFields":true,"cssClass":""}';
     $assignee_field_properties = json_decode($assignee_field_properties_json, true);
     $assignee_field_properties['id'] = 999;
     $assignee_field = new Gravity_Flow_Field_Assignee_Select($assignee_field_properties);
     $form['fields'][] = $assignee_field;
     GFAPI::update_form($form);
     $step_settings = array('assignees' => array('assignee_field|999'));
     $step1_id = $this->_add_user_input_step($step_settings);
     $this->_create_entries();
     $entries = GFAPI::get_entries($this->form_id);
     $entry = $entries[0];
     $entry_id = $entry['id'];
     $entry[999] = 'user_id|1';
     GFAPI::update_entry($entry);
     // simulate submission
     gravity_flow()->maybe_process_feed($entry, $form);
     $this->api->process_workflow($entry_id);
     $entry = GFAPI::get_entry($entry_id);
     // Check status
     $status = $this->api->get_status($entry);
     $this->assertEquals('pending', $status);
     // Complete
     $step1 = $this->api->get_step($step1_id, $entry);
     $step1->update_user_status(1, 'complete');
     $this->api->process_workflow($entry_id);
     // Refresh entry
     $entry = GFAPI::get_entry($entry_id);
     // Check status
     $status = $this->api->get_status($entry);
     $this->assertEquals('complete', $status);
 }
 function get_entries_steps($entry_id)
 {
     $capability = apply_filters('gravityflow_web_api_capability_get_entries_steps', 'gravityflow_create_steps');
     $this->authorize($capability);
     $entry = GFAPI::get_entry($entry_id);
     $form_id = absint($entry['form_id']);
     $api = new Gravity_Flow_API($form_id);
     $form_steps = $api->get_steps();
     $current_step = $api->get_current_step($entry);
     $current_step_id = $current_step->get_id();
     $response = array();
     foreach ($form_steps as $form_step) {
         $step = $api->get_step($form_step->get_id(), $entry);
         $is_current_step = $current_step_id == $step->get_id();
         $response[] = array('id' => $step->get_id(), 'type' => $step->get_type(), 'label' => $step->get_label(), 'name' => $step->get_name(), 'is_current_step' => $is_current_step, 'is_active' => $step->is_active(), 'supports_expiration' => $step->supports_expiration(), 'assignees' => $this->get_assignees_array($step), 'settings' => $step->get_feed_meta(), 'status' => $is_current_step ? $step->evaluate_status() : rgar($entry, 'workflow_step_status_' . $step->get_id()), 'expiration_timestamp' => $step->get_expiration_timestamp(), 'is_expired' => $step->is_expired(), 'is_queued' => $step->is_queued(), 'entry_count' => $step->entry_count());
     }
     $this->end(200, $response);
 }