當前位置: 首頁>>代碼示例>>PHP>>正文


PHP testcase::filterByKeyword方法代碼示例

本文整理匯總了PHP中testcase::filterByKeyword方法的典型用法代碼示例。如果您正苦於以下問題:PHP testcase::filterByKeyword方法的具體用法?PHP testcase::filterByKeyword怎麽用?PHP testcase::filterByKeyword使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在testcase的用法示例。


在下文中一共展示了testcase::filterByKeyword方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: generateExecTree


//.........這裏部分代碼省略.........
    // using 'order_cfg' => array("type" =>'exec_order',"tplan_id" => $tplan_id))
    // makes the magic of ignoring test cases not linked to test plan.
    // This unexpected bonus can be useful on export test plan as XML.
    //
    $my['options'] = array('recursive' => true, 'remove_empty_nodes_of_type' => $tree_manager->node_descr_id['testsuite'], 'order_cfg' => array("type" => 'exec_order', "tplan_id" => $tplan_id));
    $my['filters'] = array('exclude_node_types' => $nt2exclude, 'exclude_children_of' => $nt2exclude_children);
    // BUGID 3301 - added for filtering by toplevel testsuite
    if (isset($filters->{'filter_toplevel_testsuite'}) && is_array($filters->{'filter_toplevel_testsuite'})) {
        $my['filters']['exclude_branches'] = $filters->{'filter_toplevel_testsuite'};
    }
    $test_spec = $tree_manager->get_subtree($tproject_id, $my['filters'], $my['options']);
    $test_spec['name'] = $tproject_name . " / " . $tplan_name;
    // To be discussed
    $test_spec['id'] = $tproject_id;
    $test_spec['node_type_id'] = $hash_descr_id['testproject'];
    $map_node_tccount = array();
    $tplan_tcases = null;
    $apply_other_filters = true;
    if ($test_spec) {
        if (is_null($tc_id) || $tc_id >= 0) {
            $doFilterByKeyword = !is_null($keyword_id) && $keyword_id > 0;
            if ($doFilterByKeyword) {
                $tck_map = $tproject_mgr->get_keywords_tcases($tproject_id, $keyword_id, $keywordsFilterType);
            }
            // Multiple step algoritm to apply keyword filter on type=AND
            // get_linked_tcversions filters by keyword ALWAYS in OR mode.
            // BUGID 3406: user assignments per build
            $opt = array('include_unassigned' => $include_unassigned, 'steps_info' => false, 'user_assignments_per_build' => $build2filter_assignments);
            // 20100417 - BUGID 3380 - execution type
            $linkedFilters = array('tcase_id' => $tc_id, 'keyword_id' => $keyword_id, 'assigned_to' => $assignedTo, 'cf_hash' => $cf_hash, 'platform_id' => $setting_platform, 'urgencyImportance' => $urgencyImportance, 'exec_type' => $execution_type);
            $tplan_tcases = $tplan_mgr->get_linked_tcversions($tplan_id, $linkedFilters, $opt);
            // BUGID 3814: fixed keyword filtering with "and" selected as type
            if ($tplan_tcases && $doFilterByKeyword && $keywordsFilterType == 'And') {
                $filteredSet = $tcase_mgr->filterByKeyword(array_keys($tplan_tcases), $keyword_id, $keywordsFilterType);
                // CAUTION: if $filteredSet is null,
                // then get_linked_tcversions() thinks there are just no filters set,
                // but really there are no testcases which match the wanted keyword criteria,
                // so we have to set $tplan_tcases to null because there is no more filtering necessary
                if ($filteredSet != null) {
                    $linkedFilters = array('tcase_id' => array_keys($filteredSet));
                    $tplan_tcases = $tplan_mgr->get_linked_tcversions($tplan_id, $linkedFilters);
                } else {
                    $tplan_tcases = null;
                }
            }
        }
        if (is_null($tplan_tcases)) {
            $tplan_tcases = array();
            $apply_other_filters = false;
        }
        $filter_methods = config_get('execution_filter_methods');
        // 20100820 - asimon - refactoring for less redundant checks and better readibility
        $ffn = array($filter_methods['status_code']['any_build'] => 'filter_by_status_for_any_build', $filter_methods['status_code']['all_builds'] => 'filter_by_same_status_for_all_builds', $filter_methods['status_code']['specific_build'] => 'filter_by_status_for_build', $filter_methods['status_code']['current_build'] => 'filter_by_status_for_build', $filter_methods['status_code']['latest_execution'] => 'filter_by_status_for_last_execution');
        $requested_filter_method = isset($filters->filter_result_method) ? $filters->filter_result_method : null;
        $requested_filter_result = isset($filters->filter_result_result) ? $filters->filter_result_result : null;
        // if "any" was selected as filtering status, don't filter by status
        $requested_filter_result = (array) $requested_filter_result;
        if (in_array($resultsCfg['status_code']['all'], $requested_filter_result)) {
            $requested_filter_result = null;
        }
        if ($apply_other_filters && !is_null($requested_filter_method) && isset($ffn[$requested_filter_method])) {
            // special case 1: when filtering by "not run" status in any build,
            // we need another filter function
            if (in_array($resultsCfg['status_code']['not_run'], $requested_filter_result)) {
                $ffn[$filter_methods['status_code']['any_build']] = 'filter_not_run_for_any_build';
            }
開發者ID:viglesiasce,項目名稱:tl_RC1,代碼行數:67,代碼來源:treeMenu.inc.php

示例2: getTPlanTCases4ExecTree

/** 
 *
 *
 *
 *
 */
function getTPlanTCases4ExecTree(&$dbHandler, &$tprojectMgr, &$tplanMgr, $enviro, $filters)
{
    $tcaseMgr = new testcase($dbHandler);
    $tplan_tcases = null;
    $tck_map = null;
    if ($doFilterByKeyword = !is_null($filters->filter_keywords) && $filters->filter_keywords > 0) {
        $tck_map = $tprojectMgr->get_keywords_tcases($enviro['tproject_id'], $filters->filter_keywords, $filters->filter_keywords_filter_type);
    }
    // Multiple step algoritm to apply keyword filter on type=AND
    // get_linked_tcversions filters by keyword ALWAYS in OR mode.
    //
    // TICKET 4790: Setting & Filters panel - Wrong use of BUILD on settings area
    $opt = array('steps_info' => false, 'include_unassigned' => $filters->filter_assigned_user_include_unassigned, 'user_assignments_per_build' => $filters->user_assignments_per_build);
    $linkedFilters = array('tcase_id' => $filters->filter_tc_id, 'keyword_id' => $filters->filter_keywords, 'assigned_to' => $filters->filter_assigned_user, 'cf_hash' => $filters->filter_custom_fields, 'platform_id' => $filters->setting_platform, 'urgencyImportance' => $filters->filter_priority, 'exec_type' => $filters->filter_execution_type);
    $tplan_tcases = $tplanMgr->get_linked_tcversions($enviro['tplan_id'], $linkedFilters, $opt);
    // BUGID 3814: fixed keyword filtering with "and" selected as type
    if ($tplan_tcases && $doFilterByKeyword && $filters->filter_keywords_filter_type == 'And') {
        $filteredSet = $tcaseMgr->filterByKeyword(array_keys($tplan_tcases), $filters->filter_keywords, $filters->filter_keywords_filter_type);
        // CAUTION:
        // if $filteredSet is null, then get_linked_tcversions() thinks there are just no filters set,
        // but really there are no testcases which match the wanted keyword criteria,
        // so we have to set $tplan_tcases to null because there is no more filtering necessary
        $tplan_tcases = null;
        if ($filteredSet != null) {
            $tplan_tcases = $tplanMgr->get_linked_tcversions($enviro['tplan_id'], array('tcase_id' => array_keys($filteredSet)));
        }
    }
    return array($tplan_tcases, $tck_map);
}
開發者ID:moraesmv,項目名稱:testlink-code,代碼行數:35,代碼來源:treeMenu.inc.php


注:本文中的testcase::filterByKeyword方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。