function initializeGui(&$dbHandler, &$argsObj) { $tproject_mgr = new testproject($dbHandler); $gui = new stdClass(); $gui->tcasePrefix = $tproject_mgr->getTestCasePrefix($argsObj->tprojectID) . config_get('testcase_cfg')->glue_character; $gui->mainCaption = lang_get('testproject') . " " . $argsObj->tprojectName; $gui->importance = config_get('testcase_importance_default'); $gui->creation_date_from = null; $gui->creation_date_to = null; $gui->modification_date_from = null; $gui->modification_date_to = null; $gui->search_important_notice = sprintf(lang_get('search_important_notice'), $argsObj->tprojectName); $gui->design_cf = $tproject_mgr->cfield_mgr->get_linked_cfields_at_design($argsObj->tprojectID, cfield_mgr::ENABLED, null, 'testcase'); $gui->keywords = $tproject_mgr->getKeywords($argsObj->tprojectID); $gui->filter_by['design_scope_custom_fields'] = !is_null($gui->design_cf); $gui->filter_by['keyword'] = !is_null($gui->keywords); $reqSpecSet = $tproject_mgr->genComboReqSpec($argsObj->tprojectID); $gui->filter_by['requirement_doc_id'] = !is_null($reqSpecSet); $gui->option_importance = array(0 => '', HIGH => lang_get('high_importance'), MEDIUM => lang_get('medium_importance'), LOW => lang_get('low_importance')); return $gui; }
/** * processTestCase * */ function processTestCase(&$dbHandler, &$argsObj, &$guiObj) { $tproject_mgr = new testproject($dbHandler); $guiObj->arrReqSpec = $tproject_mgr->genComboReqSpec($argsObj->tproject_id, 'dotted', " "); $SRS_qty = count($guiObj->arrReqSpec); if ($SRS_qty > 0) { $tc_mgr = new testcase($dbHandler); $arrTc = $tc_mgr->get_by_id($argsObj->id); if ($arrTc) { $guiObj->tcTitle = $arrTc[0]['name']; // get first ReqSpec if not defined if (is_null($argsObj->idReqSpec)) { reset($guiObj->arrReqSpec); $argsObj->idReqSpec = key($guiObj->arrReqSpec); } if ($argsObj->idReqSpec) { $req_spec_mgr = new requirement_spec_mgr($dbHandler); $guiObj->arrAssignedReq = $req_spec_mgr->get_requirements($argsObj->idReqSpec, 'assigned', $argsObj->id); if (!is_null($guiObj->arrAssignedReq)) { $xc = $req_spec_mgr->getAssignedCoverage($argsObj->idReqSpec); $l2d = count($guiObj->arrAssignedReq); for ($xdx = 0; $xdx < $l2d; $xdx++) { $guiObj->arrAssignedReq[$xdx]['coverageAuthor'] = $xc[$guiObj->arrAssignedReq[$xdx]['id']]['login']; $guiObj->arrAssignedReq[$xdx]['coverageTS'] = $xc[$guiObj->arrAssignedReq[$xdx]['id']]['creation_ts']; } } $guiObj->arrAllReq = $req_spec_mgr->get_requirements($argsObj->idReqSpec); $guiObj->arrUnassignedReq = array_diff_byId($guiObj->arrAllReq, $guiObj->arrAssignedReq); } } } return $guiObj; }
* For a test project, list test cases that has no requirement assigned * * rev: 20081109 - franciscom - BUGID 512 * */ require_once "../../config.inc.php"; require_once "common.php"; require_once "specview.php"; testlinkInitPage($db, false, false, "checkRights"); $templateCfg = templateConfiguration(); $tables = tlObjectWithDB::getDBTables(array('req_coverage', 'nodes_hierarchy', 'tcversions', 'node_types')); $args = init_args(); $tproject_mgr = new testproject($db); // get list of available Req Specification // $reqSpec = $tproject_mgr->getOptionReqSpec($args->tproject_id); $reqSpec = $tproject_mgr->genComboReqSpec($args->tproject_id); $uncovered = null; $gui = new stdClass(); $gui->items = null; $gui->tproject_name = $args->tproject_name; $gui->has_reqspec = count($reqSpec) > 0; $gui->has_requirements = false; $gui->has_tc = false; if ($gui->has_reqspec) { // Check if at least one of these requirement spec are not empty. $reqSpecMgr = new requirement_spec_mgr($db); foreach ($reqSpec as $reqSpecID => $name) { if ($gui->has_requirements = $reqSpecMgr->get_requirements_count($reqSpecID) > 0) { break; } }
/** * processTestCase * */ function processTestCase(&$dbHandler, &$argsObj, &$guiObj) { $tproject_mgr = new testproject($dbHandler); // $guiObj->arrReqSpec = $tproject_mgr->getOptionReqSpec($argsObj->tproject_id,testproject::GET_NOT_EMPTY_REQSPEC); $guiObj->arrReqSpec = $tproject_mgr->genComboReqSpec($argsObj->tproject_id); $SRS_qty = count($guiObj->arrReqSpec); if ($SRS_qty > 0) { $tc_mgr = new testcase($dbHandler); $arrTc = $tc_mgr->get_by_id($argsObj->id); if ($arrTc) { $guiObj->tcTitle = $arrTc[0]['name']; // get first ReqSpec if not defined if (is_null($argsObj->idReqSpec)) { reset($guiObj->arrReqSpec); $argsObj->idReqSpec = key($guiObj->arrReqSpec); } if ($argsObj->idReqSpec) { $req_spec_mgr = new requirement_spec_mgr($dbHandler); $guiObj->arrAssignedReq = $req_spec_mgr->get_requirements($argsObj->idReqSpec, 'assigned', $argsObj->id); $guiObj->arrAllReq = $req_spec_mgr->get_requirements($argsObj->idReqSpec); $guiObj->arrUnassignedReq = array_diff_byId($guiObj->arrAllReq, $guiObj->arrAssignedReq); } } } return $guiObj; }
require_once "common.php"; require_once 'requirements.inc.php'; require_once 'requirement_spec_mgr.class.php'; require_once 'requirement_mgr.class.php'; testlinkInitPage($db, false, false, "checkRights"); $template_dir = 'requirements/'; $default_template = str_replace('.php', '.tpl', basename($_SERVER['SCRIPT_NAME'])); $args = init_args(); $tproject_mgr = new testproject($db); $req_spec_mgr = new requirement_spec_mgr($db); $tcasecfg = config_get('testcase_cfg'); $tcprefix = $tproject_mgr->getTestCasePrefix($args->tprojectID) . $tcasecfg->glue_character; // get list of ReqSpec $ns = new stdClass(); // $ns->reqSpec = $tproject_mgr->getOptionReqSpec($args->tprojectID); $ns->reqSpec = $tproject_mgr->genComboReqSpec($args->tprojectID); //get first ReqSpec if not defined if ($args->reqSpecID == 0 && count($ns->reqSpec)) { reset($ns->reqSpec); $args->reqSpecID = key($ns->reqSpec); } // collect REQ data $ns->coverage = $req_spec_mgr->get_coverage($args->reqSpecID); $ns->metrics = $req_spec_mgr->get_metrics($args->reqSpecID); $smarty = new TLSmarty(); foreach ($ns as $key => $value) { $smarty->assign($key, $value); } $smarty->assign('tcprefix', $tcprefix); $smarty->assign('selectedReqSpec', $args->reqSpecID); $smarty->assign('modify_req_rights', has_rights($db, "mgt_modify_req"));
**/ require_once "../../config.inc.php"; require_once "../functions/common.php"; testlinkInitPage($db); $templateCfg = templateConfiguration(); $tproject_mgr = new testproject($db); $args = init_args(); $gui = new stdClass(); $gui->tcasePrefix = $tproject_mgr->getTestCasePrefix($args->tprojectID) . config_get('testcase_cfg')->glue_character; $gui->mainCaption = lang_get('testproject') . " " . $args->tprojectName; $gui->importance = config_get('testcase_importance_default'); $enabled = 1; $no_filters = null; $gui->design_cf = $tproject_mgr->cfield_mgr->get_linked_cfields_at_design($args->tprojectID, $enabled, $no_filters, 'testcase'); $gui->keywords = $tproject_mgr->getKeywords($args->tprojectID); $reqSpecSet = $tproject_mgr->genComboReqSpec($args->tprojectID); $gui->filter_by['design_scope_custom_fields'] = !is_null($gui->design_cf); $gui->filter_by['keyword'] = !is_null($gui->keywords); $gui->filter_by['requirement_doc_id'] = !is_null($reqSpecSet); $gui->option_importance = array(0 => '', HIGH => lang_get('high_importance'), MEDIUM => lang_get('medium_importance'), LOW => lang_get('low_importance')); $gui->creation_date_from = null; $gui->creation_date_to = null; $smarty = new TLSmarty(); $smarty->assign('gui', $gui); $smarty->display($templateCfg->template_dir . 'tcSearchForm.tpl'); /** * * */ function init_args() {