本文整理汇总了PHP中testplan::getLinkInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP testplan::getLinkInfo方法的具体用法?PHP testplan::getLinkInfo怎么用?PHP testplan::getLinkInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testplan
的用法示例。
在下文中一共展示了testplan::getLinkInfo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderTestCaseForPrinting
//.........这里部分代码省略.........
$getByID['tcversion_id'] = testcase::LATEST_VERSION;
$getExecutions = false;
break;
case SINGLE_TESTCASE:
$getByID['tcversion_id'] = $node['tcversion_id'];
$getExecutions = $options['passfail'] || $options['notes'] || $opt['step_exec_notes'] || $opt['step_exec_status'];
break;
default:
$getByID['tcversion_id'] = $node['tcversion_id'];
$getExecutions = $options['cfields'] || $options['passfail'] || $options['notes'] || $opt['step_exec_notes'] || $opt['step_exec_status'];
break;
}
if ($getExecutions) {
// Thanks to Evelyn from Cortado, have found a very old issue never reported.
// 1. create TC-1A VERSION 1
// 2. add to test plan and execute FAILED ON BUILD 1
// 3. Request Test Report (Test Plan EXECUTION REPORT).
// You will get spec for VERSION 1 and result for VERSION 1 - OK cool!
// 4. create VERSION 2
// 5. update linked Test Case Versions
// 6. do nothing more than repeat step 3
// without this fix you will get
// You will get spec for VERSION 2 and result for VERSION 1 - Hmmm
// and in addition is not clear that execution was on VERSION 1 . No GOOD!!
//
// HOW has been fixed ?
// Getting info about THE CURRENT LINKED test case version and looking for
// exec info for this.
//
// ATTENTION: THIS IS OK ONLY WHEN BUILD ID is not provided
//
//
// Get Linked test case version
$linkedItem = $tplan_mgr->getLinkInfo($tplan_id, $id, $platform_id);
$sql = " SELECT E.id AS execution_id, E.status, E.execution_ts, E.tester_id," . " E.notes, E.build_id, E.tcversion_id,E.tcversion_number,E.testplan_id," . " E.execution_type, E.execution_duration, " . " B.name AS build_name " . " FROM {$tables['executions']} E " . " JOIN {$tables['builds']} B ON B.id = E.build_id " . " WHERE 1 = 1 ";
if (isset($context['exec_id'])) {
$sql .= " AND E.id=" . intval($context['exec_id']);
} else {
$sql .= " AND E.testplan_id = " . intval($tplan_id) . " AND E.platform_id = " . intval($platform_id) . " AND E.tcversion_id = " . intval($linkedItem[0]['tcversion_id']);
if ($build_id > 0) {
$sql .= " AND E.build_id = " . intval($build_id);
} else {
// We are looking for LATEST EXECUTION of CURRENT LINKED test case version
$sql .= " AND E.tcversion_number=" . intval($linkedItem[0]['version']);
}
$sql .= " ORDER BY execution_id DESC";
}
$exec_info = $db->get_recordset($sql, null, 1);
$getByID['tcversion_id'] = $linkedItem[0]['tcversion_id'];
$getByID['filters'] = null;
$linkedItem = null;
if (!is_null($exec_info)) {
$getByID['tcversion_id'] = null;
$getByID['filters'] = array('version_number' => $exec_info[0]['tcversion_number']);
if (isset($options['build_cfields']) && $options['build_cfields']) {
if (!isset($buildCfields[$exec_info[0]['build_id']])) {
$buildCfields[$exec_info[0]['build_id']] = $build_mgr->html_table_of_custom_field_values($exec_info[0]['build_id'], $tprojectID);
}
}
}
}
$tcInfo = $tc_mgr->get_by_id($id, $getByID['tcversion_id'], $getByID['filters'], array('renderGhost' => true, 'renderImageInline' => true));
if ($tcInfo) {
$tcInfo = $tcInfo[0];
}
$external_id = $tcase_prefix . $tcInfo['tc_external_id'];
示例2: saveImportedResultData
//.........这里部分代码省略.........
if (!is_null($xx = $tplan_mgr->platform_mgr->getID($context->platformName))) {
$dummy = array(0 => array('id' => $xx));
}
}
}
if (!is_null($dummy)) {
$context->platformID = $dummy[0]['id'];
}
// --------------------------------------------------------------------
// --------------------------------------------------------------------
$optGB = array('tplan_id' => $context->tplanID, 'output' => 'minimun');
$dummy = null;
if (!is_null($context->buildID) && intval($context->buildID) > 0) {
$dummy = array($build_mgr->get_by_id($context->buildID, $optGB));
} else {
if (!is_null($context->buildName)) {
$dummy = $build_mgr->get_by_name($context->buildName, $optGB);
}
}
if (!is_null($dummy)) {
$context->buildID = $dummy[0]['id'];
}
// --------------------------------------------------------------------
// --------------------------------------------------------------------
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];
// New attribute "execution type" makes old XML import files incompatible
// Important NOTICE:
// tcase_exec is passed BY REFERENCE to allow check_exec_values()change execution type if needed
//
$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;
$info_on_case = $tplan_mgr->getLinkInfo($context->tplanID, $tcase_id, $context->platformID);
if (is_null($info_on_case)) {
$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']);
} else {
$info_on_case = current($info_on_case);
$tcversion_id = $info_on_case['tcversion_id'];
$version = $info_on_case['version'];
$notes = $db->prepare_string(trim($notes));
// N.B.: db_now() returns an string ready to be used in an SQL insert
// example '2008-09-04', while $tcase_exec["timestamp"] => 2008-09-04
//
$execution_ts = $tcase_exec['timestamp'] != '' ? "'" . $tcase_exec["timestamp"] . "'" : $db->db_now();
if ($tester_id != 0) {
$tester_name = $tcase_exec['tester'];
} else {
$tester_name = $user->login;
$tester_id = $context->userID;
}
$addExecDuration = strlen($tcase_exec['execution_duration']) > 0 && is_numeric($tcase_exec['execution_duration']);
$sql = " /* {$debugMsg} */ " . " INSERT INTO {$tables['executions']} (build_id,tester_id,status,testplan_id," . " tcversion_id,execution_ts,notes,tcversion_number,platform_id,execution_type" . ($addExecDuration ? ',execution_duration' : '') . ")" . " VALUES ({$context->buildID}, {$tester_id},'{$result_code}',{$context->tplanID}, " . " {$tcversion_id},{$execution_ts},'{$notes}', {$version}, " . " {$context->platformID}, {$tcase_exec['execution_type']}" . ($addExecDuration ? ",{$tcase_exec['execution_duration']}" : '') . ")";
$db->exec_query($sql);
if (isset($tcase_exec['bug_id']) && !is_null($tcase_exec['bug_id']) && is_array($tcase_exec['bug_id'])) {
$execution_id = $db->insert_id($tables['executions']);
foreach ($tcase_exec['bug_id'] as $bug_id) {
$bug_id = trim($bug_id);
$sql = " /* {$debugMsg} */ " . " SELECT execution_id AS check_qty FROM {$tables['execution_bugs']} " . " WHERE bug_id = '{$bug_id}' AND execution_id={$execution_id} ";
$rs = $db->get_recordset($sql);
if (is_null($rs)) {
$sql = " /* {$debugMsg} */ " . " INSERT INTO {$tables['execution_bugs']} (bug_id,execution_id)" . " VALUES ('" . $db->prepare_string($bug_id) . "', {$execution_id} )";
$db->exec_query($sql);
}
}
}
$message = sprintf($l18n['import_results_ok'], $tcase_identity, $version, $tester_name, $resulstCfg['code_status'][$result_code], $execution_ts);
}
}
}
if (!is_null($message)) {
$resultMap[] = array($message);
}
}
return $resultMap;
}
示例3: renderTestCaseForPrinting
//.........这里部分代码省略.........
case DOC_TEST_SPEC:
$getByID['tcversion_id'] = testcase::LATEST_VERSION;
break;
case SINGLE_TESTCASE:
$getByID['tcversion_id'] = $node['tcversion_id'];
$getExecutions = $options['cfields'] || $options['passfail'] || $options['notes'] || $options['step_exec_notes'] || $options['step_exec_status'];
break;
default:
$getByID['tcversion_id'] = $node['tcversion_id'];
$getExecutions = $options['cfields'] || $options['passfail'] || $options['notes'] || $options['step_exec_notes'] || $options['step_exec_status'];
break;
}
if ($getExecutions) {
// Thanks to Evelyn from Cortado, have found a very old issue never reported.
// 1. create TC-1A VERSION 1
// 2. add to test plan and execute FAILED ON BUILD 1
// 3. Request Test Report (Test Plan EXECUTION REPORT).
// You will get spec for VERSION 1 and result for VERSION 1 - OK cool!
// 4. create VERSION 2
// 5. update linked Test Case Versions
// 6. do nothing more than repeat step 3
// without this fix you will get
// You will get spec for VERSION 2 and result for VERSION 1 - Hmmm
// and in addition is not clear that execution was on VERSION 1 . No GOOD!!
//
// HOW has been fixed ?
// Getting info about THE CURRENT LINKED test case version and looking for
// exec info for this.
//
// ATTENTION: THIS IS OK ONLY WHEN BUILD ID is not provided
//
//
// Get Linked test case version
$linkedItem = $tplan_mgr->getLinkInfo($tplan_id, $id, $platform_id);
$sql = " SELECT E.id AS execution_id, E.status, E.execution_ts, E.tester_id," . " E.notes, E.build_id, E.tcversion_id,E.tcversion_number,E.testplan_id," . " B.name AS build_name,E.execution_duration " . " FROM {$tables['executions']} E, {$tables['builds']} B" . " WHERE E.build_id = B.id " . " AND E.testplan_id = " . intval($tplan_id) . " AND E.platform_id = " . intval($platform_id) . " AND E.tcversion_id = " . intval($linkedItem[0]['tcversion_id']);
if ($build_id > 0) {
$sql .= " AND E.build_id = " . intval($build_id);
} else {
// We are looking for LATEST EXECUTION of CURRENT LINKED test case version
$sql .= " AND E.tcversion_number=" . intval($linkedItem[0]['version']);
}
$sql .= " ORDER BY execution_id DESC";
$exec_info = $db->get_recordset($sql, null, 1);
$getByID['tcversion_id'] = $linkedItem[0]['tcversion_id'];
$getByID['filters'] = null;
if (!is_null($exec_info)) {
//
$getByID['tcversion_id'] = null;
$getByID['filters'] = array('version_number' => $exec_info[0]['tcversion_number']);
if ($options['build_cfields']) {
if (!isset($buildCfields[$exec_info[0]['build_id']])) {
$buildCfields[$exec_info[0]['build_id']] = $build_mgr->html_table_of_custom_field_values($exec_info[0]['build_id'], $tprojectID);
}
}
}
}
$tcInfo = $tc_mgr->get_by_id($id, $getByID['tcversion_id'], $getByID['filters'], array('renderGhost' => true));
if ($tcInfo) {
$tcInfo = $tcInfo[0];
}
$external_id = $tcase_prefix . $tcInfo['tc_external_id'];
$name = htmlspecialchars($node['name']);
$versionID = $tcInfo['id'];
$cfields = array('specScope' => null, 'execScope' => null);
if ($options['cfields']) {
if (!$locationFilters) {