Skip to content

Commit 2d80048

Browse files
committed
The following adjustments were made:
- FIX Undefined array key "addReporter" - in \lib\issuetrackerintegration\issueTrackerInterface.class.php - Line 382 - FIX Undefined array key "addHandler" - in \lib\issuetrackerintegration\issueTrackerInterface.class.php - Line 398 - FIX Undefined array key "platforms" - in \lib\functions\specview.php - Line 854 - FIX Trying to access array offset on value of type null - in \lib\functions\specview.php - Line 1232 - FIX Trying to access array offset on value of type null - in \lib\functions\specview.php - Line 1825 - FIX Undefined array key "bulk_tester_div" - in \lib\plan\tc_exec_assignment.php - Line 287 - FIX preg_match(): Compilation failed: missing terminating ] for character class at offset 33 - in \lib\results\tcCreatedPerUserOnTestProject.php - Line 455 - FIX Undefined property: stdClass::$row_qty - in \lib\requirements\reqSpecSearch.php - Line 138 - FIX Undefined array key "actions" - in \lib\functions\testcase.class.php - Line 8339 - FIX Undefined array key "actions" - in \lib\functions\testcase.class.php - Line 8340 - FIX Undefined array key "expected_results" - in \lib\functions\testcase.class.php - Line 8339 - FIX Undefined array key "expected_results" - in \lib\functions\testcase.class.php - Line 8340 - FIX Undefined property: stdClass::$createissueviaapi - in \lib\execute\execSetResults.php - Line 1667 - FIX Trying to access array offset on value of type bool - in \lib\requirements\reqSpecCommands.class.php - Line 212 - FIX Undefined array key 1 - in \lib\functions\testcase.class.php - Line 5665 - FIX Undefined array key 0 - in \lib\functions\testcase.class.php - Line 5667
1 parent 70bea2c commit 2d80048

7 files changed

Lines changed: 193 additions & 143 deletions

File tree

lib/execute/execSetResults.php

Lines changed: 52 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@
4747

4848
$tcversion_id = null;
4949
$submitResult = null;
50-
[$args, $its, $cts] = initArgs($db, $cfg);
50+
[
51+
$args,
52+
$its,
53+
$cts
54+
] = initArgs($db, $cfg);
5155

5256
// the default -1 create an out of range error on TC execution without platform
5357
if ($args->platform_id == - 1) {
@@ -95,8 +99,10 @@
9599
}
96100

97101
// LOAD What To Display
98-
[$linked_tcversions, $itemSet] = getLinkedItems($args, $gui->history_on,
99-
$cfg, $tcaseMgr, $tplan_mgr);
102+
[
103+
$linked_tcversions,
104+
$itemSet
105+
] = getLinkedItems($args, $gui->history_on, $cfg, $tcaseMgr, $tplan_mgr);
100106

101107
$tcase_id = 0;
102108
$userid_array = null;
@@ -108,9 +114,13 @@
108114
// passed by reference to be updated inside function
109115
// $gui, $args
110116
$tcase = null;
111-
[$tcase_id, $tcversion_id, $latestExecIDInContext, $hasCFOnExec] = processTestCase(
112-
$tcase, $gui, $args, $cfg, $linked_tcversions, $tree_mgr, $tcaseMgr,
113-
$fileRepo);
117+
[
118+
$tcase_id,
119+
$tcversion_id,
120+
$latestExecIDInContext,
121+
$hasCFOnExec
122+
] = processTestCase($tcase, $gui, $args, $cfg, $linked_tcversions,
123+
$tree_mgr, $tcaseMgr, $fileRepo);
114124
} else {
115125
processTestSuite($db, $gui, $args, $itemSet, $tree_mgr, $tcaseMgr,
116126
$fileRepo);
@@ -169,8 +179,11 @@
169179
array_keys($_REQUEST['step_notes']), $ctx);
170180
}
171181

172-
[$execSet, $gui->addIssueOp, $gui->uploadOp] = write_execution(
173-
$db, $args, $_REQUEST, $its);
182+
[
183+
$execSet,
184+
$gui->addIssueOp,
185+
$gui->uploadOp
186+
] = write_execution($db, $args, $_REQUEST, $its);
174187

