* Adjust testcase to bug.

This commit is contained in:
zhouxin
2022-11-02 15:42:21 +08:00
parent 70c83db1d3
commit 73e1c524c8
+47 -6
View File
@@ -2184,7 +2184,6 @@ class bugModel extends model
if(!empty($stepResults))
{
$i = 1;
$bugStep = '';
$bugResult = '';
$bugExpect = '';
@@ -2193,13 +2192,17 @@ class bugModel extends model
if(!isset($caseSteps[$stepId])) continue;
$step = $caseSteps[$stepId];
$stepResult = (!isset($stepResults[$stepId]) or empty($stepResults[$stepId]['real'])) ? '' : $stepResults[$stepId]['real'];
$bugStep .= $i . '. ' . $step->desc . "<br />";
$bugResult .= $i . '. ' . $stepResult . "<br />";
$bugExpect .= $i . '. ' . $step->expect . "<br />";
$i = $this->getCaseStepIndex($step);
$i++;
$stepDesc = str_replace("\n", "<br />", $step->desc);
$stepExpect = str_replace("\n", "<br />", $step->expect);
$stepResult = (!isset($stepResults[$stepId]) or empty($stepResults[$stepId]['real'])) ? '' : $stepResults[$stepId]['real'];
$bugStep .= $i . '. ' . $stepDesc . "<br />";
$bugResult .= $i . '. ' . $stepResult . "<br />";
$bugExpect .= $i . '. ' . $stepExpect . "<br />";
}
$bugSteps .= $bugStep ? str_replace('<br/>', '', $this->lang->bug->tplStep) . $bugStep : $this->lang->bug->tplStep;
$bugSteps .= $bugResult ? str_replace('<br/>', '', $this->lang->bug->tplResult) . $bugResult : $this->lang->bug->tplResult;
$bugSteps .= $bugExpect ? str_replace('<br/>', '', $this->lang->bug->tplExpect) . $bugExpect : $this->lang->bug->tplExpect;
@@ -3661,4 +3664,42 @@ class bugModel extends model
if(in_array($object, array('build','resolvedBuild'))) $relatedObjects= array('trunk' => $this->lang->trunk) + $relatedObjects;
return array('' => '', 0 => '') + $relatedObjects;
}
/**
* Return index of a case's step.
*
* @param object $caseStep
* @access public
* @return int
*/
public function getCaseStepIndex($caseStep)
{
static $index = 0;
static $stepIndex = 0;
static $itemIndex = 0;
static $groupID = 0;
if($caseStep->type == 'item')
{
if($groupID and $caseStep->parent == $groupID)
{
$itemIndex ++;
$index = $stepIndex . '. ' . $itemIndex;
}
else
{
$stepIndex ++;
$index = $stepIndex;
}
}
else
{
if($caseStep->type == 'group') $groupID = $caseStep->id;
$stepIndex ++;
$itemIndex = 0;
$index = $stepIndex;
}
return $index;
}
}