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


PHP testcase::get_last_version_info方法代码示例

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


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

示例1: copy_linked_tcversions

 private function copy_linked_tcversions($id, $new_tplan_id, $user_id = -1, $options = null, $mappings = null, $build_id_mapping)
 {
     $debugMsg = 'Class:' . __CLASS__ . ' - Method: ' . __FUNCTION__;
     $my['options']['tcversion_type'] = null;
     $my['options']['copy_assigned_to'] = 0;
     $my['options'] = array_merge($my['options'], (array) $options);
     $now_ts = $this->db->db_now();
     $sql = "/* {$debugMsg} */ ";
     if ($my['options']['copy_assigned_to']) {
         // BUGID 3846
         $sql .= " SELECT TPTCV.*, COALESCE(UA.user_id,-1) AS tester, " . " COALESCE(UA.build_id,0) as assigned_build " . " FROM {$this->tables['testplan_tcversions']} TPTCV " . " LEFT OUTER JOIN {$this->tables['user_assignments']} UA ON " . " UA.feature_id = TPTCV.id " . " WHERE testplan_id={$id} ";
     } else {
         $sql .= " SELECT TPTCV.* FROM {$this->tables['testplan_tcversions']} TPTCV" . " WHERE testplan_id={$id} ";
     }
     $rs = $this->db->get_recordset($sql);
     if (!is_null($rs)) {
         $tcase_mgr = new testcase($this->db);
         $doMappings = !is_null($mappings);
         // BUGID 3846
         $already_linked_versions = array();
         foreach ($rs as $elem) {
             $tcversion_id = $elem['tcversion_id'];
             // Seems useless - 20100204
             $feature_id = $elem['id'];
             if (!is_null($my['options']['tcversion_type'])) {
                 $sql = "/* {$debugMsg} */ SELECT * FROM {$this->tables['nodes_hierarchy']} WHERE id={$tcversion_id} ";
                 $rs2 = $this->db->get_recordset($sql);
                 $last_version_info = $tcase_mgr->get_last_version_info($rs2[0]['parent_id']);
                 $tcversion_id = $last_version_info ? $last_version_info['id'] : $tcversion_id;
             }
             // mapping need to be done with:
             // platforms
             // test case versions
             $platform_id = $elem['platform_id'];
             if ($doMappings) {
                 if (isset($mappings['platforms'][$platform_id])) {
                     $platform_id = $mappings['platforms'][$platform_id];
                 }
                 if (isset($mappings['test_spec'][$tcversion_id])) {
                     $tcversion_id = $mappings['test_spec'][$tcversion_id];
                 }
             }
             $sql = "/* {$debugMsg} */ " . " INSERT INTO {$this->tables['testplan_tcversions']} " . " (testplan_id,tcversion_id,platform_id,node_order,urgency) " . " VALUES({$new_tplan_id},{$tcversion_id},{$platform_id}," . " {$elem['node_order']},{$elem['urgency']})";
             //echo "<br>debug - <b><i>" . __FUNCTION__ . "</i></b><br><b>" . $sql . "</b><br>";
             // BUGID 3846
             if (!in_array($tcversion_id, $already_linked_versions)) {
                 $this->db->exec_query($sql);
                 $new_feature_id = $this->db->insert_id($this->tables['testplan_tcversions']);
                 $already_linked_versions[] = $tcversion_id;
             }
             if ($my['options']['copy_assigned_to'] && $elem['tester'] > 0) {
                 $features_map = array();
                 $feature_id = $new_feature_id;
                 $features_map[$feature_id]['user_id'] = $elem['tester'];
                 // BUGID 3846
                 $features_map[$feature_id]['build_id'] = $build_id_mapping[$elem['assigned_build']];
                 $features_map[$feature_id]['type'] = $this->assignment_types['testcase_execution']['id'];
                 $features_map[$feature_id]['status'] = $this->assignment_status['open']['id'];
                 $features_map[$feature_id]['creation_ts'] = $now_ts;
                 $features_map[$feature_id]['assigner_id'] = $user_id;
                 if ($features_map[$feature_id]['build_id'] != 0) {
                     $this->assignment_mgr->assign($features_map);
                 }
             }
         }
     }
 }
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:67,代码来源:testplan.class.php

