当前位置: 首页>>代码示例>>PHP>>正文


PHP testplan::get_linked_tcversions方法代码示例

本文整理汇总了PHP中testplan::get_linked_tcversions方法的典型用法代码示例。如果您正苦于以下问题:PHP testplan::get_linked_tcversions方法的具体用法?PHP testplan::get_linked_tcversions怎么用?PHP testplan::get_linked_tcversions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在testplan的用法示例。


在下文中一共展示了testplan::get_linked_tcversions方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getMetrics

function getMetrics(&$db, $args)
{
    $user_id = $args->currentUserID;
    $tproject_id = $args->tproject_id;
    $linked_tcversions = array();
    $metrics = array();
    $tplan_mgr = new testplan($db);
    $show_platforms = false;
    // BUGID 1215
    // get all tesplans accessibles  for user, for $tproject_id
    if ($args->show_only_active) {
        $options = array('active' => ACTIVE);
    } else {
        $options = array('active' => TP_ALL_STATUS);
    }
    $test_plans = $_SESSION['currentUser']->getAccessibleTestPlans($db, $tproject_id, null, $options);
    // Get count of testcases linked to every testplan
    foreach ($test_plans as $key => $value) {
        $tplan_id = $value['id'];
        $filters = null;
        $options = array('output' => 'mapOfMap', 'steps_info' => 0);
        $linked_tcversions[$tplan_id] = $tplan_mgr->get_linked_tcversions($tplan_id, $filters, $options);
        $platformSet = $tplan_mgr->getPlatforms($tplan_id);
        if (is_null($platformSet)) {
            //Julian: replaced array(0=>'')
            $platformSet = array(0 => array('id' => 0));
        } else {
            $show_platforms = true;
        }
        foreach ($platformSet as $platform_id => $platform_name) {
            $metrics[$tplan_id][$platform_name['id']]['tplan_name'] = $value['name'];
            $metrics[$tplan_id][$platform_name['id']]['platform_name'] = $platform_name['id'] == 0 ? lang_get('not_aplicable') : $platform_name['name'];
            $metrics[$tplan_id][$platform_name['id']]['executed'] = 0;
            $metrics[$tplan_id][$platform_name['id']]['active'] = 0;
            $metrics[$tplan_id][$platform_name['id']]['total'] = 0;
            $metrics[$tplan_id][$platform_name['id']]['executed_vs_active'] = -1;
            $metrics[$tplan_id][$platform_name['id']]['executed_vs_total'] = -1;
            $metrics[$tplan_id][$platform_name['id']]['active_vs_total'] = -1;
        }
    }
    // Get count of executed testcases
    foreach ($linked_tcversions as $tplan_id => $tcinfo) {
        if (!is_null($tcinfo)) {
            foreach ($tcinfo as $tcase_id => $tc) {
                foreach ($tc as $platform_id => $value) {
                    if ($value['exec_id'] > 0) {
                        $metrics[$tplan_id][$platform_id]['executed']++;
                    }
                    if ($value['active']) {
                        $metrics[$tplan_id][$platform_id]['active']++;
                    }
                    $metrics[$tplan_id][$platform_id]['total']++;
                }
            }
        }
    }
    // Calculate percentages
    $round_precision = config_get('dashboard_precision');
    foreach ($metrics as $tplan_id => $platform_metrics) {
        $platforms = array_keys($platform_metrics);
        foreach ($platforms as $platform_id) {
            $planMetrics =& $metrics[$tplan_id][$platform_id];
            if ($planMetrics['total'] > 0) {
                if ($planMetrics['active'] > 0) {
                    $planMetrics['executed_vs_active'] = $planMetrics['executed'] / $planMetrics['active'];
                    $planMetrics['executed_vs_active'] = round($planMetrics['executed_vs_active'] * 100, $round_precision);
                }
                $planMetrics['executed_vs_total'] = $planMetrics['executed'] / $planMetrics['total'];
                $planMetrics['executed_vs_total'] = round($planMetrics['executed_vs_total'] * 100, $round_precision);
                $planMetrics['active_vs_total'] = $planMetrics['active'] / $planMetrics['total'];
                $planMetrics['active_vs_total'] = round($planMetrics['active_vs_total'] * 100, $round_precision);
            }
        }
    }
    return array($metrics, $show_platforms);
}
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:76,代码来源:metricsDashboard.php

