./config/my.php.back
This commit is contained in:
+39
-45
@@ -1359,53 +1359,47 @@ class bugModel extends model
|
||||
{
|
||||
$run = $this->loadModel('testtask')->getRunById($result->run);
|
||||
}
|
||||
if($result and $result->caseResult == 'fail')
|
||||
$title = $run->case->title;
|
||||
$caseSteps = $run->case->steps;
|
||||
$stepResults = unserialize($result->stepResults);
|
||||
if($run->case->precondition != '')
|
||||
{
|
||||
$title = $run->case->title;
|
||||
$caseSteps = $run->case->steps;
|
||||
$stepResults = unserialize($result->stepResults);
|
||||
if($run->case->precondition != '')
|
||||
{
|
||||
$bugSteps = "<p>[" . $this->lang->testcase->precondition . "]</p>" . "\n" . $run->case->precondition;
|
||||
}
|
||||
$bugSteps .= $this->lang->bug->tplStep;
|
||||
if(!empty($stepResults))
|
||||
{
|
||||
$i = 0;
|
||||
foreach($caseSteps as $key => $step)
|
||||
{
|
||||
if(!in_array($step->id, $steps)) continue;
|
||||
$i++;
|
||||
$bugSteps .= $i . '. ' . $step->desc . "<br />";
|
||||
}
|
||||
|
||||
$bugSteps .= $this->lang->bug->tplResult;
|
||||
$i = 0;
|
||||
foreach($caseSteps as $key => $step)
|
||||
{
|
||||
if(!in_array($step->id, $steps)) continue;
|
||||
$i++;
|
||||
if(empty($stepResults[$step->id]['real'])) continue;
|
||||
$bugSteps .= $i . '. ' . $stepResults[$step->id]['real'] . "<br />";
|
||||
}
|
||||
|
||||
$bugSteps .= $this->lang->bug->tplExpect;
|
||||
$i = 0;
|
||||
foreach($caseSteps as $key => $step)
|
||||
{
|
||||
if(!in_array($step->id, $steps)) continue;
|
||||
$i++;
|
||||
if(!$step->expect) continue;
|
||||
$bugSteps .= $i . '. ' . $step->expect . "<br />";
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$bugSteps .= $this->lang->bug->tplResult;
|
||||
$bugSteps .= $this->lang->bug->tplExpect;
|
||||
}
|
||||
$bugSteps = "<p>[" . $this->lang->testcase->precondition . "]</p>" . "\n" . $run->case->precondition;
|
||||
}
|
||||
|
||||
$bugSteps .= $this->lang->bug->tplStep;
|
||||
if(!empty($stepResults))
|
||||
{
|
||||
$i = 0;
|
||||
foreach($caseSteps as $key => $step)
|
||||
{
|
||||
if(!in_array($step->id, $steps)) continue;
|
||||
$i++;
|
||||
$bugSteps .= $i . '. ' . $step->desc . "<br />";
|
||||
}
|
||||
|
||||
$bugSteps .= $this->lang->bug->tplResult;
|
||||
$i = 0;
|
||||
foreach($caseSteps as $key => $step)
|
||||
{
|
||||
if(!in_array($step->id, $steps)) continue;
|
||||
$i++;
|
||||
if(empty($stepResults[$step->id]['real'])) continue;
|
||||
$bugSteps .= $i . '. ' . $stepResults[$step->id]['real'] . "<br />";
|
||||
}
|
||||
|
||||
$bugSteps .= $this->lang->bug->tplExpect;
|
||||
$i = 0;
|
||||
foreach($caseSteps as $key => $step)
|
||||
{
|
||||
if(!in_array($step->id, $steps)) continue;
|
||||
$i++;
|
||||
if(!$step->expect) continue;
|
||||
$bugSteps .= $i . '. ' . $step->expect . "<br />";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return array('title' => $title, 'steps' => $bugSteps, 'storyID' => $run->case->story, 'moduleID' => $run->case->module, 'version' => $run->case->version);
|
||||
}
|
||||
|
||||
|
||||
@@ -497,14 +497,11 @@ class testcase extends control
|
||||
}
|
||||
|
||||
if(!$case) die(js::error($this->lang->notFound) . js::locate('back', 'parent'));
|
||||
if(empty($case->steps)) die(js::locate($this->createLink('bug', 'create', "product=$productID&branch=$branch&extras=$extras"), 'parent'));
|
||||
|
||||
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->createBug;
|
||||
$this->view->case = $case;
|
||||
$this->view->result = reset($results);
|
||||
$this->view->extras = $extras;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->branch = $branch;
|
||||
$this->view->runID = $runID;
|
||||
$this->view->caseID = $caseID;
|
||||
$this->view->version = $version;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -546,6 +543,9 @@ class testcase extends control
|
||||
$this->view->productName = $this->products[$productID];
|
||||
$this->view->branchName = $this->session->currentProductType == 'normal' ? '' : $this->loadModel('branch')->getById($case->branch);
|
||||
}
|
||||
|
||||
$caseFailCount = $this->dao->select('`case` AS name, COUNT(*) AS value')->from(TABLE_TESTRESULT)->where('caseResult')->eq('fail')->andwhere('`case`')->eq($caseID)->groupBy('name')->orderBy('value DESC')->fetchAll('name');
|
||||
|
||||
$this->view->position[] = $this->lang->testcase->common;
|
||||
$this->view->position[] = $this->lang->testcase->view;
|
||||
|
||||
@@ -559,6 +559,7 @@ class testcase extends control
|
||||
$this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('testcase', $caseID);
|
||||
$this->view->runID = $from == 'testcase' ? 0 : $run->id;
|
||||
$this->view->isLibCase = $isLibCase;
|
||||
$this->view->caseFailCount = $caseFailCount ? $caseFailCount : 0;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -861,7 +861,7 @@ class testcaseModel extends model
|
||||
{
|
||||
$action = strtolower($action);
|
||||
|
||||
if($action == 'createbug') return $case->lastRunResult == 'fail';
|
||||
if($action == 'createbug') return $case->caseFailCount > 0;
|
||||
if($action == 'review') return $case->status == 'wait';
|
||||
|
||||
return true;
|
||||
@@ -1263,6 +1263,7 @@ class testcaseModel extends model
|
||||
{
|
||||
$caseBugs = $this->dao->select('count(*) as count, `case`')->from(TABLE_BUG)->where('`case`')->in($caseIdList)->andWhere('deleted')->eq(0)->groupBy('`case`')->fetchPairs('case', 'count');
|
||||
$results = $this->dao->select('count(*) as count, `case`')->from(TABLE_TESTRESULT)->where('`case`')->in($caseIdList)->groupBy('`case`')->fetchPairs('case', 'count');
|
||||
$caseFailCount = $this->dao->select('`case` AS name, COUNT(*) AS value')->from(TABLE_TESTRESULT)->where('caseResult')->eq('fail')->andwhere('`case`')->in($caseIdList)->groupBy('name')->orderBy('value DESC')->fetchAll('name');
|
||||
$stepNumber = $this->dao->select('count(distinct t1.id) as count, t1.`case`')->from(TABLE_CASESTEP)->alias('t1')
|
||||
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.`case`=t2.`id`')
|
||||
->where('t1.`case`')->in($caseIdList)
|
||||
@@ -1285,9 +1286,10 @@ class testcaseModel extends model
|
||||
foreach($cases as $case)
|
||||
{
|
||||
$caseID = $type == 'case' ? $case->id : $case->case;
|
||||
$case->bugs = isset($caseBugs[$caseID]) ? $caseBugs[$caseID] : 0;
|
||||
$case->results = isset($results[$caseID]) ? $results[$caseID] : 0;
|
||||
$case->stepNumber = isset($stepNumber[$caseID]) ? $stepNumber[$caseID] : 0;
|
||||
$case->bugs = isset($caseBugs[$caseID]) ? $caseBugs[$caseID] : 0;
|
||||
$case->results = isset($results[$caseID]) ? $results[$caseID] : 0;
|
||||
$case->caseFailCount = isset($results[$caseID]) ? $caseFailCount[$caseID]->value : 0;
|
||||
$case->stepNumber = isset($stepNumber[$caseID]) ? $stepNumber[$caseID] : 0;
|
||||
}
|
||||
|
||||
return $cases;
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
echo html::a("javascript:ajaxDelete(\"$deleteURL\",\"caseList\",confirmDelete)", '<i class="icon-remove"></i>', '', "title='{$lang->testcase->delete}' class='btn-icon'");
|
||||
}
|
||||
|
||||
common::printIcon('testcase', 'createBug', "product=$case->product&branch=$case->branch&extra=caseID=$case->id,version=$case->version,runID=", $case, 'list', 'bug', '', 'iframe');
|
||||
common::printIcon('testcase', 'createBug', "product=$case->product&branch=$case->branch&extra=caseID=$case->id,version=$case->version,runID=", $case, 'list', 'bug', '', 'iframe',false,"data-width='95%'");
|
||||
?>
|
||||
</td>
|
||||
<?php endif;?>
|
||||
|
||||
@@ -11,38 +11,33 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.lite.html.php';?>
|
||||
<form action='<?php echo $this->createLink('bug', 'create', "product=$productID&branch=$branch&extras=$extras")?>' target='_parent' method='post'>
|
||||
<table class='table table-condensed table-hover table-striped tablesorter table-selectable' style='word-break:break-all'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='w-60px'><?php echo $lang->testcase->stepID;?></th>
|
||||
<th class='w-p30'><?php echo $lang->testcase->stepDesc;?></th>
|
||||
<th class='w-p30'><?php echo $lang->testcase->stepExpect;?></th>
|
||||
<th><?php echo $lang->testcase->result;?></th>
|
||||
<th class='w-p20'><?php echo $lang->testcase->real;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $i = 1;?>
|
||||
<?php foreach($result->stepResults as $stepID => $stepResult):?>
|
||||
<tr>
|
||||
<td class='cell-id'>
|
||||
<input type='checkbox' name='stepIDList[]' value='<?php echo $stepID;?>'/>
|
||||
<?php echo $i?>
|
||||
</td>
|
||||
<td><?php echo $stepResult['desc']?></td>
|
||||
<td><?php echo $stepResult['expect']?></td>
|
||||
<td class='<?php echo zget($stepResult, 'result', '');?> text-center'><?php echo zget($lang->testcase->resultList, zget($stepResult, 'result'), '');?></td>
|
||||
<td><?php echo zget($stepResult, 'real', '');?></td>
|
||||
</tr>
|
||||
<?php $i++;?>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan='5' class='pd-0'><div class='table-actions clearfix'><?php echo html::selectButton() . html::submitButton();?></div></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<form action='<?php echo $this->createLink('bug', 'create', "product=$case->product&branch=$case->branch&extras=caseID=$case->id,version=$case->version,runID=")?>' target='_parent' method='post'>
|
||||
<div class='main' id='resultsContainer'>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
$(function()
|
||||
{
|
||||
$('#resultsContainer').load("<?php echo $this->createLink('testtask', 'results', "runID={$runID}&caseID=$caseID&version=$version");?> #casesResults", function()
|
||||
{
|
||||
$('.result-item').click(function()
|
||||
{
|
||||
var $this = $(this);
|
||||
$this.toggleClass('show-detail');
|
||||
var show = $this.hasClass('show-detail');
|
||||
$this.next('.result-detail').toggleClass('hide', !show);
|
||||
$this.find('.collapse-handle').toggleClass('icon-chevron-down', !show).toggleClass('icon-chevron-up', show);;
|
||||
});
|
||||
|
||||
$('#casesResults table caption .result-tip').html($('#resultTip').html());
|
||||
|
||||
$('tr').remove('#result-success');
|
||||
});
|
||||
});
|
||||
<?php
|
||||
$sessionString = $config->requestType == 'PATH_INFO' ? '?' : '&';
|
||||
$sessionString .= session_name() . '=' . session_id();
|
||||
?>
|
||||
var sessionString = '<?php echo $sessionString;?>';
|
||||
</script>
|
||||
<?php include '../../common/view/footer.lite.html.php';?>
|
||||
|
||||
@@ -47,7 +47,8 @@
|
||||
{
|
||||
common::printIcon('testtask', 'runCase', "runID=$runID&caseID=$case->id&version=$case->currentVersion", '', 'button', '', '', 'runCase', false, "data-width='95%'");
|
||||
common::printIcon('testtask', 'results', "runID=$runID&caseID=$case->id&version=$case->version", '', 'button', '', '', 'results', false, "data-width='95%'");
|
||||
common::printIcon('testcase', 'createBug', "product=$case->product&branch=$case->branch&extra=caseID=$case->id,version=$case->version,runID=$runID", $case, 'button', 'bug', '', 'iframe');
|
||||
|
||||
if($caseFailCount > 0) common::printIcon('testcase', 'createBug', "product=$case->product&branch=$case->branch&extra=caseID=$case->id,version=$case->version,runID=$runID", '', 'button', 'bug', '', 'iframe');
|
||||
}
|
||||
if($config->testcase->needReview) common::printIcon('testcase', 'review', "caseID=$case->id", $case, 'button', 'review', '', 'iframe');
|
||||
echo '</div>';
|
||||
|
||||
+30
-13
@@ -723,22 +723,39 @@ class testtask extends control
|
||||
$preAndNext = $this->loadModel('common')->getPreAndNextObject('testcase', $caseID);
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$this->testtask->createResult($runID);
|
||||
$caseResult = $this->testtask->createResult($runID);
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
|
||||
/* set cookie for ajax load caselist when close colorbox. */
|
||||
setcookie('selfClose', 1);
|
||||
if('pass' == $caseResult)
|
||||
{
|
||||
/* set cookie for ajax load caselist when close colorbox. */
|
||||
setcookie('selfClose', 1);
|
||||
|
||||
if($preAndNext->next)
|
||||
{
|
||||
$nextRunID = $runID ? $preAndNext->next->id : 0;
|
||||
$nextCaseID = $runID ? $preAndNext->next->case : $preAndNext->next->id;
|
||||
$nextVersion = $preAndNext->next->version;
|
||||
|
||||
if($preAndNext->next)
|
||||
{
|
||||
$nextRunID = $runID ? $preAndNext->next->id : 0;
|
||||
$nextCaseID = $runID ? $preAndNext->next->case : $preAndNext->next->id;
|
||||
$nextVersion = $preAndNext->next->version;
|
||||
die(js::locate(inlink('runCase', "runID=$nextRunID&caseID=$nextCaseID&version=$nextVersion")));
|
||||
}
|
||||
else
|
||||
{
|
||||
die(js::closeModal('parent'));
|
||||
$response['result'] = 'success';
|
||||
$response['next'] = 'success';
|
||||
$response['locate'] = inlink('runCase', "runID=$nextRunID&caseID=$nextCaseID&version=$nextVersion");
|
||||
die($this->send($response));
|
||||
|
||||
die(js::locate(inlink('runCase', "runID=$nextRunID&caseID=$nextCaseID&version=$nextVersion")));
|
||||
}
|
||||
else
|
||||
{
|
||||
$response['result'] = 'success';
|
||||
$response['locate'] = 'reload';
|
||||
$response['target'] = 'parent';
|
||||
die($this->send($response));
|
||||
}
|
||||
} else if('fail' == $caseResult) {
|
||||
|
||||
$response['result'] = 'success';
|
||||
$response['locate'] = $this->createLink('testtask', 'results',"runID=$runID&caseID=$caseID&version=$version");
|
||||
die($this->send($response));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,3 +42,46 @@ function loadFilesName()
|
||||
if(fileName) $('#filesName').append("<li>" + fileName + '</li>');//Show file name.
|
||||
})
|
||||
}
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
/* First unbind ajaxForm for form.*/
|
||||
$("form[data-type='ajax']").unbind('submit');
|
||||
setForm();
|
||||
|
||||
/* Bind ajaxForm for form again. */
|
||||
$.ajaxForm("form[data-type='ajax']", function(response)
|
||||
{
|
||||
console.info(response);
|
||||
if(response.locate)
|
||||
{
|
||||
if(response.locate == 'reload' && response.target == 'parent')
|
||||
{
|
||||
parent.$.cookie('selfClose', 1);
|
||||
parent.$.closeModal(null, 'this');
|
||||
} else if(response.next) {
|
||||
location.href = response.locate;
|
||||
} else {
|
||||
$('#resultsContainer').load(response.locate + " #casesResults", function()
|
||||
{
|
||||
$('#tr-detail_1').show();
|
||||
$('.result-item').click(function()
|
||||
{
|
||||
var $this = $(this);
|
||||
$this.toggleClass('show-detail');
|
||||
var show = $this.hasClass('show-detail');
|
||||
$this.next('.result-detail').toggleClass('hide', !show);
|
||||
$this.find('.collapse-handle').toggleClass('icon-chevron-down', !show).toggleClass('icon-chevron-up', show);
|
||||
});
|
||||
|
||||
$('#casesResults table caption .result-tip').html($('#resultTip').html());
|
||||
|
||||
$("#submit").text('保存');
|
||||
$("#submit").attr({"disabled":"disabled"});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
<td title="<?php echo $task->projectName . '/' . $task->buildName?>">
|
||||
<?php
|
||||
echo $task->projectName . '/';
|
||||
//echo html::a($this->createLink('project', 'story', "projectID=$task->project"), $task->projectName) . '/';
|
||||
$task->build == 'trunk' ? print($lang->trunk) : print(html::a($this->createLink('build', 'view', "buildID=$task->build"), $task->buildName));;
|
||||
?>
|
||||
</td>
|
||||
|
||||
@@ -31,14 +31,14 @@
|
||||
<caption class='text-left'>
|
||||
<strong><?php echo $lang->testcase->result?> <span> <?php printf($lang->testtask->showResult, $count)?></span> <span class='result-tip'></span></strong>
|
||||
</caption>
|
||||
<?php $failCount = 0; ?>
|
||||
<?php $failCount = 0; $trCount=1?>
|
||||
<?php foreach($results as $result):?>
|
||||
<?php
|
||||
$class = ($result->caseResult == 'pass' ? 'success' : ($result->caseResult == 'fail' ? 'danger' : ($result->caseResult == 'blocked' ? 'warning' : '')));
|
||||
if($class != 'success') $failCount++;
|
||||
$fileCount = '(' . count($result->files) . ')';
|
||||
?>
|
||||
<tr class='result-item' style='cursor: pointer'>
|
||||
<tr class='result-item' id='result-<?php echo $class?>' style='cursor: pointer'>
|
||||
<td class='w-120px'> #<?php echo $result->id?></td>
|
||||
<td class='w-180px'><?php echo $result->date;?></td>
|
||||
<td><?php echo $users[$result->lastRunner] . ' ' . $lang->testtask->runCase;?></td>
|
||||
@@ -47,15 +47,16 @@
|
||||
<td class='w-60px'><?php if(!empty($result->files)) echo html::a("#caseResult{$result->id}", $lang->files . $fileCount, '', "data-toggle='modal' data-type='iframe'")?></td>
|
||||
<td class='w-50px text-center'><i class='collapse-handle icon-chevron-down text-muted'></i></td>
|
||||
</tr>
|
||||
<tr class='result-detail hide'>
|
||||
<tr class='result-detail hide' id='tr-detail_<?php echo $trCount++; ?>'>
|
||||
<td colspan='7' class='pd-0'>
|
||||
<form action='<?php echo $this->createLink('bug', 'create', "product=$case->product&branch=$case->branch&extras=caseID=$case->id,version=$case->version,runID=")?>' target='_parent' method='post'>
|
||||
<table class='table table-condensed borderless mg-0 resultSteps'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='w-40px'><?php echo $lang->testcase->stepID;?></th>
|
||||
<th class='w-p30 text-left'><?php echo $lang->testcase->stepDesc;?></th>
|
||||
<th class='w-p25 text-left'><?php echo $lang->testcase->stepExpect;?></th>
|
||||
<th class='w-p10 text-left'><?php echo $lang->testcase->stepVersion;?></th>
|
||||
<th class='w-p5 text-left'><?php echo $lang->testcase->stepVersion;?></th>
|
||||
<th class='text-center'><?php echo $lang->testcase->result;?></th>
|
||||
<th class='w-p20 text-left'><?php echo $lang->testcase->real;?></th>
|
||||
<th class='w-80px'></th>
|
||||
@@ -79,7 +80,12 @@
|
||||
$fileCount = '(' . count($stepResult['files']) . ')';
|
||||
?>
|
||||
<tr class='step <?php echo $stepClass?>'>
|
||||
<td class='step-id'><?php echo $stepId;?></td>
|
||||
<td class='step-id'>
|
||||
<?php if($result->caseResult == 'fail'):?>
|
||||
<input type='checkbox' name='stepIDList[]' value='<?php echo $key;?>'/>
|
||||
<?php endif;?>
|
||||
<?php echo $stepId;?>
|
||||
</td>
|
||||
<td class='text-left' <?php if($stepResult['type'] == 'group') echo "colspan='6'"?>>
|
||||
<div class='input-group'>
|
||||
<?php if($stepResult['type'] == 'item' and $stepResult['parent'] != 0) echo "<span class='step-item-id'>{$stepId}.{$childId}</span>";?>
|
||||
@@ -99,7 +105,15 @@
|
||||
<?php endif; endif; $childId++;?>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<?php if($result->caseResult == 'fail'):?>
|
||||
<tr><td></td><td></td><td></td><td></td><td></td><td></td>
|
||||
<td>
|
||||
<?php echo html::submitButton($lang->testcase->createBug);?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.lite.html.php';?>
|
||||
<?php include '../../common/view/form.html.php';?>
|
||||
<div id='titlebar'>
|
||||
<div class='heading'>
|
||||
<span class='prefix'><?php echo html::icon($lang->icons['usecase']);?> <strong><?php echo $run->case->id;?></strong></span>
|
||||
@@ -19,7 +20,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class='main'>
|
||||
<form class='form-condensed' method='post' enctype='multipart/form-data'>
|
||||
<form class='form-condensed' method='post' enctype='multipart/form-data' id='dataform' data-type='ajax'>
|
||||
<table class='table table-bordered table-form' style='word-break:break-all' id='steps'>
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user