Exemple #1
0
    show_instructions('keywordsAssign');
    exit;
}
$smarty = new TLSmarty();
$tproject_mgr = new testproject($db);
$tcase_mgr = new testcase($db);
$result = null;
$keyword_assignment_subtitle = null;
$can_do = 0;
$itemID = null;
$opt_cfg->global_lbl = '';
$opt_cfg->additional_global_lbl = null;
$opt_cfg->from->lbl = lang_get('available_kword');
$opt_cfg->to->lbl = lang_get('assigned_kword');
$opt_cfg->from->map = $tproject_mgr->get_keywords_map($args->testproject_id);
$opt_cfg->to->map = $tcase_mgr->get_keywords_map($args->id, " ORDER BY keyword ASC ");
if ($args->edit == 'testsuite') {
    // We are going to walk all test suites contained
    // in the selected container, and assign/remove keywords on each test case.
    $tsuite_mgr = new testsuite($db);
    $testsuite = $tsuite_mgr->get_by_id($args->id);
    $keyword_assignment_subtitle = lang_get('test_suite') . TITLE_SEP . $testsuite['name'];
    $tcs = $tsuite_mgr->get_testcases_deep($args->id, 'only_id');
    if (sizeof($tcs)) {
        $can_do = 1;
        if ($args->bAssignTestSuite) {
            $result = 'ok';
            for ($i = 0; $i < sizeof($tcs); $i++) {
                $tcID = $tcs[$i];
                $tcase_mgr->setKeywords($tcID, $args->keywordArray);
            }
echo "<pre> testcase - get_exec_status(\$id)";
echo "<pre>            get_exec_status({$tcase_id})";
$testcase_exec_status = $tcase_mgr->get_exec_status($tcase_id);
new dBug($testcase_exec_status);
echo "<pre> testcase - getKeywords(\$tcID,\$kwID = null)";
echo "</pre>";
echo "<pre>            getKeywords({$tcase_id})";
echo "</pre>";
$keywords = $tcase_mgr->getKeywords($tcase_id);
new dBug($keywords);
echo "<pre> testcase - get_keywords_map(\$id,\$order_by_clause='')";
echo "</pre>";
$tcase_id = 4;
echo "<pre>               get_keywords_map({$tcase_id})";
echo "</pre>";
$keywords_map = $tcase_mgr->get_keywords_map($tcase_id);
new dBug($keywords_map);
$tcase_id = 4;
$version_id = 5;
$tplan_id = 8;
$build_id = 1;
echo "<pre> testcase - get_executions(\$id,\$version_id,\$tplan_id,\$build_id,<br>\n                                      \$exec_id_order='DESC',\$exec_to_exclude=null)";
echo "</pre>";
echo "<pre>            get_executions({$tcase_id},{$version_id},{$tplan_id},{$build_id})";
echo "</pre>";
$executions = $tcase_mgr->get_executions($tcase_id, $version_id, $tplan_id, $build_id);
new dBug($executions);
echo "<pre> testcase - get_last_execution(\$id,\$version_id,\$tplan_id,\$build_id,\$get_no_executions=0)";
echo "</pre>";
echo "<pre>            get_last_execution({$tcase_id},{$version_id},{$tplan_id},{$build_id})";
echo "</pre>";
    }
} else {
    if ($args->edit == 'testcase') {
        $doRecall = true;
        $can_do = 1;
        $tcData = $tcase_mgr->get_by_id($args->id);
        if (sizeof($tcData)) {
            $keyword_assignment_subtitle = lang_get('test_case') . TITLE_SEP . $tcData[0]['name'];
        }
        if ($args->bAssignTestCase) {
            $result = 'ok';
            $tcase_mgr->setKeywords($args->id, $args->keywordArray);
            $doRecall = !is_null($args->keywordArray);
        }
        $opt_cfg->to->lbl = lang_get('assigned_kword');
        $opt_cfg->to->map = $doRecall ? $tcase_mgr->get_keywords_map($args->id, array('orderByClause' => " ORDER BY keyword ASC ")) : null;
    }
}
keywords_opt_transf_cfg($opt_cfg, $args->keywordList);
$smarty->assign('can_do', $can_do);
$smarty->assign('sqlResult', $result);
$smarty->assign('data', $args->id);
$smarty->assign('level', $args->edit);
$smarty->assign('opt_cfg', $opt_cfg);
$smarty->assign('keyword_assignment_subtitle', $keyword_assignment_subtitle);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
function init_args(&$opt_cfg)
{
    $rl_html_name = $opt_cfg->js_ot_name . "_newRight";
    $iParams = array("id" => array(tlInputParameter::INT_N), "edit" => array(tlInputParameter::STRING_N, 0, 100), "assigntestcase" => array(tlInputParameter::STRING_N, 0, 1), "assigntestsuite" => array(tlInputParameter::STRING_N, 0, 1), $rl_html_name => array(tlInputParameter::STRING_N));
    $pParams = R_PARAMS($iParams);