示例2: buildMailCfg

$edit_img = TL_THEME_IMG_DIR . "edit_icon.png";
$mailCfg = buildMailCfg($gui);
$arrOwners = getUsersForHtmlOptions($db);
$fl = $tproject_mgr->tree_manager->get_children($args->tproject_id, array('testcase', 'exclude_me', 'testplan' => 'exclude_me', 'requirement_spec' => 'exclude_me'));
$loop2do = count($fl);
$topLevelSuites = null;
$myRBB = null;
for ($idx = 0; $idx < $loop2do; $idx++) {
    $topLevelSuites[$fl[$idx]['id']] = array('name' => $fl[$idx]['name'], 'items' => null);
}
if ($args->type == $statusCode['not_run']) {
    //BUGID 3722
    $cfg = config_get('results');
    $filters = array('exec_status' => $cfg['status_code']['not_run']);
    $options = array('output' => 'array', 'details' => 'summary');
    $myRBB = $tplan_mgr->get_linked_tcversions($args->tplan_id, $filters, $options);
    $user_key = 'user_id';
    //to be able to use only one php file to generate not run and failed/blocked report
    //we need to manipulate the myRBB array for not run report to match the same array
    //structure as on failed/blocked report: output-array vs output-mapOfMap
    //only manipulate the array if it has results to not pretend the array has content
    if (count($myRBB) > 0) {
        $myRBB = array(0 => $myRBB);
    }
} else {
    $filters = array('exec_status' => array($args->type));
    //mapOfMapPlatformBuild because we need all executions of all builds for each platform
    $options = array('output' => 'mapOfMapExecPlatform', 'last_execution' => true, 'only_executed' => true, 'details' => 'summary', 'execution_details' => 'add_build');
    $myRBB = $tplan_mgr->get_linked_tcversions($args->tplan_id, $filters, $options);
    $user_key = 'tester_id';
}
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:31,代码来源:resultsByStatus.php

示例3: foreach

            // BUGID 0003123: General Test Plan Metrics - order of columns with test case exec results
            $code_verbose = $tplan_mgr->getStatusForReports();
            $resultsCfg = config_get('results');
            $labels = $resultsCfg['status_label'];
            foreach ($code_verbose as $status_verbose) {
                $l18n_label = isset($labels[$status_verbose]) ? lang_get($labels[$status_verbose]) : lang_get($status_verbose);
                $colDefinition[$status_verbose]['qty'] = $l18n_label;
                $colDefinition[$status_verbose]['percentage'] = '[%]';
            }
        }
    }
    /* MILESTONE & PRIORITY REPORT */
    $planMetrics = $tplan_mgr->getStatusTotals($args->tplan_id);
    $filters = null;
    $options = array('output' => 'map', 'only_executed' => true, 'execution_details' => 'add_build');
    $execResults = $tplan_mgr->get_linked_tcversions($args->tplan_id, $filters, $options);
    $options = array('output' => 'mapOfArray', 'only_executed' => true, 'execution_details' => 'add_build');
    $execResults = $tplan_mgr->get_linked_tcversions($args->tplan_id, $filters, $options);
    $options = array('output' => 'mapOfMap', 'only_executed' => true, 'execution_details' => 'add_build');
    $execResults = $tplan_mgr->get_linked_tcversions($args->tplan_id, $filters, $options);
    $options = array('output' => 'array', 'only_executed' => true, 'execution_details' => 'add_build');
    $execResults = $tplan_mgr->get_linked_tcversions($args->tplan_id, $filters, $options);
    $milestonesList = $tplan_mgr->get_milestones($args->tplan_id);
    if (!empty($milestonesList)) {
        $gui->statistics->milestones = $metricsMgr->getMilestonesMetrics($args->tplan_id, $milestonesList);
    }
}
// ----------------------------------------------------------------------------
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->assign('buildColDefinition', $colDefinition);
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:31,代码来源:resultsGeneral.php