示例2: array

 /**
  * get_children_testcases
  * get only test cases with parent=testsuite without doing a deep search
  *
  */
 function get_children_testcases($id, $details = 'simple')
 {
     $testcases = null;
     $only_id = $details == 'only_id' ? true : false;
     $subtree = $this->tree_manager->get_children($id, array('testsuite' => 'exclude_me'));
     $doit = !is_null($subtree);
     if ($doit) {
         $tsuite = $this->get_by_id($id);
         $tsuiteName = $tsuite['name'];
         $testcases = array();
         foreach ($subtree as $the_key => $elem) {
             if ($only_id) {
                 $testcases[] = $elem['id'];
             } else {
                 $testcases[] = $elem;
             }
         }
         $doit = count($testcases) > 0;
     }
     if ($doit && $details == 'full') {
         $rs = array();
         $tcase_mgr = new testcase($this->db);
         foreach ($testcases as $idx => $value) {
             $item = $tcase_mgr->get_last_version_info($value['id']);
             $item['tcversion_id'] = $item['id'];
             $parent['tsuite_name'] = $tsuiteName;
             unset($item['id']);
             $rs[] = $value + $item + $tsuite;
         }
         $testcases = $rs;
     }
     return $testcases;
 }
开发者ID:tamtrong,项目名称:testlink,代码行数:38,代码来源:testsuite.class.php

示例3: saveImportedTCData


//.........这里部分代码省略.........
        $preconditions = $tc['preconditions'];
        $exec_type = isset($tc['execution_type']) ? $tc['execution_type'] : TESTCASE_EXECUTION_TYPE_MANUAL;
        $importance = isset($tc['importance']) ? $tc['importance'] : MEDIUM;
        $externalid = $tc['externalid'];
        if (intval($externalid) <= 0) {
            $externalid = null;
        }
        $personID = $userID;
        if (!is_null($tc['author_login'])) {
            if (isset($userIDCache[$tc['author_login']])) {
                $personID = $userIDCache[$tc['author_login']];
            } else {
                $userObj->login = $tc['author_login'];
                if ($userObj->readFromDB($db, tlUser::USER_O_SEARCH_BYLOGIN) == tl::OK) {
                    $personID = $userObj->dbID;
                }
                // I will put always a valid userID on this cache,
                // this way if author_login does not exit, and is used multiple times
                // i will do check for existence JUST ONCE.
                $userIDCache[$tc['author_login']] = $personID;
            }
        }
        $name_len = tlStringLen($name);
        if ($name_len > $fieldSizeCfg->testcase_name) {
            // Will put original name inside summary
            $xx = $messages['start_feedback'];
            $xx .= sprintf($messages['testcase_name_too_long'], $name_len, $fieldSizeCfg->testcase_name) . "\n";
            $xx .= $messages['original_name'] . "\n" . $name . "\n" . $messages['end_warning'] . "\n";
            $summary = nl2br($xx) . $summary;
            $name = tlSubStr($name, 0, $safeSizeCfg->testcase_name);
        }
        $kwIDs = null;
        if (isset($tc['keywords']) && $tc['keywords']) {
            $kwIDs = implode(",", buildKeywordList($kwMap, $tc['keywords']));
        }
        $doCreate = true;
        if ($duplicatedLogic['actionOnHit'] == 'update_last_version') {
            switch ($duplicatedLogic['hitCriteria']) {
                case 'name':
                    $info = $tcase_mgr->getDuplicatesByName($name, $container_id);
                    break;
                case 'internalID':
                    $dummy = $tcase_mgr->tree_manager->get_node_hierarchy_info($internalid, $container_id);
                    if (!is_null($dummy)) {
                        $info = null;
                        $info[$internalid] = $dummy;
                    }
                    break;
                case 'externalID':
                    $info = $tcase_mgr->get_by_external($externalid, $container_id);
                    break;
            }
            if (!is_null($info)) {
                $tcase_qty = count($info);
                switch ($tcase_qty) {
                    case 1:
                        $doCreate = false;
                        $tcase_id = key($info);
                        $last_version = $tcase_mgr->get_last_version_info($tcase_id, $getVersionOpt);
                        $tcversion_id = $last_version['id'];
                        $ret = $tcase_mgr->update($tcase_id, $tcversion_id, $name, $summary, $preconditions, $steps, $personID, $kwIDs, $node_order, $exec_type, $importance);
                        $ret['id'] = $tcase_id;
                        $ret['tcversion_id'] = $tcversion_id;
                        $resultMap[] = array($name, $messages['already_exists_updated']);
                        break;
                    case 0:
                        $doCreate = true;
                        break;
                    default:
                        $doCreate = false;
                        break;
                }
            }
        }
        if ($doCreate) {
            // Want to block creation of with existent EXTERNAL ID, if containers ARE DIFFERENT.
            $item_id = intval($tcase_mgr->getInternalID($externalid, array('tproject_id' => $tproject_id)));
            if ($item_id > 0) {
                // who is his parent ?
                $owner = $tcase_mgr->getTestSuite($item_id);
                if ($owner != $container_id) {
                    // Get full path of existent Test Cases
                    $stain = $tcase_mgr->tree_manager->get_path($item_id, null, 'name');
                    $n = count($stain);
                    $stain[$n - 1] = $tcasePrefix . config_get('testcase_cfg')->glue_character . $externalid . ':' . $stain[$n - 1];
                    $stain = implode('/', $stain);
                    $resultMap[] = array($name, $messages['hit_with_same_external_ID'] . $stain);
                    $doCreate = false;
                }
            }
        }
        if ($doCreate) {
            $createOptions = array('check_duplicate_name' => testcase::CHECK_DUPLICATE_NAME, 'action_on_duplicate_name' => $duplicatedLogic['actionOnHit'], 'external_id' => $externalid);
            if ($ret = $tcase_mgr->create($container_id, $name, $summary, $preconditions, $steps, $personID, $kwIDs, $node_order, testcase::AUTOMATIC_ID, $exec_type, $importance, $createOptions)) {
                $resultMap[] = array($name, $ret['msg']);
            }
        }
    }
    return $resultMap;
}
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:101,代码来源:tcCreateFromIssueMantisXML.php

