// // Can be DONE JUST ONCE AFTER write results to DB // -------------------------------------------------------------------------------------------- // Results to DB // // 20130917 - this implementation regarding save_results is confusing. // why ? // because in some situations args->save_results is a number (0) an in other is an array // with just one element with key => test case version ID executed. // if ($args->save_results || $args->do_bulk_save || $args->save_and_next || $args->save_and_exit || $args->doMoveNext || $args->doMovePrevious) { // this has to be done to do not break logic present on write_execution() $args->save_results = $args->save_and_next ? $args->save_and_next : ($args->save_results ? $args->save_results : $args->save_and_exit); if ($args->save_results || $args->do_bulk_save) { $_REQUEST['save_results'] = $args->save_results; write_execution($db, $args, $_REQUEST); } // Need to re-read to update test case status if ($args->save_and_next || $args->doMoveNext || $args->doMovePrevious) { // IMPORTANT DEVELOPMENT NOTICE // Normally this script is called from the tree. // Filters and other conditions (example display test cases just assigned to me,etc) // can be applied, creating a set of test cases that can be used. // Due to size restrictions on POST variables this info is transfered via $_SESSION. // // But because we have choosen to add access to this script from other features // we have forgot to populate this info. // This is the reason for several issues. // The approach will be to understand who is the caller and apply different logics // instead of recreate the logic to populate $_SESSION (I think this approach // will be simpler).
list($tcase_id, $tcversion_id) = processTestCase($tcase, $gui, $args, $cfg, $linked_tcversions, $tree_mgr, $tcase_mgr, $attachmentRepository); } else { list($tcase_id, $tcversion_id) = processTestSuite($db, $gui, $args, $linked_tcversions, $tree_mgr, $tcase_mgr, $attachmentRepository); } // 20100927 - asimon - check if value is an array before calling implode // to avoid warnings in event log $gui->tcversionSet = is_array($tcversion_id) ? implode(',', $tcversion_id) : $tcversion_id; // will create a record even if the testcase version has not been executed (GET_NO_EXEC) $gui->map_last_exec = getLastExecution($db, $tcase_id, $tcversion_id, $gui, $args, $tcase_mgr); // -------------------------------------------------------------------------------------------- // Results to DB if ($args->save_results || $args->do_bulk_save || $args->save_and_next) { // this has to be done to do not break logic present on write_execution() $args->save_results = $args->save_and_next ? $args->save_and_next : $args->save_results; $_REQUEST['save_results'] = $args->save_results; $submitResult = write_execution($db, $args, $_REQUEST, $gui->map_last_exec); // Need to re-read to update test case status if ($args->save_and_next) { $nextItem = $tplan_mgr->getTestCaseNextSibling($args->tplan_id, $tcversion_id, $args->platform_id); if (!is_null($nextItem)) { $tcase_id = $nextItem['tcase_id']; $tcversion_id = $nextItem['tcversion_id']; // BUGID 3478 processTestCase($nextItem, $gui, $args, $cfg, $linked_tcversions, $tree_mgr, $tcase_mgr, $attachmentRepository); } } $gui->map_last_exec = getLastExecution($db, $tcase_id, $tcversion_id, $gui, $args, $tcase_mgr); } if ($args->doDelete) { delete_execution($db, $args->exec_to_delete); }
// 20130917 - this implementation regarding save_results is confusing. // why ? // because in some situations args->save_results is a number (0) an in other is an array // with just one element with key => test case version ID executed. // if ($args->save_results || $args->do_bulk_save || $args->save_and_next || $args->save_and_exit || $args->doMoveNext || $args->doMovePrevious) { // this has to be done to do not break logic present on write_execution() $args->save_results = $args->save_and_next ? $args->save_and_next : ($args->save_results ? $args->save_results : $args->save_and_exit); if ($args->save_results || $args->do_bulk_save) { // Need to get Latest execution ID before writing $lexid = 0; if ($args->copyIssues && $args->level == 'testcase') { $lexid = $tcase_mgr->getSystemWideLastestExecutionID($args->version_id); } $_REQUEST['save_results'] = $args->save_results; list($execSet, $gui->addIssueOp) = write_execution($db, $args, $_REQUEST, $its); if ($args->assignTask) { $fid = $tplan_mgr->getFeatureID($args->tplan_id, $args->platform_id, $args->version_id); $taskMgr = new assignment_mgr($db); $taskDomain = $taskMgr->get_available_types(); $taskStatusDomain = $taskMgr->get_available_status(); $fmap[$fid]['user_id'] = $fmap[$fid]['assigner_id'] = $args->user_id; $fmap[$fid]['build_id'] = $args->build_id; $fmap[$fid]['type'] = $taskDomain['testcase_execution']['id']; $fmap[$fid]['status'] = $taskStatusDomain['open']['id']; $taskMgr->assign($fmap); } if ($lexid > 0 && $args->copyIssues && $args->level == 'testcase') { copyIssues($db, $lexid, $execSet[$args->version_id]); } }