示例4: htmlspecialchars

 $tplan_info = $tplan_mgr->get_by_id($args->tplan_id);
 $doc_info->testplan_name = htmlspecialchars($tplan_info['name']);
 $doc_info->testplan_scope = $tplan_info['notes'];
 $doc_info->title = $doc_info->testplan_name;
 // 20100112 - franciscom
 $getOpt = array('outputFormat' => 'map', 'addIfNull' => true);
 $platforms = $tplan_mgr->getPlatforms($args->tplan_id, $getOpt);
 $tcase_filter = null;
 $execid_filter = null;
 $executed_qty = 0;
 $treeForPlatform = array();
 switch ($doc_info->content_range) {
     case 'testproject':
         foreach ($platforms as $platform_id => $platform_name) {
             $filters = array('platform_id' => $platform_id);
             $tp_tcs = $tplan_mgr->get_linked_tcversions($args->tplan_id, $filters);
             // IMPORTANTE NOTE:
             // We are in a loop and we use tree on prepareNode, that changes it,
             // then we can not use anymore a reference to test_spec
             // $tree = &$subtree;
             $tree = $subtree;
             if (!$tp_tcs) {
                 $tree['childNodes'] = null;
             }
             //@TODO:REFACTOR
             // prepareNode($db,$tree,$decoding_hash,$dummy,$dummy,$tp_tcs,
             //              SHOW_TESTCASES,null,null,0,1,0);
             $dummy = null;
             $pnFilters = null;
             $pnOptions = array('hideTestCases' => 0, 'showTestCaseID' => 1, 'getExternalTestCaseID' => 0, 'ignoreInactiveTestCases' => 0);
             prepareNode($db, $tree, $decoding_hash, $dummy, $dummy, $tp_tcs, $pnFilters, $pnOptions);
开发者ID:tamtrong,项目名称:testlink,代码行数:31,代码来源:printDocument.php

示例5: saveImportedResultData

function saveImportedResultData(&$db, $resultData, $context)
{
    if (!$resultData) {
        return;
    }
    $debugMsg = ' FUNCTION: ' . __FUNCTION__;
    $tables = tlObjectWithDB::getDBTables(array('executions', 'execution_bugs'));
    $l18n = array('import_results_tc_not_found' => '', 'import_results_invalid_result' => '', 'tproject_id_not_found' => '', 'import_results_ok' => '');
    foreach ($l18n as $key => $value) {
        $l18n[$key] = lang_get($key);
    }
    // Get Column definitions to get size dinamically instead of create constants
    $columnDef = array();
    $adodbObj = $db->get_dbmgr_object();
    $columnDef['execution_bugs'] = $adodbObj->MetaColumns($tables['execution_bugs']);
    $keySet = array_keys($columnDef['execution_bugs']);
    foreach ($keySet as $keyName) {
        if (($keylow = strtolower($keyName)) != $keyName) {
            $columnDef['execution_bugs'][$keylow] = $columnDef['execution_bugs'][$keyName];
            unset($columnDef['execution_bugs'][$keyName]);
        }
    }
    $user = new tlUser($context->userID);
    $user->readFromDB($db);
    $tcase_mgr = new testcase($db);
    $resulstCfg = config_get('results');
    $tcaseCfg = config_get('testcase_cfg');
    $resultMap = array();
    $tplan_mgr = null;
    $tc_qty = sizeof($resultData);
    if ($tc_qty) {
        $tplan_mgr = new testplan($db);
        $tproject_mgr = new testproject($db);
    }
    // Need to do checks on common settings
    //
    // test project exists
    //
    // test plan id:
    //              belongs to target test project
    //              is active
    // build id:
    //          belongs to target test plan
    //          is open
    //
    // platform id:
    //          is linked  to target test plan
    //
    $checks['status_ok'] = true;
    $checks['msg'] = null;
    $dummy = $tproject_mgr->get_by_id($context->tprojectID);
    $checks['status_ok'] = !is_null($dummy);
    if (!$checks['status_ok']) {
        $checks['msg'][] = sprintf($l19n['tproject_id_not_found'], $context->tprojectID);
    }
    // if( $checks['status_ok'] )
    // {
    //
    // }
    if (!$checks['status_ok']) {
        foreach ($checks['msg'] as $warning) {
            $resultMap[] = array($warning);
        }
    }
    $doIt = $checks['status_ok'];
    // --------------------------------------------------------------------
    for ($idx = 0; $doIt && $idx < $tc_qty; $idx++) {
        $tester_id = 0;
        $tester_name = '';
        $using_external_id = false;
        $message = null;
        $status_ok = true;
        $tcase_exec = $resultData[$idx];
        $checks = check_exec_values($db, $tcase_mgr, $user_mgr, $tcaseCfg, $tcase_exec, $columnDef['execution_bugs']);
        $status_ok = $checks['status_ok'];
        if ($status_ok) {
            $tcase_id = $checks['tcase_id'];
            $tcase_external_id = trim($tcase_exec['tcase_external_id']);
            $tester_id = $checks['tester_id'];
            // external_id has precedence over internal id
            $using_external_id = $tcase_external_id != "";
        } else {
            foreach ($checks['msg'] as $warning) {
                $resultMap[] = array($warning);
            }
        }
        if ($status_ok) {
            $tcase_identity = $using_external_id ? $tcase_external_id : $tcase_id;
            $result_code = strtolower($tcase_exec['result']);
            $result_is_acceptable = isset($resulstCfg['code_status'][$result_code]) ? true : false;
            $notes = $tcase_exec['notes'];
            $message = null;
            $filters = array('tcase_id' => $tcase_id, 'build_id' => $context->buildID, 'platform_id' => $context->platformID);
            $linked_cases = $tplan_mgr->get_linked_tcversions($context->tplanID, $filters);
            $info_on_case = $linked_cases[$tcase_id];
            if (!$linked_cases) {
                $message = sprintf($l18n['import_results_tc_not_found'], $tcase_identity);
            } else {
                if (!$result_is_acceptable) {
                    $message = sprintf($l18n['import_results_invalid_result'], $tcase_identity, $tcase_exec['result']);
//.........这里部分代码省略.........
开发者ID:tamtrong,项目名称:testlink,代码行数:101,代码来源:resultsImport.php

示例6: array

    }
    // BUGID 3439
    if (!count($req_spec_map)) {
        $gui->warning_msg = lang_get($no_finished_reqs_msg_key);
    }
} else {
    $gui->warning_msg = lang_get($no_srs_msg_key);
}
// second step: walk through req spec map, count/calculate, store results
if (count($req_spec_map)) {
    // BUGID 3439
    $testcases = array();
    if (count($tc_ids)) {
        $filters = array('tcase_id' => $tc_ids);
        $options = null;
        $testcases = $tplan_mgr->get_linked_tcversions($args->tplan_id, $filters, $options);
    }
    foreach ($req_spec_map as $req_spec_id => $req_spec_info) {
        $req_spec_map[$req_spec_id]['req_counters'] = array('total' => 0);
        foreach ($req_spec_info['requirements'] as $req_id => $req_info) {
            $req_spec_map[$req_spec_id]['requirements'][$req_id]['tc_counters'] = array('total' => 0);
            foreach ($req_info['linked_testcases'] as $key => $tc_info) {
                $tc_id = $tc_info['id'];
                if (isset($testcases[$tc_id]['exec_status'])) {
                    $status = $testcases[$tc_id]['exec_status'];
                    // if the counters for this status don't exist yet, initialize them with 0
                    if (!isset($req_spec_map[$req_spec_id]['requirements'][$req_id]['tc_counters'][$status])) {
                        $req_spec_map[$req_spec_id]['requirements'][$req_id]['tc_counters'][$status] = 0;
                    }
                    $req_spec_map[$req_spec_id]['requirements'][$req_id]['tc_counters'][$status]++;
                    $req_spec_map[$req_spec_id]['requirements'][$req_id]['tc_counters']['total']++;
开发者ID:tamtrong,项目名称:testlink,代码行数:31,代码来源:resultsReqs.php

示例7: get_testplan_nodes_testcount

/**
 * @return array a map:
 *         key    => node_id
 *         values => node test case count considering test cases presents
 *                   in the nodes of the subtree that starts on node_id
 *                   Means test case can not be sons/daughters of node_id.
 * 
 *                   node name (useful only for debug purpouses).
 */
function get_testplan_nodes_testcount(&$db, $tproject_id, $tproject_name, $tplan_id, $tplan_name, $keywordsFilter = null)
{
    $tplan_mgr = new testplan($db);
    $tproject_mgr = new testproject($db);
    $tree_manager = $tplan_mgr->tree_manager;
    $tcase_node_type = $tree_manager->node_descr_id['testcase'];
    $hash_descr_id = $tree_manager->get_available_node_types();
    $hash_id_descr = array_flip($hash_descr_id);
    $resultsCfg = config_get('results');
    $decoding_hash = array('node_id_descr' => $hash_id_descr, 'status_descr_code' => $resultsCfg['status_code'], 'status_code_descr' => $resultsCfg['code_status']);
    $test_spec = $tproject_mgr->get_subtree($tproject_id, RECURSIVE_MODE);
    $linkedFilters = array('keyword_id' => $keywordsFilter->items);
    $tplan_tcases = $tplan_mgr->get_linked_tcversions($tplan_id, $linkedFilters);
    if (is_null($tplan_tcases)) {
        $tplan_tcases = array();
    }
    $test_spec['name'] = $tproject_name;
    $test_spec['id'] = $tproject_id;
    $test_spec['node_type_id'] = $hash_descr_id['testproject'];
    $map_node_tccount = array();
    if ($test_spec) {
        $tck_map = null;
        if (!is_null($keywordsFilter)) {
            $tck_map = $tproject_mgr->get_keywords_tcases($tproject_id, $keywordsFilter->items, $keywordsFilter->type);
        }
        //@TODO: schlundus, can we speed up with NO_EXTERNAL?
        $filters = null;
        $options = array('hideTestCases' => 0, 'viewType' => 'executionTree');
        $testcase_counters = prepareNode($db, $test_spec, $decoding_hash, $map_node_tccount, $tck_map, $tplan_tcases, $filters, $options);
        $test_spec['testcase_count'] = $testcase_counters['testcase_count'];
    }
    return $map_node_tccount;
}
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:42,代码来源:treeMenu.inc.php

示例8: dBug

new dBug($all_builds);
echo "<pre> testplan - count_testcases(\$tplan_id)";
echo "</pre>";
echo "<pre>            count_testcases({$tplan_id})";
echo "</pre>";
$count_testcases = $tplan_mgr->count_testcases($tplan_id);
new dBug("Number of testcase linked to test plan=" . $count_testcases);
// echo "<pre> testplan - get_linked_tcversions(\$tplan_id,\$tcase_id=null,\$keyword_id=0,\$executed=null,
//                                              \$assigned_to=null,\$exec_status=null,\$build_id=0,
//                                              \$cf_hash = null)";echo "</pre>";
//
echo "<pre> testplan - get_linked_tcversions(\$id,\$filters=null,\$options=null)";
echo "</pre>";
echo "<pre>            get_linked_tcversions({$tplan_id})";
echo "</pre>";
$linked_tcversions = $tplan_mgr->get_linked_tcversions($tplan_id);
new dBug($linked_tcversions);
// -------------------------------------------------------------------------------------------
echo "<hr><h2> Build Manager Class </h2>";
echo "<pre> build manager - constructor - build_mgr(&\$db)";
echo "</pre>";
$build_mgr = new build_mgr($db);
new dBug($build_mgr);
$all_builds = $tplan_mgr->get_builds($tplan_id);
$dummy = array_keys($all_builds);
$build_id = $dummy[0];
echo "<pre> build manager - get_by_id(\$id)";
echo "</pre>";
echo "<pre>                 get_by_id({$build_id})";
echo "</pre>";
$build_info = $build_mgr->get_by_id($build_id);
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:31,代码来源:testplan.class.test.php

示例9: getTestCasesForTestPlan

 /**
  * getTestCasesForTestPlan
  * List test cases linked to a test plan
  * 
  * @param struct $args
  * @param string $args["devKey"]
  * @param int $args["testplanid"]
  * @param int $args["testcaseid"] - optional
  * @param int $args["buildid"] - optional
  * @param int $args["keywordid"] - optional
  * @param boolean $args["executed"] - optional
  * @param int $args["$assignedto"] - optional
  * @param string $args["executestatus"] - optional
  * @param array $args["executiontype"] - optional
  *
  * @return mixed $resultInfo
  */
 public function getTestCasesForTestPlan($args)
 {
     $operation = __FUNCTION__;
     $msg_prefix = "({$operation}) - ";
     // Optional parameters
     $opt = array(self::$testCaseIDParamName => null, self::$buildIDParamName => null, self::$keywordIDParamName => null, self::$executedParamName => null, self::$assignedToParamName => null, self::$executeStatusParamName => null, self::$executionTypeParamName => null);
     $this->_setArgs($args);
     // Test Case ID, Build ID are checked if present
     if (!$this->_checkGetTestCasesForTestPlanRequest($msg_prefix) && $this->userHasRight("mgt_view_tc")) {
         return $this->errors;
     }
     $tplanid = $this->args[self::$testPlanIDParamName];
     foreach ($opt as $key => $value) {
         if ($this->_isParamPresent($key)) {
             $opt[$key] = $this->args[$key];
         }
     }
     $testplan = new testplan($this->dbObj);
     // public function get_linked_tcversions($id,
     // $tcase_id=null ,
     // $keyword_id=0 ,
     // $executed=null ,
     // $assigned_to=null ,
     // $exec_status=null ,
     // $build_id=0 ,
     // $cf_hash = null ,
     // $include_unassigned=false ,
     // $urgencyImportance = null ,
     // $tsuites_id=null ,
     // $exec_type=null ,
     // $details='simple')
     //
     $recordset = $testplan->get_linked_tcversions($tplanid, $opt[self::$testCaseIDParamName], $opt[self::$keywordIDParamName], $opt[self::$executedParamName], $opt[self::$assignedToParamName], $opt[self::$executeStatusParamName], $opt[self::$buildIDParamName], null, false, null, null, $opt[self::$executionTypeParamName], 'full');
     return $recordset;
 }
开发者ID:namikister,项目名称:emacs-testlink,代码行数:52,代码来源:xmlrpc.php

示例10: getMetrics

/**
 * 
 *	@internal revisions
 *
 */
function getMetrics(&$db, $userObj, $args, $result_cfg, $labels)
{
    $user_id = $args->currentUserID;
    $tproject_id = $args->tproject_id;
    $linked_tcversions = array();
    $metrics = array();
    $tplan_mgr = new testplan($db);
    $show_platforms = false;
    $platforms = array();
    // get all tesplans accessibles  for user, for $tproject_id
    $options['active'] = $args->show_only_active ? ACTIVE : TP_ALL_STATUS;
    $test_plans = $userObj->getAccessibleTestPlans($db, $tproject_id, null, $options);
    // Get count of testcases linked to every testplan
    foreach ($test_plans as $key => $value) {
        $tplan_id = $value['id'];
        $linked_tcversions[$tplan_id] = null;
        $platformSet = $tplan_mgr->getPlatforms($tplan_id);
        if (isset($platformSet)) {
            $platforms = array_merge($platforms, $platformSet);
        } else {
            $platforms[]['name'] = $labels['not_aplicable'];
        }
        $show_platforms_for_tplan = !is_null($platformSet);
        if (!$show_platforms_for_tplan) {
            // Julian: replaced array(0=>'')
            $platformSet = array(0 => array('id' => 0));
        } else {
            // 20110615 - Julian - if at least 1 test plan of the test project uses platforms
            //                     we need to display platform column on metrics dashboard
            $show_platforms = true;
        }
        # initialize counters
        foreach ($platformSet as $platform_id => $platform_name) {
            $metrics['testplans'][$tplan_id]['platforms'][$platform_name['id']]['tplan_name'] = $value['name'];
            $metrics['testplans'][$tplan_id]['platforms'][$platform_name['id']]['platform_name'] = $platform_name['id'] == 0 ? $labels['not_aplicable'] : $platform_name['name'];
            $metrics['testplans'][$tplan_id]['platforms'][$platform_name['id']]['active'] = 0;
            $metrics['testplans'][$tplan_id]['overall']['active'] = 0;
            $metrics['total']['active'] = 0;
            $metrics['testplans'][$tplan_id]['platforms'][$platform_name['id']]['executed'] = 0;
            $metrics['testplans'][$tplan_id]['overall']['executed'] = 0;
            $metrics['total']['executed'] = 0;
            foreach ($result_cfg['status_label'] as $key => $status) {
                $metrics['testplans'][$tplan_id]['platforms'][$platform_name['id']][$key] = 0;
                $metrics['testplans'][$tplan_id]['overall'][$key] = 0;
                $metrics['total'][$key] = 0;
            }
        }
        if (($linkedItemsQty = $tplan_mgr->count_testcases($tplan_id)) > 0) {
            $executed = null;
            $not_run = null;
            // get executions ON ACTIVE BUILDS
            //
            // IMPORTANTE NOTICE
            // using 'output' => 'mapOfMap' means we will get JUST ONE exec record for test case / platform
            //
            $options = array('output' => 'mapOfMap', 'steps_info' => 0, 'build_active_status' => 'active');
            $filters = null;
            $executed[$tplan_id] = $tplan_mgr->get_linked_tcversions($tplan_id, $filters, $options);
            // Simple test to cope with active/inactive build
            if (is_null($executed[$tplan_id])) {
                // need a simple call to get linked items and set status to NOT RUN on all items.
                $filters = null;
                $options = array('output' => 'mapOfMap', 'steps_info' => 0, 'forced_exec_status' => $result_cfg['status_code']['not_run']);
                $executed[$tplan_id] = $tplan_mgr->get_linked_tcversions($tplan_id, $filters, $options);
            } else {
                // get NOT EXECUTED on ACTIVE BUILDS and EXECUTED on INACTIVE BUILDS
                // EXECUTED on INACTIVE BUILDS are candidate to become NOT EXECUTED on ACTIVE BUILDS
                //
                $options = array('output' => 'mapOfMap', 'steps_info' => 0, 'build_active_status' => 'active', 'forced_exec_status' => $result_cfg['status_code']['not_run']);
                $filters = array('exec_status' => $result_cfg['status_code']['not_run']);
                $not_run[$tplan_id] = $tplan_mgr->get_linked_tcversions($tplan_id, $filters, $options);
            }
            // Time to work on keys
            $notRunKeys = array_keys($not_run[$tplan_id]);
            foreach ($notRunKeys as $tcaseIDkey) {
                // BUGID 4362
                // Mistake was this:
                // isset($executed[$tplan_id][$key2copy])
                // just means we have found at least one execution.
                // But inside the element we have a map indexed by platform id.
                // If we have N platforms, and have exec on M, we have M elements
                // and MISS TO ADD the N-M NOT EXECUTED generating the issue.
                if (!isset($executed[$tplan_id][$tcaseIDkey])) {
                    $executed[$tplan_id][$tcaseIDkey] = array();
                }
                $executed[$tplan_id][$tcaseIDkey] += $not_run[$tplan_id][$tcaseIDkey];
            }
            $linked_tcversions[$tplan_id] = (array) $executed[$tplan_id];
        }
        // test plan has linked items
    }
    // Get count of executed testcases
    foreach ($linked_tcversions as $tplan_id => $tcinfo) {
        if (!is_null($tcinfo)) {
            foreach ($tcinfo as $tcase_id => $tc) {
//.........这里部分代码省略.........
开发者ID:moraesmv,项目名称:testlink-code,代码行数:101,代码来源:metricsDashboard.php


注:本文中的testplan::get_linked_tcversions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。