本文整理汇总了PHP中testplan::getPlatforms方法的典型用法代码示例。如果您正苦于以下问题:PHP testplan::getPlatforms方法的具体用法?PHP testplan::getPlatforms怎么用?PHP testplan::getPlatforms使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testplan
的用法示例。
在下文中一共展示了testplan::getPlatforms方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initializeGui
function initializeGui(&$dbHandler, $args)
{
$gui = new stdClass();
$tplan_mgr = new testplan($dbHandler);
$gui_open = config_get('gui_separator_open');
$gui_close = config_get('gui_separator_close');
$gui->str_option_any = $gui_open . lang_get('any') . $gui_close;
$gui->str_option_none = $gui_open . lang_get('nobody') . $gui_close;
$gui->tplan_id = $args->tplan_id;
$gui->tproject_id = $args->tproject_id;
$tplan_info = $tplan_mgr->get_by_id($gui->tplan_id);
$gui->tplan_name = $tplan_info['name'];
unset($tplan_info);
$ni = $tplan_mgr->tree_manager->get_node_hierarchy_info($gui->tproject_id);
$gui->tproject_name = $ni['name'];
unset($ni);
$gui->assigned_users = new stdClass();
$gui->keywords = new stdClass();
$gui->builds = new stdClass();
$gui->platforms = new stdClass();
$gui->testsuites = new stdClass();
// 20090107 - franciscom
// Show only users that are able to execute test cases ?
// What happens if a user that has loose right to execute, but
// before loosing this right has been assigned some tests, or have executed it?
//
// $gui->assigned_users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, ADD_BLANK_OPTION);
// $gui->assigned_users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER,
// array(TL_USER_ANYBODY => $gui->str_option_any,
// TL_USER_NOBODY => $gui->str_option_none) );
//
$gui->assigned_users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, array(TL_USER_ANYBODY => $gui->str_option_any));
$gui->builds->items = $tplan_mgr->get_builds($gui->tplan_id, testplan::ACTIVE_BUILDS);
$gui->platforms->items = $tplan_mgr->getPlatforms($gui->tplan_id);
$gui->testsuites->items = $tplan_mgr->getRootTestSuites($gui->tplan_id, $gui->tproject_id, array('output' => 'plain'));
$gui->keywords->items[0] = $gui->str_option_any;
if (!is_null($tplan_keywords_map = $tplan_mgr->get_keywords_map($gui->tplan_id))) {
$gui->keywords->items += $tplan_keywords_map;
}
$key2loop = array('keywords', 'builds', 'platforms', 'testsuites', 'assigned_users');
foreach ($key2loop as $kx) {
$gui->{$kx}->qty = count($gui->{$kx}->items);
}
$gui->status_code_label = get_status_for_reports_html_options();
$gui->report_type = $args->format;
$reports_cfg = config_get('reportsCfg');
$ldf = config_get('locales_date_format');
$date_format = $ldf[isset($_SESSION['locale']) ? $_SESSION['locale'] : 'en_GB'];
$gui->selected_start_date = strftime($date_format, time() - $reports_cfg->start_date_offset);
$gui->selected_start_time = $reports_cfg->start_time;
$gui->selected_end_date = strftime($date_format, time());
$gui->selected_end_time = null;
return $gui;
}
示例2: init_args
function init_args(&$dbHandler, $cfgObj)
{
$args = new stdClass();
$_REQUEST = strings_stripSlashes($_REQUEST);
$tplan_mgr = new testplan($dbHandler);
// Settings we put on session to create some sort of persistent scope,
// because we have had issues when passing this info using GET mode (size limits)
//
// we get info about build_id, platform_id, etc ...
getContextFromGlobalScope($args);
$args->user = $_SESSION['currentUser'];
$args->user_id = $args->user->dbID;
$args->caller = isset($_REQUEST['caller']) ? $_REQUEST['caller'] : 'exec_feature';
$args->reload_caller = false;
$args->tplan_id = intval(isset($_REQUEST['tplan_id']) ? $_REQUEST['tplan_id'] : $_SESSION['testplanID']);
$args->tproject_id = intval(isset($_REQUEST['tproject_id']) ? $_REQUEST['tproject_id'] : $_SESSION['testprojectID']);
if ($args->tproject_id <= 0) {
$tree_mgr = new tree($dbHandler);
$dm = $tree_mgr->get_node_hierarchy_info($args->tplan_id);
$args->tproject_id = $dm['parent_id'];
}
if (is_null($args->build_id) || $args->build_id == 0) {
// Go for the build
// this info can be present in session, then we will try different ways
// ATTENTION:
// give a look to tlTestCaseFilterControl.class.php method init_setting_build()
//
$key = $args->tplan_id . '_stored_setting_build';
$args->build_id = isset($_SESSION[$key]) ? intval($_SESSION[$key]) : null;
if (is_null($args->build_id)) {
$args->build_id = $tplan_mgr->get_max_build_id($args->tplan_id, 1, 1);
}
}
if (is_null($args->platform_id) || $args->platform_id <= 0) {
// Go for the platform (if any exists)
// this info can be present in session, then we will try different ways
// ATTENTION:
// give a look to tlTestCaseFilterControl.class.php method init_setting_platform()
//
$itemSet = $tplan_mgr->getPlatforms($args->tplan_id);
if (!is_null($itemSet)) {
$key = $args->tplan_id . '_stored_setting_platform';
$args->platform_id = isset($_SESSION[$key]) ? intval($_SESSION[$key]) : null;
if (is_null($args->platform_id) || $args->platform_id <= 0) {
$args->platform_id = $itemSet[0]['id'];
}
}
}
return array($args, $tplan_mgr);
}
示例3: templateConfiguration
* 20100520 - franciscom - BUGID 3480 - add to test plan problem when platforms exist
* 20100514 - franciscom - BUGID 3189
* 20100124 - franciscom - BUGID 3064 - add logic to manage ONLY ACTIVE test plans
**/
require_once "../../config.inc.php";
require_once "common.php";
testlinkInitPage($db);
$templateCfg = templateConfiguration();
$tcase_mgr = new testcase($db);
$tplan_mgr = new testplan($db);
$tproject_mgr = new testproject($db);
$glue = config_get('testcase_cfg')->glue_character;
$args = init_args();
$gui = initializeGui($args);
$getOpt = array('outputFormat' => 'map', 'addIfNull' => true);
$gui->platformSet = $tplan_mgr->getPlatforms($args->tplan_id, $getOpt);
$options['output'] = 'essential';
$tcase_all_info = $tcase_mgr->get_by_id($args->tcase_id, testcase::ALL_VERSIONS, null, $options);
if (!is_null($tcase_all_info)) {
foreach ($tcase_all_info as $tcversion_info) {
if ($tcversion_info['id'] == $args->tcversion_id) {
$version = $tcversion_info['version'];
$gui->pageTitle = lang_get('test_case') . ':' . $tcversion_info['name'];
$gui->tcaseIdentity = $tproject_mgr->getTestCasePrefix($args->tproject_id);
$gui->tcaseIdentity .= $glue . $tcversion_info['tc_external_id'] . ':' . $tcversion_info['name'];
break;
}
}
}
// 20100514 - franciscom
// Why I'm filter on NOT_EXECUTED ??? -> this causes BUGID 3189
示例4: 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);
}
示例5: testplan
// FORCE
// FORCE
case DOC_TEST_PLAN_EXECUTION:
case DOC_TEST_PLAN_EXECUTION_ON_BUILD:
$tplan_mgr = new testplan($db);
$tplan_info = $tplan_mgr->get_by_id($args->tplan_id);
if ($args->build_id > 0) {
$xx = $tplan_mgr->get_builds($args->tplan_id, null, null, array('buildID' => $args->build_id));
$doc_info->build_name = htmlspecialchars($xx[$args->build_id]['name']);
}
$doc_info->testplan_name = htmlspecialchars($tplan_info['name']);
$doc_info->testplan_scope = $tplan_info['notes'];
$doc_info->title = $doc_info->testplan_name;
// Changed to get ALL platform attributes.
$getOpt = array('outputFormat' => 'mapAccessByID', 'addIfNull' => true);
$platforms = $tplan_mgr->getPlatforms($args->tplan_id, $getOpt);
$platformIDSet = array_keys($platforms);
$printingOptions['priority'] = $doc_info->test_priority_enabled;
$items2use = (object) array('estimatedExecTime' => null, 'realExecTime' => null);
$treeForPlatform = array();
$filters = null;
switch ($doc_info->content_range) {
case 'testproject':
$treeForPlatform = buildContentForTestPlan($db, $subtree, $args->tplan_id, $platformIDSet, $decode, $tplan_mgr, $filters);
break;
case 'testsuite':
list($treeForPlatform, $items2use) = buildContentForTestPlanBranch($db, $subtree, $args->itemID, $args->tplan_id, $platformIDSet, $doc_info, $decode, $tplan_mgr, $my['options']['prepareNode']);
break;
}
// Create list of execution id, that will be used to compute execution time if
// CF_EXEC_TIME custom field exists and is linked to current testproject
示例6: getColumnsDefinition
/**
* get Columns definition for table to display
*
*/
function getColumnsDefinition($dbHandler, $tplan_id, $optionalColumns)
{
static $labels;
static $tplan_mgr;
if (is_null($labels)) {
$tplan_mgr = new testplan($dbHandler);
$lbl2get = array('build' => null, 'testsuite' => null, 'testcase' => null, 'platform' => null, 'user' => null, 'priority' => null, 'status' => null, 'version' => null, 'low_priority' => null, 'medium_priority' => null, 'high_priority' => null, 'due_since' => null);
$labels = init_labels($lbl2get);
}
$colDef = array();
$sortByCol = $labels['testsuite'];
// user column is only shown for assignment overview
if ($optionalColumns['user']) {
$colDef[] = array('title_key' => 'user', 'width' => 80);
$sortByCol = $labels['build'];
}
$colDef[] = array('title_key' => 'build', 'width' => 80);
$colDef[] = array('title_key' => 'testsuite', 'width' => 130);
$colDef[] = array('title_key' => 'testcase', 'width' => 130);
$platforms = $tplan_mgr->getPlatforms($tplan_id, array('outputFormat' => 'map'));
if ($show_plat = !is_null($platforms)) {
$colDef[] = array('title_key' => 'platform', 'width' => 50, 'filter' => 'list', 'filterOptions' => $platforms);
}
if ($optionalColumns['priority']) {
$sortByCol = $labels['priority'];
$colDef[] = array('title_key' => 'priority', 'width' => 50, 'filter' => 'ListSimpleMatch', 'filterOptions' => array($labels['low_priority'], $labels['medium_priority'], $labels['high_priority']));
}
$colDef[] = array('title_key' => 'status', 'width' => 50, 'type' => 'status');
$colDef[] = array('title_key' => 'due_since', 'width' => 100);
return array($colDef, $sortByCol, $show_plat);
}
示例7: init_args
*/
require '../../config.inc.php';
require_once 'common.php';
require_once 'displayMgr.php';
$templateCfg = templateConfiguration();
$args = init_args($db);
$tplan_id = $_GET['tplan_id'];
$build_id = $_GET['build_id'];
$device_id = $_GET['device_id'];
$suite_id = $_GET['suite_id'];
$failtype = $_GET['failtype'];
$args->format = 0;
$stack = isset($_GET['stack']) ? $_GET['stack'] : 0;
$mystack = isset($_GET['mystack']) ? $_GET['mystack'] : 0;
$tplan_mgr = new testplan($db);
$platformSet = $tplan_mgr->getPlatforms($tplan_id, array('outputFormat' => 'map'));
if ($args->device_id == '1') {
foreach ($platformSet as $this_device_id => $device_name) {
$tplan_mgr->modify_device_build_exec_fail_type($tplan_id, $build_id, $this_device_id, $mystack, $suite_id, $failtype);
}
} else {
$tplan_mgr->modify_device_build_exec_fail_type($tplan_id, $build_id, $device_id, $mystack, $suite_id, $failtype);
}
echo "<script>alert('保存完成!');</script>";
function init_args(&$dbHandler)
{
$iParams = array("apikey" => array(tlInputParameter::STRING_N, 32, 64), "tproject_id" => array(tlInputParameter::INT_N), "tplan_id" => array(tlInputParameter::INT_N), "build_id" => array(tlInputParameter::INT_N), "device_id" => array(tlInputParameter::INT_N), "format" => array(tlInputParameter::INT_N));
$args = new stdClass();
$pParams = R_PARAMS($iParams, $args);
if (!is_null($args->apikey)) {
$cerbero = new stdClass();
示例8: init_args
$gui->tplans = $args->user->getAccessibleTestPlans($db, $args->tproject_id, null, array('output' => 'mapfull', 'active' => null));
$gui->drawPlatformQtyColumn = false;
if (!is_null($gui->tplans) && count($gui->tplans) > 0) {
// do this test project has platform definitions ?
$tplan_mgr = new testplan($db);
$tplan_mgr->platform_mgr->setTestProjectID($args->tproject_id);
$dummy = $tplan_mgr->platform_mgr->testProjectCount();
$gui->drawPlatformQtyColumn = $dummy[$args->tproject_id]['platform_qty'] > 0;
$tplanSet = array_keys($gui->tplans);
$dummy = $tplan_mgr->count_testcases($tplanSet, null, array('output' => 'groupByTestPlan'));
$buildQty = $tplan_mgr->get_builds($tplanSet, null, null, array('getCount' => true));
foreach ($tplanSet as $idk) {
$gui->tplans[$idk]['tcase_qty'] = isset($dummy[$idk]['qty']) ? intval($dummy[$idk]['qty']) : 0;
$gui->tplans[$idk]['build_qty'] = isset($buildQty[$idk]['build_qty']) ? intval($buildQty[$idk]['build_qty']) : 0;
if ($gui->drawPlatformQtyColumn) {
$plat = $tplan_mgr->getPlatforms($idk);
$gui->tplans[$idk]['platform_qty'] = is_null($plat) ? 0 : count($plat);
}
}
unset($tplan_mgr);
}
unset($tproject_mgr);
}
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
/**
* init_args
*
*/
function init_args()
示例9: array
}
// BUGID 3647
if ($args->build_id) {
$filters['build_id'] = $args->build_id;
}
$tplan_param = $args->tplan_id ? array($args->tplan_id) : testcase::ALL_TESTPLANS;
$gui->resultSet = $tcase_mgr->get_assigned_to_user($args->user_id, $args->tproject_id, $tplan_param, $options, $filters);
$doIt = !is_null($gui->resultSet);
if ($doIt) {
$tables = tlObjectWithDB::getDBTables(array('nodes_hierarchy'));
$tplanSet = array_keys($gui->resultSet);
$sql = "SELECT name,id FROM {$tables['nodes_hierarchy']} " . "WHERE id IN (" . implode(',', $tplanSet) . ")";
$gui->tplanNames = $db->fetchRowsIntoMap($sql, 'id');
$optColumns = array('user' => $args->show_user_column, 'priority' => $args->priority_enabled);
foreach ($gui->resultSet as $tplan_id => $tcase_set) {
$show_platforms = !is_null($tplan_mgr->getPlatforms($tplan_id));
list($columns, $sortByColumn) = getColumnsDefinition($optColumns, $show_platforms);
$rows = array();
foreach ($tcase_set as $tcase_platform) {
foreach ($tcase_platform as $tcase) {
$current_row = array();
$tcase_id = $tcase['testcase_id'];
$tcversion_id = $tcase['tcversion_id'];
if ($args->show_user_column) {
$current_row[] = htmlspecialchars($names[$tcase['user_id']]['login']);
}
$current_row[] = htmlspecialchars($tcase['build_name']);
$current_row[] = htmlspecialchars($tcase['tcase_full_path']);
$current_row[] = "<a href=\"lib/testcases/archiveData.php?edit=testcase&id={$tcase_id}\" " . " title=\"{$l18n['goto_testspec']}\">" . htmlspecialchars($tcase['prefix']) . $gui->glueChar . $tcase['tc_external_id'] . ":" . htmlspecialchars($tcase['name']) . sprintf($l18n['tcversion_indicator'], $tcase['version']) . "</a>";
if ($show_platforms) {
$current_row[] = htmlspecialchars($tcase['platform_name']);
示例10: initializeGui
/**
* initialize Gui
*/
function initializeGui(&$dbHandler, &$argsObj, $dateFormat)
{
$reports_cfg = config_get('reportsCfg');
$gui = new stdClass();
$tplan_mgr = new testplan($dbHandler);
$tproject_mgr = new testproject($dbHandler);
$getOpt = array('outputFormat' => 'map');
$gui->platformSet = $tplan_mgr->getPlatforms($argsObj->tplan_id, $getOpt);
$gui->title = lang_get('query_metrics_report');
$gui->showPlatforms = true;
if (is_null($gui->platformSet)) {
$gui->platformSet = array('');
$gui->showPlatforms = false;
}
$gui->resultsCfg = config_get('results');
// BUGID 3716, BUGID 3930
// convert starttime to iso format for database usage
if (isset($_REQUEST['selected_start_date']) && $_REQUEST['selected_start_date'] != '') {
$date_array = split_localized_date($_REQUEST['selected_start_date'], $dateFormat);
if ($date_array != null) {
// set date in iso format
$gui->startTime = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'];
}
}
// convert starttime to iso format for database usage
if (isset($_REQUEST['selected_end_date']) && $_REQUEST['selected_end_date'] != '') {
$date_array = split_localized_date($_REQUEST['selected_end_date'], $dateFormat);
if ($date_array != null) {
// set date in iso format
$gui->endTime = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'];
}
}
$start_hour = isset($_REQUEST['start_Hour']) ? $_REQUEST['start_Hour'] : "00";
$gui->startTime = $gui->startTime . " " . $start_hour . ":00:00";
$end_hour = isset($_REQUEST['end_Hour']) ? $_REQUEST['end_Hour'] : "00";
$gui->endTime = $gui->endTime . " " . $end_hour . ":59:59";
$gui_open = config_get('gui_separator_open');
$gui_close = config_get('gui_separator_close');
$gui->str_option_any = $gui_open . lang_get('any') . $gui_close;
$gui->str_option_none = $gui_open . lang_get('nobody') . $gui_close;
$gui->search_notes_string = $argsObj->search_notes_string;
$gui->tplan_id = $argsObj->tplan_id;
$gui->tproject_id = $argsObj->tproject_id;
$tplan_info = $tplan_mgr->get_by_id($gui->tplan_id);
$tproject_info = $tproject_mgr->get_by_id($gui->tproject_id);
$gui->tplan_name = $tplan_info['name'];
$gui->tproject_name = $tproject_info['name'];
$testsuiteIds = null;
$testsuiteNames = null;
$tsuites_qty = sizeOf($argsObj->testsuitesSelected);
for ($id = 0; $id < $tsuites_qty; $id++) {
list($suiteId, $suiteName) = preg_split("/\\,/", $argsObj->testsuitesSelected[$id], 2);
$testsuiteIds[$id] = $suiteId;
$testsuiteNames[$id] = $suiteName;
}
$buildsToQuery = -1;
if (sizeof($argsObj->buildsSelected)) {
$buildsToQuery = implode(",", $argsObj->buildsSelected);
}
// statusForClass is used for results.class.php
// lastStatus is used to be displayed
$statusForClass = 'a';
// amitkhullar - added this parameter to get the latest results.
$latest_resultset = $argsObj->display->latest_results;
// BUGID 2500
// $assignee = $argsObj->ownerSelected ? TL_USER_ANYBODY : null;
// $tester = $argsObj->executorSelected ? TL_USER_ANYBODY : null;
$assignee = $argsObj->ownerSelected > 0 ? $argsObj->ownerSelected : TL_USER_ANYBODY;
$tester = $argsObj->executorSelected > 0 ? $argsObj->executorSelected : TL_USER_ANYBODY;
// BUGID 4027
$re = new newResults($dbHandler, $tplan_mgr, $tproject_info, $tplan_info, $testsuiteIds, $buildsToQuery, $argsObj->platformsSelected, $statusForClass, $latest_resultset, $argsObj->keywordSelected, $assignee, $gui->startTime, $gui->endTime, $tester, $argsObj->search_notes_string, null);
$gui->suiteList = $re->getSuiteList();
// test executions results
// Filter test cases on selected platforms
foreach ($gui->suiteList as $suiteid => $tcases) {
$filtered = array();
foreach ($tcases as $index => $tcase) {
if ($tcase['platform_id'] == 0 || $argsObj->platformsSelected[0] == ALL_PLATFORMS || array_search($tcase['platform_id'], $argsObj->platformsSelected) !== false) {
array_push($filtered, $tcase);
}
}
unset($gui->suiteList[$suiteid]);
$gui->suiteList[$suiteid] = $filtered;
}
$gui->flatArray = $re->getFlatArray();
$gui->mapOfSuiteSummary = $re->getAggregateMap();
$gui->totals = new stdClass();
$gui->totals->items = $re->getTotalsForPlan();
$gui->totals->labels = array();
foreach ($gui->totals->items as $key => $value) {
$l18n = $key == 'total' ? 'th_total_cases' : $gui->resultsCfg['status_label'][$key];
$gui->totals->labels[$key] = lang_get($l18n);
}
// BUGID 2012 - franciscom
$gui->keywords = new stdClass();
$gui->keywords->items[0] = $gui->str_option_any;
if (!is_null($tplan_keywords_map = $tplan_mgr->get_keywords_map($gui->tplan_id))) {
//.........这里部分代码省略.........
示例11: getMetrics
/**
* only active builds has to be used
*
* @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 = array('output' => 'map');
$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
// Hmm Count active and inactive ?
$linkedItemsQty = $tplan_mgr->count_testcases(array_keys($test_plans), null, array('output' => 'groupByTestPlan'));
$metricsMgr = new tlTestPlanMetrics($db);
$show_platforms = false;
$metrics = array('testplans' => null, 'total' => null);
$mm =& $metrics['testplans'];
$metrics['total'] = array('active' => 0, 'total' => 0, 'executed' => 0);
foreach ($result_cfg['status_label_for_exec_ui'] as $status_code => &$dummy) {
$metrics['total'][$status_code] = 0;
}
$codeStatusVerbose = array_flip($result_cfg['status_code']);
foreach ($test_plans as $key => &$dummy) {
// We need to know if test plan has builds, if not we can not call any method
// that try to get exec info, because you can only execute if you have builds.
//
// 20130909 - added active filter
$buildSet = $tplan_mgr->get_builds($key, testplan::ACTIVE_BUILDS);
if (is_null($buildSet)) {
continue;
}
$platformSet = $tplan_mgr->getPlatforms($key);
if (isset($platformSet)) {
$platforms = array_merge($platforms, $platformSet);
}
$show_platforms_for_tplan = !is_null($platformSet);
$show_platforms = $show_platforms || $show_platforms_for_tplan;
if (!is_null($platformSet)) {
$neurus = $metricsMgr->getExecCountersByPlatformExecStatus($key, null, array('getPlatformSet' => true, 'getOnlyActiveTCVersions' => true));
$mm[$key]['overall']['active'] = $mm[$key]['overall']['executed'] = 0;
foreach ($neurus['with_tester'] as $platform_id => &$pinfo) {
$xd =& $mm[$key]['platforms'][$platform_id];
$xd['tplan_name'] = $dummy['name'];
$xd['platform_name'] = $neurus['platforms'][$platform_id];
$xd['total'] = $xd['active'] = $neurus['total'][$platform_id]['qty'];
$xd['executed'] = 0;
foreach ($pinfo as $code => &$elem) {
$xd[$codeStatusVerbose[$code]] = $elem['exec_qty'];
if ($codeStatusVerbose[$code] != 'not_run') {
$xd['executed'] += $elem['exec_qty'];
}
if (!isset($mm[$key]['overall'][$codeStatusVerbose[$code]])) {
$mm[$key]['overall'][$codeStatusVerbose[$code]] = 0;
}
$mm[$key]['overall'][$codeStatusVerbose[$code]] += $elem['exec_qty'];
$metrics['total'][$codeStatusVerbose[$code]] += $elem['exec_qty'];
}
$mm[$key]['overall']['executed'] += $xd['executed'];
$mm[$key]['overall']['active'] += $xd['active'];
}
unset($neurus);
$mm[$key]['overall']['total'] = $mm[$key]['overall']['active'];
$metrics['total']['executed'] += $mm[$key]['overall']['executed'];
$metrics['total']['active'] += $mm[$key]['overall']['active'];
} else {
$mm[$key]['overall'] = $metricsMgr->getExecCountersByExecStatus($key, null, array('getOnlyActiveTCVersions' => true));
$mm[$key]['overall']['active'] = $mm[$key]['overall']['total'];
// compute executed
$mm[$key]['overall']['executed'] = 0;
foreach ($mm[$key]['overall'] as $status_code => $qty) {
if ($status_code != 'not_run' && $status_code != 'total' && $status_code != 'active') {
$mm[$key]['overall']['executed'] += $qty;
}
if ($status_code != 'total' && $status_code != 'active') {
if (!isset($metrics['total'][$status_code])) {
$metrics['total'][$status_code] = 0;
}
$metrics['total'][$status_code] += $qty;
}
}
$metrics['total']['executed'] += $mm[$key]['overall']['executed'];
$metrics['total']['active'] += $mm[$key]['overall']['active'];
$mm[$key]['platforms'][0] = $mm[$key]['overall'];
$mm[$key]['platforms'][0]['tplan_name'] = $dummy['name'];
$mm[$key]['platforms'][0]['platform_name'] = $labels['not_aplicable'];
}
}
// remove duplicate platform names
$platformsUnique = array();
foreach ($platforms as $platform) {
//.........这里部分代码省略.........
示例12: init_args
function init_args(&$dbHandler, &$treeMgr)
{
$iParams = array("format" => array(tlInputParameter::INT_N), "tproject_id" => array(tlInputParameter::INT_N), "tplan_id" => array(tlInputParameter::INT_N), "type" => array(tlInputParameter::STRING_N, 0, 1));
$argsObj = new stdClass();
R_PARAMS($iParams, $argsObj);
$argsObj->doIt = false;
$argsObj->showPlatforms = false;
$argsObj->tproject_name = '';
if ($argsObj->tproject_id > 0) {
$dummy = $treeMgr->get_node_hierarchy_info($argsObj->tproject_id);
$argsObj->tproject_name = $dummy['name'];
}
$argsObj->tplan_name = '';
if ($argsObj->tplan_id > 0) {
$tplan_mgr = new testplan($dbHandler);
$tplan_info = $tplan_mgr->get_by_id($argsObj->tplan_id);
$argsObj->tplan_name = $tplan_info['name'];
$argsObj->doIt = $tplan_mgr->count_testcases($argsObj->tplan_id) > 0;
$argsObj->showPlatforms = $tplan_mgr->hasLinkedPlatforms($argsObj->tplan_id);
$getOpt = array('outputFormat' => 'map');
$argsObj->platforms = $tplan_mgr->getPlatforms($argsObj->tplan_id, $getOpt);
unset($tplan_mgr);
}
return $argsObj;
}
示例13: initializeGui
function initializeGui(&$dbHandler, $args)
{
// BUGID 3930
global $g_locales_date_format;
$locale = isset($_SESSION['locale']) ? $_SESSION['locale'] : 'en_GB';
$date_format = $g_locales_date_format[$locale];
$gui = new stdClass();
$tplan_mgr = new testplan($dbHandler);
$tproject_mgr = new testproject($dbHandler);
$gui_open = config_get('gui_separator_open');
$gui_close = config_get('gui_separator_close');
$gui->str_option_any = $gui_open . lang_get('any') . $gui_close;
$gui->str_option_none = $gui_open . lang_get('nobody') . $gui_close;
$gui->tplan_id = $args->tplan_id;
$gui->tproject_id = $args->tproject_id;
$tplan_info = $tplan_mgr->get_by_id($gui->tplan_id);
$gui->tplan_name = $tplan_info['name'];
$tproject_info = $tproject_mgr->get_by_id($gui->tproject_id);
$gui->tproject_name = $tproject_info['name'];
$re = new results($dbHandler, $tplan_mgr, $tproject_info, $tplan_info);
$gui->assigned_users = new stdClass();
$gui->keywords = new stdClass();
$gui->builds = new stdClass();
$gui->platforms = new stdClass();
$gui->testsuites = new stdClass();
// 20090107 - franciscom
// Show only users that are able to execute test cases ?
// What happens if a user that has loose right to execute, but
// before loosing this right has been assigned some tests, or have executed it?
//
// $gui->assigned_users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, ADD_BLANK_OPTION);
// $gui->assigned_users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER,
// array(TL_USER_ANYBODY => $gui->str_option_any,
// TL_USER_NOBODY => $gui->str_option_none) );
//
$gui->assigned_users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, array(TL_USER_ANYBODY => $gui->str_option_any));
$gui->assigned_users->qty = count($gui->assigned_users->items);
// BUGID 2012 - franciscom
$gui->keywords->items[0] = $gui->str_option_any;
if (!is_null($tplan_keywords_map = $tplan_mgr->get_keywords_map($gui->tplan_id))) {
$gui->keywords->items += $tplan_keywords_map;
}
$gui->builds->items = $tplan_mgr->get_builds($gui->tplan_id, testplan::ACTIVE_BUILDS);
$gui->platforms->items = $tplan_mgr->getPlatforms($gui->tplan_id);
$gui->testsuites->items = $re->getTopLevelSuites();
$gui->keywords->qty = count($gui->keywords->items);
$gui->builds->qty = count($gui->builds->items);
$gui->platforms->qty = count($gui->platforms->items);
$gui->testsuites->qty = count($gui->testsuites->items);
$gui->status_code_label = get_status_for_reports_html_options();
$gui->report_type = $args->format;
$reports_cfg = config_get('reportsCfg');
// BUGID 3716
$startDate = strftime($date_format, time() - $reports_cfg->start_date_offset);
$gui->selected_start_date = $startDate;
$gui->selected_start_time = $reports_cfg->start_time;
// BUGID 3716
$gui->selected_end_date = strftime($date_format, time());
$gui->selected_end_time = null;
return $gui;
}
示例14: init_args
function init_args(&$dbHandler)
{
$argsObj = new stdClass();
$argsObj->doIt = false;
$argsObj->showPlatforms = false;
$argsObj->tproject_id = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0;
$argsObj->tproject_name = isset($_SESSION['testprojectName']) ? $_SESSION['testprojectName'] : '';
$argsObj->tplan_name = '';
$argsObj->tplan_id = isset($_REQUEST['tplan_id']) ? $_REQUEST['tplan_id'] : 0;
if ($argsObj->tplan_id == 0) {
$argsObj->tplan_id = isset($_SESSION['testplanID']) ? $_SESSION['testplanID'] : 0;
}
if ($argsObj->tplan_id > 0) {
$tplan_mgr = new testplan($dbHandler);
$tplan_info = $tplan_mgr->get_by_id($argsObj->tplan_id);
$argsObj->tplan_name = $tplan_info['name'];
$argsObj->doIt = $tplan_mgr->count_testcases($argsObj->tplan_id) > 0;
$argsObj->showPlatforms = $tplan_mgr->hasLinkedPlatforms($argsObj->tplan_id);
$getOpt = array('outputFormat' => 'map');
$argsObj->platforms = $tplan_mgr->getPlatforms($argsObj->tplan_id, $getOpt);
unset($tplan_mgr);
}
return $argsObj;
}
示例15: array
if ($args->build_id) {
$filters['build_id'] = $args->build_id;
// if build_id is set, show assignments regardless of build and tplan status
$filters['build_status'] = 'all';
$filters['tplan_status'] = 'all';
}
$tplan_param = $args->tplan_id ? array($args->tplan_id) : testcase::ALL_TESTPLANS;
$gui->resultSet = $tcase_mgr->get_assigned_to_user($args->user_id, $args->tproject_id, $tplan_param, $options, $filters);
if ($doIt = !is_null($gui->resultSet)) {
$tables = tlObjectWithDB::getDBTables(array('nodes_hierarchy'));
$tplanSet = array_keys($gui->resultSet);
$sql = "SELECT name,id FROM {$tables['nodes_hierarchy']} " . "WHERE id IN (" . implode(',', $tplanSet) . ")";
$gui->tplanNames = $db->fetchRowsIntoMap($sql, 'id');
$optColumns = array('user' => $args->show_user_column, 'priority' => $args->priority_enabled);
foreach ($gui->resultSet as $tplan_id => $tcase_set) {
$show_platforms = !is_null($tplan_mgr->getPlatforms($tplan_id));
$getOpt = array('outputFormat' => 'map');
$platforms = $tplan_mgr->getPlatforms($tplan_id, $getOpt);
list($columns, $sortByColumn) = getColumnsDefinition($optColumns, $show_platforms, $platforms);
$rows = array();
foreach ($tcase_set as $tcase_platform) {
foreach ($tcase_platform as $tcase) {
$current_row = array();
$tcase_id = $tcase['testcase_id'];
$tcversion_id = $tcase['tcversion_id'];
if ($args->show_user_column) {
$current_row[] = htmlspecialchars($names[$tcase['user_id']]['login']);
}
$current_row[] = htmlspecialchars($tcase['build_name']);
$current_row[] = htmlspecialchars($tcase['tcase_full_path']);
// create linked icons