Exemplo n.º 1
0
 function get_testcases_deep($id, $details = 'simple')
 {
     $tcase_mgr = new testcase($this->db);
     $testcases = null;
     $subtree = $this->get_subtree($id);
     $only_id = $details == 'only_id' ? true : false;
     $doit = !is_null($subtree);
     $parentSet = null;
     if ($doit) {
         $testcases = array();
         $tcNodeType = $this->node_types_descr_id['testcase'];
         $prefix = null;
         foreach ($subtree as $the_key => $elem) {
             if ($elem['node_type_id'] == $tcNodeType) {
                 if ($only_id) {
                     $testcases[] = $elem['id'];
                 } else {
                     // After first call passing $prefix with right value, avoids a function call
                     // inside of getExternalID();
                     list($identity, $prefix, $glueChar, $external) = $tcase_mgr->getExternalID($elem['id'], null, $prefix);
                     $elem['external_id'] = $identity;
                     $testcases[] = $elem;
                     $parentSet[$elem['parent_id']] = $elem['parent_id'];
                 }
             }
         }
         $doit = count($testcases) > 0;
     }
     if ($doit && $details == 'full') {
         $parentNodes = $this->tree_manager->get_node_hierarchy_info($parentSet);
         $rs = array();
         foreach ($testcases as $idx => $value) {
             $item = $tcase_mgr->get_last_version_info($value['id']);
             $item['tcversion_id'] = $item['id'];
             $tsuite['tsuite_name'] = $parentNodes[$value['parent_id']]['name'];
             unset($item['id']);
             $rs[] = $value + $item + $tsuite;
         }
         $testcases = $rs;
     }
     return $testcases;
 }
Exemplo n.º 2
0
    $gui->export_filename = 'testsuites.xml';
    if ($node_id == $args->tproject_id) {
        $gui->page_title = lang_get('title_tsuite_export_all');
        $gui->export_filename = 'all_testsuites.xml';
        $check_children = 1;
        $gui->nothing_todo_msg = lang_get('no_testsuites_to_export');
    }
} else {
    // Exporting situations:
    // All test cases in test suite.
    // One test case.
    $exporting_just_one_tc = $args->tcase_id && $args->tcversion_id;
    if ($exporting_just_one_tc) {
        $objMgr = new testcase($db);
        $dummy = $objMgr->get_by_id($args->tcase_id, testcase::ALL_VERSIONS, null, array('output' => 'essential'));
        $ext = $objMgr->getExternalID($args->tcase_id, $args->tproject_id);
        $gui->export_filename = 'testcase-' . $ext[0] . '-' . $dummy[0]['name'];
        $node_id = $args->tcase_id;
        $gui->page_title = lang_get('title_tc_export');
    } else {
        $dummy = $tree_mgr->get_node_hierarchy_info($args->container_id);
        $gui->export_filename = $dummy['name'] . '-children-testcases';
        $gui->page_title = lang_get('title_tc_export_all');
        $check_children = 1;
        $gui->nothing_todo_msg = lang_get('no_testcases_to_export');
    }
    $gui->export_filename = str_replace(' ', '-', $gui->export_filename) . '.xml';
}
$gui->export_filename = is_null($args->export_filename) ? $gui->export_filename : $args->export_filename;
if ($check_children) {
    // Check if there is something to export
Exemplo n.º 3
0
<?php

require_once '../../config.inc.php';
require_once 'common.php';
require_once 'exec.inc.php';
require_once "attachments.inc.php";
require_once "web_editor.php";
testlinkInitPage($db);
$templateCfg = templateConfiguration();
$tcase_mgr = new testcase($db);
$args = init_args();
$gui = new stdClass();
$gui->exec_cfg = config_get('exec_cfg');
$node['basic'] = $tcase_mgr->tree_manager->get_node_hierarchy_info($args->tcase_id);
$node['specific'] = $tcase_mgr->getExternalID($args->tcase_id);
$idCard = $node['specific'][0] . ' : ' . $node['basic']['name'];
$gui->tproject_id = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0;
$gui->execSet = $tcase_mgr->getExecutionSetBuild($args->tplan_id, $args->build_id, $args->tcase_id);
//retuen
$gui->warning_msg = !is_null($gui->execSet) ? '' : lang_get('tcase_never_executed');
$gui->user_is_admin = $args->user->globalRole->name == 'admin' ? true : false;
$gui->execPlatformSet = null;
$gui->cfexec = null;
$gui->attachments = null;
$gui->main_descr = lang_get('execution_history');
$gui->detailed_descr = lang_get('test_case') . ' ' . $idCard;
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
function init_args()
{