本文整理汇总了PHP中testplan::get_max_build_id方法的典型用法代码示例。如果您正苦于以下问题:PHP testplan::get_max_build_id方法的具体用法?PHP testplan::get_max_build_id怎么用?PHP testplan::get_max_build_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testplan
的用法示例。
在下文中一共展示了testplan::get_max_build_id方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: migrate_user_assignments
/**
* Migrate the existing user assignments for all test plans and test projects.
* All test case execution assignments will be stored per build in TL 1.9.
* So all tester assignments for the test cases in each test plan will be updated
* with the ID of the newest available build for that test plan.
*
* @author Andreas Simon
* @param database $dbHandler
* @param array $tableSet
*/
function migrate_user_assignments(&$dbHandler, $tableSet)
{
//$starttime = microtime(true);
echo 'Step - User Execution Assignment Migration - STARTED <br> ';
echo 'Working - User Execution Assignment Migration <br> ';
$testplan_mgr = new testplan($dbHandler);
// get assignment type for execution
$assignment_mgr = new assignment_mgr($dbHandler);
$assignment_types = $assignment_mgr->get_available_types();
$execution = $assignment_types['testcase_execution']['id'];
// get table names
$ua = $tableSet['user_assignments'];
$tp_tcv = $tableSet['testplan_tcversions'];
// get list of test plan IDs from the assigned test cases
$sql = " SELECT distinct T.testplan_id " . " FROM {$ua} UA, {$tp_tcv} T " . " WHERE UA.feature_id = T.id " . " AND (UA.type={$execution} OR UA.type IS NULL) ";
$testplans = $dbHandler->fetchColumnsIntoArray($sql, 'testplan_id');
// Get the newest (max) build ID for each of these test plan IDs and store them.
// In $testplan_builds, we then have an array consisting of testplan_id => max_build_id
// If no build for a test plan is found, its assignments will not be changed (build_id=0).
$testplan_builds = array();
if (!is_null($testplans)) {
foreach ($testplans as $key => $tp_id) {
// first we try to get an active build
$max_build_id = $testplan_mgr->get_max_build_id($tp_id, testplan::GET_ACTIVE_BUILD);
// if there is no active build, we get the max id no matter if it is active or not
if ($max_build_id == 0) {
$max_build_id = $testplan_mgr->get_max_build_id($tp_id);
}
if ($max_build_id > 0) {
$testplan_builds[$tp_id] = $max_build_id;
}
}
// now update all assignments for these test plans
foreach ($testplan_builds as $testplan_id => $build_id) {
$subquery = " SELECT id as feature_id FROM {$tp_tcv} " . " WHERE testplan_id = {$testplan_id} ";
// This update with ALIAS is not LIKED by Postgres
//
// OK
// UPDATE user_assignments UA
// SET build_id = 2 WHERE UA.feature_id IN
// ( SELECT id AS feature_id FROM testplan_tcversions WHERE testplan_id = 70)
//
// if used UA.build_id -> problems on Postgre 8.4
// Message:
// ERROR: column "ua" of relation "user_assignments" does not exist
// LINE 2: SET UA.build_id = 2 WHERE UA.feature_id IN
// $sql = " UPDATE {$ua} UA " .
// " SET UA.build_id = {$build_id} " .
// " WHERE UA.feature_id IN($subquery) " .
// " AND (UA.type={$execution} OR UA.type IS NULL) ";
//
// 20101212 - franciscom
$sql = " UPDATE {$ua} " . " SET build_id = {$build_id} " . " WHERE feature_id IN({$subquery}) " . " AND (type={$execution} OR type IS NULL) ";
$dbHandler->exec_query($sql);
}
}
// delete objects
unset($testplan_mgr);
// check how long the function is running on huge databases...
//$endtime = microtime(true) - $starttime;
//echo "<br/>migrate_user_assignments() needed $endtime seconds to finish<br/>";
echo 'Step - User Execution Assignment Migration - Finished <br><br> ';
}
示例3: testplan
if ($addTestPlanID) {
$getArguments .= '&docTestPlanId=' . $args->tplan_id;
}
// generate tree
$tree = null;
$additionalArgs = '';
switch ($args->doc_type) {
case 'testspec':
case 'reqspec':
break;
case 'testplan':
case 'testreport':
$tplan_mgr = new testplan($db);
$tplan_info = $tplan_mgr->get_by_id($args->tplan_id);
$testplan_name = htmlspecialchars($tplan_info['name']);
$latestBuild = $tplan_mgr->get_max_build_id($args->tplan_id);
$filters = new stdClass();
$additionalInfo = new stdClass();
// ----- BUGID 3451 and related ---------------------------------------
// Notice: these variables were wrong since the changes to filtering system,
// but they did not cause the bug responsible for 3451.
// See print.inc.php for the real solution!
// Set of filters Off
// $filters->keyword_id = null;
// $filters->keywordsFilterType = null;
// $filters->tc_id = null;
// $filters->assignedTo = null;
// $filters->status = null;
// $filters->cf_hash = null;
// $filters->platform_id = null;
//
示例4: init_filter_result
/**
*
*/
private function init_filter_result()
{
$result_key = 'filter_result_result';
$method_key = 'filter_result_method';
$build_key = 'filter_result_build';
if (is_null($this->testplan_mgr)) {
$this->testplan_mgr = new testplan($this->db);
}
$tplan_id = $this->settings['setting_testplan']['selected'];
$this->configuration->results = config_get('results');
// determine, which config to load and use for filter methods - depends on mode!
$cfg = $this->mode == 'execution_mode' ? 'execution_filter_methods' : 'execution_assignment_filter_methods';
$this->configuration->filter_methods = config_get($cfg);
//
// CRITIC - Differences bewteen this configuration and
// (file const.inc.php)
// $tlCfg->execution_filter_methods['default_type']
// $tlCfg->execution_assignment_filter_methods['default_type']
//
// Will create issues: you will see an string on HTML SELECT, but code
// returned on submit will not code for string you are seeing.!!!!
//
// determine which filter method shall be selected by the JS function in template,
// when only one build is selectable by the user
$js_key_to_select = 0;
if ($this->mode == 'execution_mode') {
$js_key_to_select = $this->configuration->filter_methods['status_code']['current_build'];
} else {
if ($this->mode == 'plan_mode') {
$js_key_to_select = $this->configuration->filter_methods['status_code']['specific_build'];
}
}
// values selected by user
$result_selection = $this->args->{$result_key};
$method_selection = $this->args->{$method_key};
$build_selection = $this->args->{$build_key};
// default values
$default_filter_method = $this->configuration->filter_methods['default_type'];
$any_result_key = $this->configuration->results['status_code']['all'];
$newest_build_id = $this->testplan_mgr->get_max_build_id($tplan_id, testplan::GET_ACTIVE_BUILD);
if (is_null($method_selection)) {
$method_selection = $default_filter_method;
}
if (is_null($result_selection) || $this->args->reset_filters) {
// no selection yet or filter reset requested
$result_selection = $any_result_key;
$method_selection = $default_filter_method;
$build_selection = $newest_build_id;
} else {
$this->do_filtering = true;
}
// init array structure
$key = 'filter_result';
$this->filters[$key] = array($result_key => array('items' => null, 'selected' => $result_selection), $method_key => array('items' => array(), 'selected' => $method_selection, 'js_selection' => $js_key_to_select), $build_key => array('items' => null, 'selected' => $build_selection));
// init menu for result selection by function from exec.inc.php
$this->filters[$key][$result_key]['items'] = createResultsMenu();
$this->filters[$key][$result_key]['items'][$any_result_key] = $this->option_strings['any'];
// init menu for filter method selection
foreach ($this->configuration->filter_methods['status_code'] as $statusname => $statusshortcut) {
$code = $this->configuration->filter_methods['status_code'][$statusname];
$this->filters[$key][$method_key]['items'][$code] = lang_get($this->configuration->filter_methods['status_label'][$statusname]);
}
// init menu for build selection
$this->filters[$key][$build_key]['items'] = $this->testplan_mgr->get_builds_for_html_options($tplan_id, testplan::GET_ACTIVE_BUILD);
// if "any" is selected, nullify the active filters
if (is_array($result_selection) && in_array($any_result_key, $result_selection) || $result_selection == $any_result_key) {
$this->active_filters[$result_key] = null;
$this->active_filters[$method_key] = null;
$this->active_filters[$build_key] = null;
$this->filters[$key][$result_key]['selected'] = $any_result_key;
} else {
$this->active_filters[$result_key] = $result_selection;
$this->active_filters[$method_key] = $method_selection;
$this->active_filters[$build_key] = $build_selection;
}
}
示例5: migrate_user_assignments
/**
* Migrate the existing user assignments for all test plans and test projects.
* All test case execution assignments will be stored per build in TL 1.9.
* So all tester assignments for the test cases in each test plan will be updated
* with the ID of the newest available build for that test plan.
*
* @author Andreas Simon
* @param database $dbHandler
* @param array $tableSet
*/
function migrate_user_assignments(&$dbHandler, $tableSet)
{
//$starttime = microtime(true);
$testplan_mgr = new testplan($dbHandler);
// get assignment type for execution
$assignment_mgr = new assignment_mgr($dbHandler);
$assignment_types = $assignment_mgr->get_available_types();
$execution = $assignment_types['testcase_execution']['id'];
// get table names
$ua = $tableSet['user_assignments'];
$tp_tcv = $tableSet['testplan_tcversions'];
// get list of test plan IDs from the assigned test cases
$sql = " SELECT distinct T.testplan_id " . " FROM {$ua} UA, {$tp_tcv} T " . " WHERE UA.feature_id = T.id " . " AND (UA.type={$execution} OR UA.type IS NULL) ";
$testplans = $dbHandler->fetchColumnsIntoArray($sql, 'testplan_id');
// Get the newest (max) build ID for each of these test plan IDs and store them.
// In $testplan_builds, we then have an array consisting of testplan_id => max_build_id
// If no build for a test plan is found, its assignments will not be changed (build_id=0).
$testplan_builds = array();
foreach ($testplans as $key => $tp_id) {
// first we try to get an active build
$max_build_id = $testplan_mgr->get_max_build_id($tp_id, testplan::GET_ACTIVE_BUILD);
// if there is no active build, we get the max id no matter if it is active or not
if ($max_build_id == 0) {
$max_build_id = $testplan_mgr->get_max_build_id($tp_id);
}
if ($max_build_id > 0) {
$testplan_builds[$tp_id] = $max_build_id;
}
}
// now update all assignments for these test plans
foreach ($testplan_builds as $testplan_id => $build_id) {
$subquery = " SELECT id as feature_id FROM {$tp_tcv} " . " WHERE testplan_id = {$testplan_id} ";
$sql = " UPDATE {$ua} UA " . " SET UA.build_id = {$build_id} " . " WHERE UA.feature_id IN({$subquery}) " . " AND (UA.type={$execution} OR UA.type IS NULL) ";
$dbHandler->exec_query($sql);
}
// delete objects
unset($testplan_mgr);
// check how long the function is running on huge databases...
//$endtime = microtime(true) - $starttime;
//echo "<br/>migrate_user_assignments() needed $endtime seconds to finish<br/>";
}