示例4: testcase

*	20091109 - franciscom - BUGID  0002937: add/remove test case hover over test case 
*                                           tooltip replacement with summary 
*/
require_once '../../config.inc.php';
require_once 'common.php';
testlinkInitPage($db);
// BUGID 4066 - take care of proper escaping when magic_quotes_gpc is enabled
$_REQUEST = strings_stripSlashes($_REQUEST);
$tcase_mgr = new testcase($db);
$tcase_id = isset($_REQUEST['tcase_id']) ? $_REQUEST['tcase_id'] : null;
$tcversion_id = isset($_REQUEST['tcversion_id']) ? $_REQUEST['tcversion_id'] : 0;
$info = '';
if (!is_null($tcase_id)) {
    if ($tcversion_id > 0) {
        $tcase = $tcase_mgr->get_by_id($tcase_id, $tcversion_id);
        if (!is_null($tcase)) {
            $tcase = $tcase[0];
        }
    } else {
        $tcase = $tcase_mgr->get_last_version_info($tcase_id);
    }
    $info = $tcase['summary'];
    // <p> and </p> tag at the beginning and the end of summary cause visualization
    // errors -> remove them and add <br> to get a similar effect
    $info = str_replace("<p>", "", $info);
    $info = str_replace("</p>", "<br>", $info);
    if ($info == "") {
        $info = lang_get("empty_tc_summary");
    }
}
echo $info;
开发者ID:moraesmv,项目名称:testlink-code,代码行数:31,代码来源:gettestcasesummary.php

示例5: saveImportedTCData


