当前位置: 首页>>代码示例>>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;未经允许,请勿转载。