本文整理汇总了PHP中testproject::count_testcases方法的典型用法代码示例。如果您正苦于以下问题:PHP testproject::count_testcases方法的具体用法?PHP testproject::count_testcases怎么用?PHP testproject::count_testcases使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testproject
的用法示例。
在下文中一共展示了testproject::count_testcases方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_children
/**
*
*
*/
function display_children($dbHandler, $root_node, $parent, $filter_node, $tcprefix, $show_tcases = 1, $operation = 'manage', $helpText = array())
{
static $showTestCaseID;
$tables = tlObjectWithDB::getDBTables(array('tcversions', 'nodes_hierarchy', 'node_types'));
$forbidden_parent = array('testproject' => 'none', 'testcase' => 'testproject', 'testsuite' => 'none');
$external = '';
$nodes = null;
$filter_node_type = $show_tcases ? '' : ",'testcase'";
switch ($operation) {
case 'print':
$js_function = array('testproject' => 'TPROJECT_PTP', 'testsuite' => 'TPROJECT_PTS', 'testcase' => 'TPROJECT_PTS');
break;
case 'manage':
default:
$js_function = array('testproject' => 'EP', 'testsuite' => 'ETS', 'testcase' => 'ET');
break;
}
$sql = " SELECT NHA.*, NT.description AS node_type " . " FROM {$tables['nodes_hierarchy']} NHA, {$tables['node_types']} NT " . " WHERE NHA.node_type_id = NT.id " . " AND parent_id = " . intval($parent) . " AND NT.description NOT IN " . " ('testcase_version','testplan','requirement_spec','requirement'{$filter_node_type}) ";
if (!is_null($filter_node) && $filter_node > 0 && $parent == $root_node) {
$sql .= " AND NHA.id = " . intval($filter_node);
}
$sql .= " ORDER BY NHA.node_order ";
// for debug
//file_put_contents('/tmp/sql_display_node.txt', $sql);
$nodeSet = $dbHandler->get_recordset($sql);
if ($show_tcases) {
// Get external id, used on test case nodes
$sql = " SELECT DISTINCT tc_external_id,NHA.parent_id " . " FROM {$tables['tcversions']} TCV " . " JOIN {$tables['nodes_hierarchy']} NHA ON NHA.id = TCV.id " . " JOIN {$tables['nodes_hierarchy']} NHB ON NHA.parent_id = NHB.id " . " WHERE NHB.parent_id = " . intval($parent) . " AND NHA.node_type_id = 4";
$external = $dbHandler->fetchRowsIntoMap($sql, 'parent_id');
}
// print_r(array_values($nodeSet));
//file_put_contents('/tmpsql_display_node.txt', serialize(array_values($nodeSet)));
if (!is_null($nodeSet)) {
$tproject_mgr = new testproject($dbHandler);
foreach ($nodeSet as $key => $row) {
$path['text'] = htmlspecialchars($row['name']);
$path['id'] = $row['id'];
// this attribute/property is used on custom code on drag and drop
$path['position'] = $row['node_order'];
$path['leaf'] = false;
$path['cls'] = 'folder';
// customs key will be accessed using node.attributes.[key name]
$path['testlink_node_type'] = $row['node_type'];
$path['testlink_node_name'] = $path['text'];
// already htmlspecialchars() done
$path['forbidden_parent'] = 'none';
$tcase_qty = null;
switch ($row['node_type']) {
case 'testproject':
// at least on Test Specification seems that we do not execute this piece of code.
$path['href'] = "javascript:EP({$path['id']})";
$path['forbidden_parent'] = $forbidden_parent[$row['node_type']];
break;
case 'testsuite':
$tcase_qty = $tproject_mgr->count_testcases($row['id']);
$path['href'] = "javascript:" . $js_function[$row['node_type']] . "({$path['id']})";
$path['forbidden_parent'] = $forbidden_parent[$row['node_type']];
break;
case 'testcase':
$path['href'] = "javascript:" . $js_function[$row['node_type']] . "({$path['id']})";
$path['forbidden_parent'] = $forbidden_parent[$row['node_type']];
if (is_null($showTestCaseID)) {
$showTestCaseID = config_get('treemenu_show_testcase_id');
}
if ($showTestCaseID) {
$path['text'] = htmlspecialchars($tcprefix . $external[$row['id']]['tc_external_id'] . ":") . $path['text'];
}
$path['leaf'] = true;
break;
}
if (!is_null($tcase_qty)) {
$path['text'] .= " ({$tcase_qty})";
}
switch ($row['node_type']) {
case 'testproject':
case 'testsuite':
if (isset($helpText[$row['node_type']])) {
$path['text'] = '<span title="' . $helpText[$row['node_type']] . '">' . $path['text'] . '</span>';
}
break;
}
$nodes[] = $path;
}
}
return $nodes;
}
示例2: initializeGui
function initializeGui(&$db, $args)
{
$tcaseCfg = config_get('testcase_cfg');
$reqCfg = config_get('req_cfg');
$gui = new stdClass();
$gui->mainTitle = '';
$tprojectMgr = new testproject($db);
$tcasePrefix = $tprojectMgr->getTestCasePrefix($args->tproject_id);
$gui->tree_title = '';
$gui->ajaxTree = new stdClass();
$gui->ajaxTree->root_node = new stdClass();
$gui->ajaxTree->dragDrop = new stdClass();
$gui->ajaxTree->dragDrop->enabled = false;
$gui->ajaxTree->dragDrop->BackEndUrl = null;
$gui->ajaxTree->children = '';
// Prefix for cookie used to save tree state
$gui->ajaxTree->cookiePrefix = 'print' . str_replace(' ', '_', $args->doc_type) . '_';
$gui->doc_type = $args->doc_type;
switch ($args->doc_type) {
// BUGID 3067
case 'reqspec':
$gui->tree_title = lang_get('title_req_print_navigator');
$gui->ajaxTree->loader = $args->basehref . 'lib/ajax/getrequirementnodes.php?' . "root_node={$args->tproject_id}&" . "show_children=0&operation=print";
$gui->ajaxTree->loadFromChildren = 0;
$gui->ajaxTree->root_node->href = "javascript:TPROJECT_PTP_RS({$args->tproject_id})";
$gui->ajaxTree->root_node->id = $args->tproject_id;
$req_qty = $tprojectMgr->count_all_requirements($args->tproject_id);
$gui->ajaxTree->root_node->name = htmlspecialchars($args->tproject_name) . " ({$req_qty})";
$gui->ajaxTree->cookiePrefix .= $gui->ajaxTree->root_node->id . "_";
$gui->mainTitle = lang_get('requirement_specification_report');
break;
// end BUGID 3067
// end BUGID 3067
case 'testspec':
$gui->tree_title = lang_get('title_tc_print_navigator');
$gui->ajaxTree->loader = $args->basehref . 'lib/ajax/gettprojectnodes.php?' . "root_node={$args->tproject_id}&" . "show_tcases=0&operation=print&" . "tcprefix=" . urlencode($tcasePrefix . $tcaseCfg->glue_character) . "}";
$gui->ajaxTree->loadFromChildren = 0;
$gui->ajaxTree->root_node->href = "javascript:TPROJECT_PTP({$args->tproject_id})";
$gui->ajaxTree->root_node->id = $args->tproject_id;
$tcase_qty = $tprojectMgr->count_testcases($args->tproject_id);
$gui->ajaxTree->root_node->name = htmlspecialchars($args->tproject_name) . " ({$tcase_qty})";
$gui->ajaxTree->cookiePrefix .= $gui->ajaxTree->root_node->id . "_";
$gui->mainTitle = lang_get('testspecification_report');
break;
case 'testreport':
$gui->mainTitle = lang_get('test_report');
break;
case 'testplan':
$gui->tree_title = lang_get('title_tp_print_navigator');
$gui->ajaxTree->loadFromChildren = 1;
$gui->ajaxTree->loader = '';
$gui->mainTitle = lang_get('test_plan');
break;
}
$gui->mainTitle .= ' - ' . lang_get('doc_opt_title');
$gui->outputFormat = array(FORMAT_HTML => lang_get('format_html'), FORMAT_ODT => lang_get('format_odt'), FORMAT_MSWORD => lang_get('format_msword'));
return $gui;
}
示例3: initializeGui
/**
* Initialize gui (stdClass) object that will be used as argument
* in call to Template Engine.
*
* @param class pointer args: object containing User Input and some session values
* TBD structure
*
* ? tprojectMgr: test project manager object.
* ? treeDragDropEnabled: true/false. Controls Tree drag and drop behaivor.
*
* @return stdClass TBD structure
*/
function initializeGui(&$db, $args)
{
$tcaseCfg = config_get('testcase_cfg');
$reqCfg = config_get('req_cfg');
$gui = new stdClass();
$gui->showOptionsCheckBoxes = $gui->showOptions = $args->showOptions;
$gui->showHelpIcon = $args->showHelpIcon;
$gui->mainTitle = '';
$gui->outputFormat = array(FORMAT_HTML => lang_get('format_html'), FORMAT_MSWORD => lang_get('format_pseudo_msword'));
$gui->outputOptions = init_checkboxes($args);
if ($gui->showOptions == false) {
$loop2do = count($gui->outputOptions);
for ($idx = 0; $idx < $loop2do; $idx++) {
$gui->outputOptions[$idx]['checked'] = 'y';
}
}
$tprojectMgr = new testproject($db);
$tcasePrefix = $tprojectMgr->getTestCasePrefix($args->tproject_id);
$gui->tree_title = '';
$gui->ajaxTree = new stdClass();
$gui->ajaxTree->root_node = new stdClass();
$gui->ajaxTree->dragDrop = new stdClass();
$gui->ajaxTree->dragDrop->enabled = false;
$gui->ajaxTree->dragDrop->BackEndUrl = null;
$gui->ajaxTree->children = '';
// improved cookie prefix for test spec doc and req spec doc
$gui->ajaxTree->cookiePrefix = $args->doc_type . '_doc_';
$gui->doc_type = $args->doc_type;
$addTestPlanID = false;
switch ($args->doc_type) {
case DOC_REQ_SPEC:
$gui->showOptions = true;
$gui->showOptionsCheckBoxes = false;
$gui->tree_title = lang_get('title_req_print_navigator');
$gui->ajaxTree->loader = $args->basehref . 'lib/ajax/getrequirementnodes.php?' . "root_node={$args->tproject_id}&show_children=0&operation=print";
$gui->ajaxTree->loadFromChildren = 0;
$gui->ajaxTree->root_node->href = "javascript:TPROJECT_PTP_RS({$args->tproject_id})";
$gui->ajaxTree->root_node->id = $args->tproject_id;
$req_qty = $tprojectMgr->count_all_requirements($args->tproject_id);
$gui->ajaxTree->root_node->name = htmlspecialchars($args->tproject_name) . " ({$req_qty})";
$gui->ajaxTree->cookiePrefix .= "tproject_id_" . $gui->ajaxTree->root_node->id . "_";
$gui->mainTitle = lang_get('requirement_specification_report');
break;
case DOC_TEST_SPEC:
$gui->tree_title = lang_get('title_tc_print_navigator');
$gui->ajaxTree->loader = $args->basehref . 'lib/ajax/gettprojectnodes.php?' . "root_node={$args->tproject_id}&" . "show_tcases=0&operation=print&" . "tcprefix=" . urlencode($tcasePrefix . $tcaseCfg->glue_character) . "}";
$gui->ajaxTree->loadFromChildren = 0;
$gui->ajaxTree->root_node->href = "javascript:TPROJECT_PTP({$args->tproject_id})";
$gui->ajaxTree->root_node->id = $args->tproject_id;
$tcase_qty = $tprojectMgr->count_testcases($args->tproject_id);
$gui->ajaxTree->root_node->name = htmlspecialchars($args->tproject_name) . " ({$tcase_qty})";
$gui->ajaxTree->cookiePrefix .= "tproject_id_" . $gui->ajaxTree->root_node->id . "_";
$gui->mainTitle = lang_get('testspecification_report');
break;
case DOC_TEST_PLAN_EXECUTION:
$addTestPlanID = true;
$gui->mainTitle = lang_get('test_report');
break;
case DOC_TEST_PLAN_DESIGN:
$addTestPlanID = true;
$gui->tree_title = lang_get('title_tp_print_navigator');
$gui->ajaxTree->loadFromChildren = 1;
$gui->ajaxTree->loader = '';
$gui->mainTitle = lang_get('test_plan');
break;
case DOC_TEST_PLAN_EXECUTION_ON_BUILD:
$addTestPlanID = true;
$gui->mainTitle = lang_get('test_report_on_build');
break;
}
// Do not move
if ($args->mainTitle == '') {
$gui->mainTitle .= ' - ' . lang_get('doc_opt_title');
} else {
$gui->mainTitle = $args->mainTitle;
}
$gui->getArguments = "&type=" . $args->doc_type;
if ($addTestPlanID) {
$gui->getArguments .= '&docTestPlanId=' . $args->tplan_id;
}
return $gui;
}
示例4: isset
$testplanID = isset($_SESSION['testplanID']) ? intval($_SESSION['testplanID']) : 0;
$accessibleItems = $tproject_mgr->get_accessible_for_user($user->dbID, array('output' => 'map_name_with_inactive_mark'));
$tprojectQty = $tproject_mgr->getItemCount();
$userIsBlindFolded = (is_null($accessibleItems) || count($accessibleItems) == 0) && $tprojectQty > 0;
if ($userIsBlindFolded) {
$testprojectID = $testplanID = 0;
$_SESSION['testprojectTopMenu'] = '';
}
$tplan2check = null;
$currentUser = $_SESSION['currentUser'];
$userID = $currentUser->dbID;
$gui = new stdClass();
$gui->grants = getGrants($db, $user, $userIsBlindFolded);
$gui->hasTestCases = false;
if ($gui->grants['view_tc']) {
$gui->hasTestCases = $tproject_mgr->count_testcases($testprojectID) > 0 ? 1 : 0;
}
$gui->hasKeywords = false;
if ($gui->hasTestCases) {
$gui->hasKeywords = $tproject_mgr->hasKeywords($testprojectID);
}
// ----- Test Plan Section --------------------------------------------------------------
/**
* @TODO - franciscom - we must understand if these two calls are really needed,
* or is enough just call to getAccessibleTestPlans()
*/
$filters = array('plan_status' => ACTIVE);
$gui->num_active_tplans = $tproject_mgr->getActiveTestPlansCount($testprojectID);
//sizeof($tproject_mgr->get_all_testplans($testprojectID,$filters));
// get Test Plans available for the user
$arrPlans = $currentUser->getAccessibleTestPlans($db, $testprojectID);
示例5: importTestPlanLinksFromXML
/**
* @internal revisions
*/
function importTestPlanLinksFromXML(&$dbHandler, &$tplanMgr, $targetFile, $contextObj)
{
// <testplan>
// <name></name>
// <platforms>
// <platform>
// <name> </name>
// <internal_id></internal_id>
// </platform>
// <platform>
// ...
// </platform>
// </platforms>
// <executables>
// <link>
// <platform>
// <name> </name>
// </platform>
// <testcase>
// <name> </name>
// <externalid> </externalid>
// <version> </version>
// <execution_order> </execution_order>
// </testcase>
// </link>
// <link>
// ...
// </link>
// </executables>
// </testplan>
// </xml>
$msg = array();
$labels = init_labels(array('link_without_required_platform' => null, 'ok' => null, 'link_without_platform_element' => null, 'no_platforms_on_tproject' => null, 'tcase_link_updated' => null, 'link_with_platform_not_needed' => null, 'tproject_has_zero_testcases' => null, 'platform_not_on_tproject' => null, 'platform_linked' => null, 'platform_not_linked' => null, 'tcase_doesnot_exist' => null, 'tcversion_doesnot_exist' => null, 'not_imported' => null, 'link_to_tplan_feedback' => null, 'link_to_platform' => null));
// Double Check
// Check if Test Plan Parent (Test Project) has testcases, if not abort
$tprojectMgr = new testproject($dbHandler);
$tprojectInfo = $tprojectMgr->get_by_id($contextObj->tproject_id);
$tcasePrefix = $tprojectInfo['prefix'] . config_get('testcase_cfg')->glue_character;
$tprojectHasTC = $tprojectMgr->count_testcases($contextObj->tproject_id) > 0;
if (!$tprojectHasTC) {
$msg[] = array(sprintf($labels['tproject_has_zero_testcases'], $tprojectInfo['name']), $labels['not_imported']);
return $msg;
// >>>-----> Bye
}
$xml = @simplexml_load_file_wrapper($targetFile);
if ($xml !== FALSE) {
$tcaseMgr = new testcase($dbHandler);
$tcaseSet = array();
$tprojectMgr->get_all_testcases_id($contextObj->tproject_id, $tcaseSet, array('output' => 'external_id'));
$tcaseSet = array_flip($tcaseSet);
// Test Plan name will not be used
// <testplan> <name></name>
//
// Platform definition info will not be used
//
// I will try to link the platforms if are defined
$status_ok = true;
if (property_exists($xml, 'platforms')) {
$platformMgr = new tlPlatform($dbHandler, $contextObj->tproject_id);
$platformUniverse = $platformMgr->getAllAsMap();
if (is_null($platformUniverse)) {
$status_ok = false;
$msg[] = array($labels['no_platforms_on_tproject'], $labels['not_imported']);
} else {
$platformUniverse = array_flip($platformUniverse);
$op = processPlatforms($platformMgr, $tplanMgr, $platformUniverse, $xml->platforms, $labels, $contextObj->tplan_id);
$status_ok = $op['status_ok'];
$msg = $op['msg'];
}
}
if ($status_ok && $xml->xpath('//executables')) {
$tables = tlObjectWithDB::getDBTables(array('testplan_tcversions'));
$platformSet = $tplanMgr->getPlatforms($contextObj->tplan_id, array('outputFormat' => 'mapAccessByName'));
$targetHasPlatforms = count($platformSet) > 0;
$xmlLinks = $xml->executables->children();
$loops2do = count($xmlLinks);
// new dBug($platformSet);
for ($idx = 0; $idx < $loops2do; $idx++) {
// if Target Test Plan has platforms and importing file NO => Fatal Error
$targetName = null;
$platformID = -1;
$linkWithPlatform = false;
$status_ok = false;
$dummy_msg = null;
$import_status = $labels['ok'];
if ($platformElementExists = property_exists($xmlLinks[$idx], 'platform')) {
$targetName = trim((string) $xmlLinks[$idx]->platform->name);
$linkWithPlatform = $targetName != '';
}
// echo "\$targetHasPlatforms:$targetHasPlatforms<br>";
// echo "\$linkWithPlatform:$linkWithPlatform<br>";
if ($targetHasPlatforms) {
// each link need to have platform or will not be imported
if ($linkWithPlatform && isset($platformSet[$targetName])) {
$platformID = $platformSet[$targetName]['id'];
$status_ok = true;
$dummy_msg = null;
//.........这里部分代码省略.........