//.........这里部分代码省略.........
        $name_len = tlStringLen($name);
        if ($name_len > $fieldSizeCfg->testcase_name) {
            // Will put original name inside summary
            $xx = $messages['start_feedback'];
            $xx .= sprintf($messages['testcase_name_too_long'], $name_len, $fieldSizeCfg->testcase_name) . "\n";
            $xx .= $messages['original_name'] . "\n" . $name . "\n" . $messages['end_warning'] . "\n";
            $summary = nl2br($xx) . $summary;
            $name = tlSubStr($name, 0, $safeSizeCfg->testcase_name);
        }
        $kwIDs = null;
        if (isset($tc['keywords']) && $tc['keywords']) {
            $kwIDs = implode(",", buildKeywordList($kwMap, $tc['keywords']));
        }
        $doCreate = true;
        if ($duplicatedLogic['actionOnHit'] == 'update_last_version') {
            switch ($duplicatedLogic['hitCriteria']) {
                case 'name':
                    $info = $tcase_mgr->getDuplicatesByName($name, $container_id);
                    break;
                case 'internalID':
                    $dummy = $tcase_mgr->tree_manager->get_node_hierarchy_info($internalid, $container_id);
                    if (!is_null($dummy)) {
                        $info[$internalid] = $dummy;
                    }
                    break;
                case 'externalID':
                    $info = $tcase_mgr->get_by_external($externalid, $container_id);
                    break;
            }
            if (!is_null($info)) {
                $tcase_qty = count($info);
                switch ($tcase_qty) {
                    case 1:
                        $doCreate = false;
                        $tcase_id = key($info);
                        $last_version = $tcase_mgr->get_last_version_info($tcase_id, $getVersionOpt);
                        $tcversion_id = $last_version['id'];
                        $ret = $tcase_mgr->update($tcase_id, $tcversion_id, $name, $summary, $preconditions, $steps, $userID, $kwIDs, $node_order, $exec_type, $importance);
                        // BUGID 3801
                        $ret['id'] = $tcase_id;
                        $ret['tcversion_id'] = $tcversion_id;
                        $resultMap[] = array($name, $messages['already_exists_updated']);
                        break;
                    case 0:
                        $doCreate = true;
                        break;
                    default:
                        $doCreate = false;
                        break;
                }
            }
        }
        if ($doCreate) {
            $createOptions = array('check_duplicate_name' => testcase::CHECK_DUPLICATE_NAME, 'action_on_duplicate_name' => $duplicatedLogic['actionOnHit']);
            if ($ret = $tcase_mgr->create($container_id, $name, $summary, $preconditions, $steps, $userID, $kwIDs, $node_order, testcase::AUTOMATIC_ID, $exec_type, $importance, $createOptions)) {
                $resultMap[] = array($name, $ret['msg']);
            }
        }
        // 20090106 - franciscom
        // Custom Fields Management
        // Check if CF with this name and that can be used on Test Cases is defined in current Test Project.
        // If Check fails => give message to user.
        // Else Import CF data
        //
        $hasCustomFieldsInfo = isset($tc['customfields']) && !is_null($tc['customfields']);
        if ($hasCustomFieldsInfo) {
            new dBug($ret);
            if ($tprojectHas['customFields']) {
                // BUGID 3431 - Custom Field values at Test Case VERSION Level
                $msg = processCustomFields($tcase_mgr, $name, $ret['id'], $ret['tcversion_id'], $tc['customfields'], $linkedCustomFields, $feedbackMsg);
                if (!is_null($msg)) {
                    $resultMap = array_merge($resultMap, $msg);
                }
            } else {
                // Can not import Custom Fields Values, give feedback
                $msg[] = array($name, $messages['cf_warning']);
                $resultMap = array_merge($resultMap, $msg);
            }
        }
        // BUGID - 20090205 - franciscom
        // Requirements Management
        // Check if Requirement ...
        // If Check fails => give message to user.
        // Else Import
        //
        $hasRequirements = isset($tc['requirements']) && !is_null($tc['requirements']);
        if ($hasRequirements) {
            if ($tprojectHas['reqSpec']) {
                $msg = processRequirements($db, $req_mgr, $name, $ret['id'], $tc['requirements'], $reqSpecSet, $feedbackMsg);
                if (!is_null($msg)) {
                    $resultMap = array_merge($resultMap, $msg);
                }
            } else {
                $msg[] = array($name, $messages['reqspec_warning']);
                $resultMap = array_merge($resultMap, $msg);
            }
        }
    }
    return $resultMap;
}
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:101,代码来源:tcImport.php


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