// TC2 - Version 1 NOT ASSIGNED TO TEST PLAN is displayed // 9. Use feature edits test cases, to create a new version for TC1 -> Version 2 - exec type AUTO // 10. Use feature ADD/REMOVE test cases from test plan. // 11. Apply filter on exec type AUTO // 12. Tree will display (Folder) Test Suite A with 2 elements // 13. click on folder, then on RIGHT pane: // TC2 - Version 1 NOT ASSIGNED TO TEST PLAN is displayed // TC1 - Version 2 NOT ASSIGNED TO TEST PLAN is displayed ----> THIS IS RIGHT but WRONG // Only one TC version can be linked to test plan, and TC1 already is LINKED BUT with VERSION 1. // Version 2 is displayed because it has EXEC TYPE AUTO // // How to solve ? // Filters regarding this kind of attributes WILL BE NOT APPLIEDED to get linked items // In this way counters on Test Spec Tree and amount of TC displayed on right pane will be coherent. // $tplan_linked_tcversions = getFilteredLinkedVersions($args, $tplan_mgr, $tcase_mgr); // BUGID 3889: Add Test Cases to Test plan - Right pane does not honor custom field filter $testCaseSet = $args->control_panel['filter_tc_id']; if (!is_null($keywordsFilter)) { // With this pieces we implement the AND type of keyword filter. $keywordsTestCases = $tproject_mgr->get_keywords_tcases($args->tproject_id, $keywordsFilter->items, $keywordsFilter->type); if (sizeof($keywordsTestCases)) { $testCaseSet = array_keys($keywordsTestCases); } } // Choose enable/disable display of custom fields, analysing if this kind of custom fields // exists on this test project. $cfields = $tsuite_mgr->cfield_mgr->get_linked_cfields_at_testplan_design($args->tproject_id, 1, 'testcase'); $opt = array('write_button_only_if_linked' => 0, 'add_custom_fields' => 0); $opt['add_custom_fields'] = count($cfields) > 0 ? 1 : 0; // 20101025 - BUGID 3889: Add Test Cases to Test plan - Right pane does not honor custom field filter
/** * * @internal revisions: * 20100721 - asimon - BUGID 3406 - added $options for new user assignments per build * 20100218 - asimon - BUGID 3026 - added parameter $testcaseFilter to include functionality * previously used on tc_exec_assignment.php * to show only testcases present in filter argument * */ function keywordFilteredSpecView(&$dbHandler, &$argsObj, $keywordsFilter, &$tplanMgr, &$tcaseMgr, $testcaseFilter = null, $options = null) { $tsuiteMgr = new testsuite($dbHandler); $tprojectMgr = new testproject($dbHandler); $tsuite_data = $tsuiteMgr->get_by_id($argsObj->id); $filterAssignedTo = property_exists($argsObj, 'filter_assigned_to') ? $argsObj->filter_assigned_to : null; // 3406 // $ua_build = !is_null($options) && isset($options['user_assignments_per_build']) ? // $options['user_assignments_per_build'] : null; // @TODO - 20081019 // Really understand differences between: // $argsObj->keyword_id and $keywordsFilter // BUGID 1041 $filters = array('keyword_id' => $argsObj->keyword_id, 'assigned_to' => $filterAssignedTo); // 20100715 - asimon - why the double writing to $tplan_linked_tcversions? // will be overwritten again two lines below // $tplan_linked_tcversions = $tplanMgr->get_linked_tcversions($argsObj->tplan_id, $filters, $options); // This does filter on keywords ALWAYS in OR mode. // 3406: added $options $tplan_linked_tcversions = getFilteredLinkedVersions($argsObj, $tplanMgr, $tcaseMgr, $options); // With this pieces we implement the AND type of keyword filter. $testCaseSet = null; if (!is_null($keywordsFilter) && !is_null($keywordsFilter->items)) { $keywordsTestCases = $tprojectMgr->get_keywords_tcases($argsObj->tproject_id, $keywordsFilter->items, $keywordsFilter->type); $testCaseSet = array_keys($keywordsTestCases); } // BUGID 3026 - added $testcaseFilter if (!is_null($testCaseSet) && !is_null($testcaseFilter)) { $testCaseSet = array_intersect($testCaseSet, array($testcaseFilter)); } else { if (is_null($testCaseSet) && !is_null($testcaseFilter)) { $testCaseSet = $testcaseFilter; } } // now get values as keys // 20100722 - asimon - additional check here because of warning from array_combine when $testCaseSet is null //$testCaseSet = array_combine($testCaseSet, $testCaseSet); $testCaseSet = !is_null($testCaseSet) ? array_combine($testCaseSet, $testCaseSet) : null; // function gen_spec_view(&$db,$spec_view_type='testproject',$tobj_id,$id,$name,&$linked_items, // $map_node_tccount,$filters=null, $options = null,$tproject_id = null) // // 3406 $options = array('write_button_only_if_linked' => 1, 'prune_unlinked_tcversions' => 1) + (array) $options; $filters = array('keywords' => $argsObj->keyword_id, 'testcases' => $testCaseSet); $out = gen_spec_view($dbHandler, 'testplan', $argsObj->tplan_id, $argsObj->id, $tsuite_data['name'], $tplan_linked_tcversions, null, $filters, $options); return $out; }
doSavePlatforms($args, $tplan_mgr); $do_display = 1; break; case 'doSaveCustomFields': doSaveCustomFields($args, $_REQUEST, $tplan_mgr, $tcase_mgr); $do_display = 1; break; default: break; } $smarty = new TLSmarty(); // echo __LINE__ . __FILE__; die(); if ($do_display) { $tsuite_data = $tsuite_mgr->get_by_id($args->object_id); // see development documentation on [INSTALL DIR]/docs/development/planAddTC.php.txt $tplan_linked_tcversions = getFilteredLinkedVersions($db, $args, $tplan_mgr, $tcase_mgr, array('addImportance' => true)); // Add Test Cases to Test plan - Right pane does not honor custom field filter $testCaseSet = $args->control_panel['filter_tc_id']; if (!is_null($keywordsFilter)) { // With this pieces we implement the AND type of keyword filter. $keywordsTestCases = $tproject_mgr->get_keywords_tcases($args->tproject_id, $keywordsFilter->items, $keywordsFilter->type); if (sizeof($keywordsTestCases)) { $testCaseSet = array_keys($keywordsTestCases); } } // Choose enable/disable display of custom fields, analysing if this kind of custom fields // exists on this test project. $cfields = $tsuite_mgr->cfield_mgr->get_linked_cfields_at_testplan_design($args->tproject_id, 1, 'testcase'); $opt = array('write_button_only_if_linked' => 0, 'add_custom_fields' => 0); $opt['add_custom_fields'] = count($cfields) > 0 ? 1 : 0; // Add Test Cases to Test plan - Right pane does not honor custom field filter
/** * */ function getFilteredSpecViewFlat(&$dbHandler, &$argsObj, &$tplanMgr, &$tcaseMgr, $filters = null, $options = null) { $tprojectMgr = new testproject($dbHandler); $tsuite_data = $tcaseMgr->tree_manager->get_node_hierarchy_info($argsObj->id); $my = array(); // some sort of local scope $my['filters'] = array('keywordsFilter' => null, 'testcaseFilter' => null, 'assignedToFilter' => null, 'executionTypeFilter' => null); $my['filters'] = array_merge($my['filters'], (array) $filters); $my['options'] = array('write_button_only_if_linked' => 1, 'prune_unlinked_tcversions' => 1); $my['options'] = array_merge($my['options'], (array) $options); // This does filter on keywords ALWAYS in OR mode. $tplan_linked_tcversions = getFilteredLinkedVersions($dbHandler, $argsObj, $tplanMgr, $tcaseMgr, $options); // With these pieces we implement the AND type of keyword filter. $testCaseSet = null; $tryNextFilter = true; $filterApplied = false; if (!is_null($my['filters']['keywordsFilter']) && !is_null($my['filters']['keywordsFilter']->items)) { $keywordsTestCases = $tprojectMgr->get_keywords_tcases($argsObj->tproject_id, $my['filters']['keywordsFilter']->items, $my['filters']['keywordsFilter']->type); $testCaseSet = array_keys((array) $keywordsTestCases); $tryNextFilter = !is_null($testCaseSet); $filterApplied = true; } if ($tryNextFilter && !is_null($my['filters']['testcaseFilter'])) { $filterApplied = true; if (is_null($testCaseSet)) { $testCaseSet = $my['filters']['testcaseFilter']; } else { // wrong use of array() instead of (array) $testCaseSet = array_intersect($testCaseSet, (array) $my['filters']['testcaseFilter']); } } // when $testCaseSet is null because we have applied filters => we do not need to call other // method because we know we are going to get NOTHING $testCaseSet = !is_null($testCaseSet) ? array_combine($testCaseSet, $testCaseSet) : null; if ($filterApplied && is_null($testCaseSet)) { return null; } $genSpecFilters = array('keywords' => $argsObj->keyword_id, 'testcases' => $testCaseSet, 'exec_type' => $my['filters']['executionTypeFilter'], 'cfields' => null); if (isset($my['filters']['cfieldsFilter'])) { $genSpecFilters['cfields'] = $my['filters']['cfieldsFilter']; } $out = genSpecViewFlat($dbHandler, 'testplan', $argsObj->tplan_id, $argsObj->id, $tsuite_data['name'], $tplan_linked_tcversions, null, $genSpecFilters, $my['options']); return $out; }
/** * * @param obj $dbHandler * @param obj $argsObj: user input * @param obj $argsObj: user input * @param obj $tplanMgr: test plan manager * @param obj $tcaseMgr: test case manager * @param map $filters: keys keywordsFilter, testcaseFilter,assignedToFilter, * executionTypeFilter, cfieldsFilter * * IMPORTANT NOTICE: not all filters are here, other arrive via argsObj * @param map $options: keys ?? * USED TO PASS options to other method called here -> see these method docs. * * @internal revisions: * * 20101024 - franciscom - name changed because was misleading, this do lot of filters * interface changed. * * 20100721 - asimon - BUGID 3406 - added $options for new user assignments per build * 20100218 - asimon - BUGID 3026 - added parameter $testcaseFilter to include functionality * previously used on tc_exec_assignment.php * to show only testcases present in filter argument * */ function getFilteredSpecView(&$dbHandler, &$argsObj, &$tplanMgr, &$tcaseMgr, $filters = null, $options = null) { $tprojectMgr = new testproject($dbHandler); $tsuite_data = $tcaseMgr->tree_manager->get_node_hierarchy_info($argsObj->id); $my = array(); // some sort of local scope $my['filters'] = array('keywordsFilter' => null, 'testcaseFilter' => null, 'assignedToFilter' => null, 'executionTypeFilter' => null); $my['filters'] = array_merge($my['filters'], (array) $filters); $my['options'] = array('write_button_only_if_linked' => 1, 'prune_unlinked_tcversions' => 1); $my['options'] = array_merge($my['options'], (array) $options); // This does filter on keywords ALWAYS in OR mode. // BUGID 3406: added $options $tplan_linked_tcversions = getFilteredLinkedVersions($argsObj, $tplanMgr, $tcaseMgr, $options); // With these pieces we implement the AND type of keyword filter. $testCaseSet = null; if (!is_null($my['filters']['keywordsFilter']) && !is_null($my['filters']['keywordsFilter']->items)) { $keywordsTestCases = $tprojectMgr->get_keywords_tcases($argsObj->tproject_id, $my['filters']['keywordsFilter']->items, $my['filters']['keywordsFilter']->type); $testCaseSet = array_keys($keywordsTestCases); } // BUGID 3026 - added $testcaseFilter if (!is_null($my['filters']['testcaseFilter'])) { if (is_null($testCaseSet)) { $testCaseSet = $my['filters']['testcaseFilter']; } else { $testCaseSet = array_intersect($testCaseSet, array($my['filters']['testcaseFilter'])); } } // now get values as keys // 20100722 - asimon - additional check here because of warning from array_combine when $testCaseSet is null $testCaseSet = !is_null($testCaseSet) ? array_combine($testCaseSet, $testCaseSet) : null; // BUGID 3406 // BUGID 3936: Assign Test Case Execution - Right pane does not reflect custom field filter. $genSpecFilters = array('keywords' => $argsObj->keyword_id, 'testcases' => $testCaseSet, 'exec_type' => $my['filters']['executionTypeFilter'], 'cfields' => $my['filters']['cfieldsFilter']); $out = gen_spec_view($dbHandler, 'testplan', $argsObj->tplan_id, $argsObj->id, $tsuite_data['name'], $tplan_linked_tcversions, null, $genSpecFilters, $my['options']); return $out; }