Skip to content
Permalink
Browse files

Fix - TICKET 7508: Test Case Execution,can be configured to be assign…

…ed to an inactive or closed build (crash when no build available after applying conditions when trying to access feature)
  • Loading branch information...
fmancardi committed Apr 25, 2016
1 parent 88d5b46 commit 558c301212126e94c2da6f24af7b9625a76bf839
Showing with 60 additions and 7 deletions.
  1. +59 −7 lib/general/frmWorkArea.php
  2. +1 −0 locale/en_GB/strings.txt
@@ -84,7 +84,33 @@
// Check if for test project selected at least a test plan exist (BUGID 623)
if( isset($_SESSION['testplanID']) || !is_null($args->tplan_id))
{
$open = ($showFeature == 'executeTest') ? true : null;
// Filter on build attributes: ACTIVE,OPEN
switch($showFeature)
{
case 'executeTest':
$hasToBe['active'] = true;
$hasToBe['open'] = true;
$featureHint = lang_get('href_execute_test');
break;
case 'tc_exec_assignment':
$txcfg = config_get('tree_filter_cfg');
$cfg = $txcfg->testcases->plan_mode;
$hasToBe['active'] = $cfg->setting_build_inactive_out;
$hasToBe['open'] = $cfg->setting_build_close_out ;
$featureHint = lang_get('href_tc_exec_assignment');
break;
default:
$hasToBe['active'] = null;
$hasToBe['open'] = null;
$featureHint = lang_get('href_rep_and_metrics');
break;
}
$tplanIDCard = new stdClass();
$tplanIDCard->id = intval($_SESSION['testplanID']);
$tplanIDCard->name = $_SESSION['testplanName'];
@@ -96,8 +122,12 @@
$dummy = $tplanMgr->tree_manager->get_node_hierarchy_info($tplanIDCard->id);
$tplanIDCard->name = $dummy['name'];
}
validateBuildAvailability($db,$tplanMgr,$tplanIDCard->id,$tplanIDCard->name,
$_SESSION['testprojectName'], $open);
$ctx = new stdClass();
$ctx->tplanIDCard = $tplanIDCard;
$ctx->featureTitle = $featureHint;
validateBuildAvailability($db,$tplanMgr,$ctx,$hasToBe);
}
else
{
@@ -169,14 +199,36 @@
* to create link feature
*
*
* $open: if execution is wanted, check for open builds
*
*
**/
function validateBuildAvailability(&$db,&$tplanMgr,$tpID, $tpName, $prodName, $open)
function validateBuildAvailability(&$db,&$tplanMgr,$context,$attrFilter)
{
if (!$tplanMgr->getNumberOfBuilds($tpID, $open, $open))
$tpID = $context->tplanIDCard->id;
$tpName = $context->tplanIDCard->name;
if (!$tplanMgr->getNumberOfBuilds($tpID, $attrFilter['active'], $attrFilter['open']))
{
$message = '<p>' . lang_get('no_build_warning_part1') .
$msx = null;
if($attrFilter['active'])
{
$msx[] = lang_get('active');
}
if($attrFilter['open'])
{
$msx[] = lang_get('open');
}
$mzx = '';
if(count($msx) > 0)
{
$mzx = "(" . implode(' & ',$msx) . ")";
}
$message = "<p>" . $context->featureTitle .
"<p>" . sprintf(lang_get('no_good_build'),$mzx) .
"<b> " . htmlspecialchars($tpName) . "</b>";
$link_to_op = '';
@@ -2769,6 +2769,7 @@ $TLS_text_counter_feedback = "You may enter up to %d characters. Left ";
$TLS_create_a_build = "Create a new build";
$TLS_no_build_warning_part1 = "There has to be at least one active and open Build for this Test Plan.";
$TLS_no_build_warning_part2 = "Please create it first or ask your administrator.";
$TLS_no_good_build = "At least one Build %s is needed for this Test Plan";


// ----- lib/general/myTPInfo.php -----

0 comments on commit 558c301

Please sign in to comment.
You can’t perform that action at this time.