175188
// Copy Attachments from latest exec ?
176189
// we have got Latest Execution on Context on processTestCase()
@@ -352,8 +365,11 @@
352365
'id' => $nextItem['tcase_id'],
353366
'version_id' => $nextItem['tcversion_id']
354367
];
355-
[$lt, $xdm] = getLinkedItems($args, $gui->history_on, $cfg,
356-
$tcaseMgr, $tplan_mgr, $identity);
368+
[
369+
$lt,
370+
$xdm
371+
] = getLinkedItems($args, $gui->history_on, $cfg, $tcaseMgr,
372+
$tplan_mgr, $identity);
357373
processTestCase($nextItem, $gui, $args, $cfg, $lt, $tree_mgr,
358374
$tcaseMgr, $fileRepo);
359375
}
@@ -552,9 +568,13 @@
552568
if (! $gui->can_use_bulk_op &&
553569
$cfg->exec_cfg->exec_mode->new_exec == 'latest') {
554570

555-
[$tcase_id, $tcversion_id, $latestExecIDInContext, $hasCFOnExec] = processTestCase(
556-
$tcase, $gui, $args, $cfg, $linked_tcversions, $tree_mgr, $tcaseMgr,
557-
$fileRepo);
571+
[
572+
$tcase_id,
573+
$tcversion_id,
574+
$latestExecIDInContext,
575+
$hasCFOnExec
576+
] = processTestCase($tcase, $gui, $args, $cfg, $linked_tcversions,
577+
$tree_mgr, $tcaseMgr, $fileRepo);
558578

559579
if ($latestExecIDInContext > 0) {
560580
$tbl = DB_TABLE_PREFIX . 'executions';
@@ -705,10 +725,9 @@ function initArgs(&$dbHandler, $cfgObj)
705725
// THIS COLLECT ONLY FIRST LEVEL UNDER test suite, do not do deep search
706726
// Need to understand is still needed
707727
$tsuite_mgr = new testsuite($dbHandler);
708-
$xx = $tsuite_mgr->get_children($args->tsuite_id,
709-
[
710-
'details' => 'id'
711-
]);
728+
$xx = $tsuite_mgr->get_children($args->tsuite_id, [
729+
'details' => 'id'
730+
]);
712731
$ldx = count($xx);
713732
$xx[$ldx] = $args->tsuite_id;
714733
$args->tsuitesInBranch = $xx;
@@ -1506,8 +1525,8 @@ function initializeGui(&$dbHandler, &$argsObj, &$cfgObj, &$tplanMgr, &$tcaseMgr,
15061525

15071526
$gui->issueSummaryForStep = null;
15081527
$gui->addIssueOp = null;
1509-
$gui->allowStepAttachments = true;
1510-
$gui->remoteExecFeedback = '';
1528+
$gui->allowStepAttachments = true;
1529+
$gui->remoteExecFeedback = '';
15111530
$gui->user_feedback = '';
15121531
$gui->tplan_id = $argsObj->tplan_id;
15131532
$gui->tproject_id = $argsObj->tproject_id;
@@ -1520,8 +1539,10 @@ function initializeGui(&$dbHandler, &$argsObj, &$cfgObj, &$tplanMgr, &$tcaseMgr,
15201539
$gui->execStatusIcons = getResultsIcons();
15211540
$gui->execStatusIconsNext = getResultsIconsNext();
15221541

1523-
[$gui->execStatusValues, $gui->execStepStatusValues] = initExecValuesMenus(
1524-
$cfgObj->tc_status, $cfgObj->execStatusToExclude);
1542+
[
1543+
$gui->execStatusValues,
1544+
$gui->execStepStatusValues
1545+
] = initExecValuesMenus($cfgObj->tc_status, $cfgObj->execStatusToExclude);
15251546

15261547
$gui->can_use_bulk_op = 0;
15271548
$gui->exec_notes_editors = null;
@@ -1663,8 +1684,8 @@ function initializeGui(&$dbHandler, &$argsObj, &$cfgObj, &$tplanMgr, &$tcaseMgr,
16631684
$gui->issueTrackerCfg->bugSummaryMaxLength = $issueTracker->getBugSummaryMaxLength();
16641685
$gui->issueTrackerCfg->editIssueAttr = (intval(
16651686
$itsCfg->userinteraction) > 0);
1666-
$gui->issueTrackerCfg->crudIssueViaAPI = (intval(
1667-
$itsCfg->createissueviaapi) > 0) ?? false;
1687+
$gui->issueTrackerCfg->crudIssueViaAPI = ! empty(
1688+
$itsCfg->createissueviaapi) ? intval($itsCfg->createissueviaapi) : false;
16681689

16691690
$gui->issueTrackerIntegrationOn = true;
16701691
$gui->accessToIssueTracker = lang_get('link_bts_create_bug') .
@@ -1834,8 +1855,10 @@ function processTestCase($tcase, &$guiObj, &$argsObj, &$cfgObj, $tcv, &$treeMgr,
18341855
$signature->tcpathname = $tcaseMgr->getPathName($tcase_id);
18351856
$signature->tcversion_id = $tcversion_id;
18361857

1837-
[$guiObj->bug_summary, $guiObj->issueSummaryForStep] = genIssueSummary(
1838-
$tcaseMgr, $signature, $guiObj->executionContext);
1858+
[
1859+
$guiObj->bug_summary,
1860+
$guiObj->issueSummaryForStep
1861+
] = genIssueSummary($tcaseMgr, $signature, $guiObj->executionContext);
18391862

18401863
// return more data eid, has cf on exec
18411864
return [
@@ -2261,8 +2284,8 @@ function getLinkedItems($argsObj, $historyOn, $cfgObj, $tcaseMgr, $tplanMgr,
22612284
// before this refactoring
22622285
//
22632286
// $tex = $tcaseMgr->db->$kmethod($sql2run,'tcase_id',database::CUMULATIVE);
2264-
$sql2run .= ' ORDER BY exec_order ';
2265-
$ltcv = $tcaseMgr->db->$kmethod($sql2run, 'tcase_id');
2287+
$sql2run .= ' ORDER BY exec_order ';
2288+
$ltcv = $tcaseMgr->db->$kmethod($sql2run, 'tcase_id');
22662289
$tex = $ltcv;
22672290
if (! is_null($tex)) {
22682291
// We need to create:
@@ -2565,8 +2588,8 @@ function initExecValuesMenus($tcStatusCfg, $execStatusToExclude)
25652588
{
25662589
$remove = [
25672590
$tcStatusCfg['not_run']
2568-
];
2569-
$execStatusTestCase = createResultsMenu($remove);
2591+
];
2592+
$execStatusTestCase = createResultsMenu($remove);
25702593
$execStatusTestCaseStep = $execStatusTestCase;
25712594

25722595
foreach ($execStatusToExclude['testcase'] as $code) {

lib/functions/specview.php

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,12 @@ function gen_spec_view(&$db, $specViewType, $tobj_id, $id, $name, &$linked_items
224224
// key: test case version id
225225
// value: index inside $out, where parent test suite of test case version id is located.
226226
//
227-
[$a_tcid, $a_tsuite_idx, $tsuite_tcqty, $out] = buildSkeleton($id,
228-
$name, $cfg, $test_spec, $platforms);
227+
[
228+
$a_tcid,
229+
$a_tsuite_idx,
230+
$tsuite_tcqty,
231+
$out
232+
] = buildSkeleton($id, $name, $cfg, $test_spec, $platforms);
229233
}
230234

231235
// This code has been replace (see below on Remove empty branches)
@@ -397,8 +401,12 @@ function gen_coverage_view(&$db, $specViewType, $tobj_id, $id, $name,
397401
// key: test case version id
398402
// value: index inside $out, where parent test suite of test case version id is located.
399403
//
400-
[$a_tcid, $a_tsuite_idx, , $out] = buildSkeleton($id, $name, $cfg,
401-
$test_spec, $platforms);
404+
[
405+
$a_tcid,
406+
$a_tsuite_idx,
407+
,
408+
$out
409+
] = buildSkeleton($id, $name, $cfg, $test_spec, $platforms);
402410
}
403411

404412
// This code has been replace (see below on Remove empty branches)
@@ -660,7 +668,7 @@ function getFilteredSpecView(&$dbHandler, &$argsObj, &$tplanMgr, &$tcaseMgr,
660668
// applied filters => we do not need to call other
661669
// method because we know we are going to get NOTHING
662670
$testCaseSet = is_null($testCaseSet) ? null : array_combine($testCaseSet,
663-
$testCaseSet);
671+
$testCaseSet);
664672
if ($filterApplied && is_null($testCaseSet)) {
665673
return null;
666674
}
@@ -851,7 +859,7 @@ function getTestSpecFromNode(&$dbHandler, &$tcaseMgr, &$linkedItems,
851859
// case insensitive search
852860
if (($useFilter['keyword_id'] &&
853861
! isset($tck_map[$test_spec[$tspecKey]['id']])) ||
854-
($useFilter['platforms'] &&
862+
(! empty($useFilter['platforms']) &&
855863
! isset($tcpl_map[$test_spec[$tspecKey]['id']])) ||
856864
($useFilter['tcase_id'] &&
857865
! in_array($test_spec[$tspecKey]['id'], $testCaseSet)) ||
@@ -956,7 +964,7 @@ function getTestSpecFromNode(&$dbHandler, &$tcaseMgr, &$linkedItems,
956964
// $tcversionSet = $tcaseMgr->get_last_active_version()
957965
if ($useFilter['cfields']) {
958966
$filteredSet = (empty($allowedSet)) ? $tcvidSet : array_keys(
959-
$allowedSet);
967+
$allowedSet);
960968
$dummySet = $tcaseMgr->filter_tcversions_by_cfields(
961969
$filteredSet, $filters['cfields'], $options);
962970

@@ -1220,12 +1228,13 @@ function buildSkeleton($id, $name, $config, &$test_spec, &$platforms)
12201228
// |
12211229
// |__ TCZ1
12221230
//
1223-
if ($tcase_memory['parent_id'] != $current['parent_id']) {
1224-
if (! is_null($tcase_memory)) {
1231+
if (! empty($tcase_memory['parent_id'])) {
1232+
if ($tcase_memory['parent_id'] != $current['parent_id']) {
12251233
$pidx = $hash_id_pos[$tcase_memory['parent_id']];
12261234
$xdx = $out[$pidx]['testsuite']['id'];
12271235
$tsuite_tcqty[$xdx] = $out[$pidx]['testcase_qty'];
12281236
}
1237+
} else {
12291238
$tcase_memory = $current;
12301239
}
12311240
} else {
@@ -1518,7 +1527,7 @@ function getFilteredSpecViewFlat(&$dbHandler, &$argsObj, &$tplanMgr, &$tcaseMgr,
15181527
// => we do not need to call other
15191528
// method because we know we are going to get NOTHING
15201529
$testCaseSet = is_null($testCaseSet) ? null : array_combine($testCaseSet,
1521-
$testCaseSet);
1530+
$testCaseSet);
15221531
if ($filterApplied && is_null($testCaseSet)) {
15231532
return null;
15241533
}
@@ -1624,8 +1633,12 @@ function genSpecViewFlat(&$db, $specViewType, $tobj_id, $id, $name,
16241633
// key: test case version id
16251634
// value: index inside $out, where parent test suite of test case version id is located.
16261635
//
1627-
[$a_tcid, $a_tsuite_idx, , $out] = buildSkeletonFlat($id, $name,
1628-
$cfg, $test_spec, $platforms);
1636+
[
1637+
$a_tcid,
1638+
$a_tsuite_idx,
1639+
,
1640+
$out
1641+
] = buildSkeletonFlat($id, $name, $cfg, $test_spec, $platforms);
16291642
}
16301643

16311644
// Collect information related to linked testcase versions
@@ -1809,16 +1822,17 @@ function buildSkeletonFlat($branchRootID, $name, $config, &$test_spec,
18091822
// |__ TCZ1
18101823
//
18111824
//
1812-
if ($tcase_memory['parent_id'] != $current['parent_id']) {
1813-
if (! is_null($tcase_memory)) {
1825+
if (! empty($tcase_memory)) {
1826+
if ($tcase_memory['parent_id'] != $current['parent_id']) {
18141827
$pidx = $hash_id_pos[$tcase_memory['parent_id']];
18151828
$xdx = $out[$pidx]['testsuite']['id'];
18161829
$tsuite_tcqty[$xdx] = $out[$pidx]['testcase_qty'];
18171830
}
1831+
} else {
18181832
$tcase_memory = $current;
18191833
}
18201834
}
1821-
} // foreach
1835+
}
18221836

18231837
// Update after finished loop
18241838
if ($parent_idx >= 0) {

0 commit comments

Comments
 (0)