/** * * */ private function exportTestSuiteDataToXML($container, $tproject_id, $tplan_id, $platform_id) { static $keywordMgr; static $getLastVersionOpt = array('output' => 'minimun'); static $tcaseMgr; static $tsuiteMgr; static $tcaseExportOptions; static $linkedItems; if (is_null($keywordMgr)) { $tcaseExportOptions = array('CFIELDS' => true, 'KEYWORDS' => true, 'EXEC_ORDER' => 0); $keywordMgr = new tlKeyword(); $tsuiteMgr = new testsuite($this->db); $linkedItems = $this->getLinkedItems($tplan_id); } $xmlTC = null; $cfXML = null; $kwXML = null; if (isset($container['id'])) { $kwMap = $tsuiteMgr->getKeywords($container['id']); if ($kwMap) { $kwXML = "<keywords>" . $keywordMgr->toXMLString($kwMap, true) . "</keywords>"; } $cfMap = (array) $tsuiteMgr->get_linked_cfields_at_design($container['id'], null, null, $tproject_id); if (count($cfMap) > 0) { $cfXML = $this->cfield_mgr->exportValueAsXML($cfMap); } $tsuiteData = $tsuiteMgr->get_by_id($container['id']); $xmlTC = "\n\t<testsuite name=\"" . htmlspecialchars($tsuiteData['name']) . '" >' . "\n\t\t<node_order><![CDATA[{$tsuiteData['node_order']}]]></node_order>" . "\n\t\t<details><![CDATA[{$tsuiteData['details']}]]>" . "\n\t\t{$kwXML}{$cfXML}</details>"; } $childNodes = isset($container['childNodes']) ? $container['childNodes'] : null; if (!is_null($childNodes)) { $loop_qty = sizeof($childNodes); for ($idx = 0; $idx < $loop_qty; $idx++) { $cNode = $childNodes[$idx]; switch ($cNode['node_table']) { case 'testsuites': $xmlTC .= $this->exportTestSuiteDataToXML($cNode, $tproject_id, $tplan_id, $platform_id); break; case 'testcases': if (is_null($tcaseMgr)) { $tcaseMgr = new testcase($this->db); } // testcase::LATEST_VERSION, $tcaseExportOptions['EXEC_ORDER'] = $linkedItems[$cNode['id']][$platform_id]['node_order']; $xmlTC .= $tcaseMgr->exportTestCaseDataToXML($cNode['id'], $cNode['tcversion_id'], $tproject_id, testcase::NOXMLHEADER, $tcaseExportOptions); break; } } } if (isset($container['id'])) { $xmlTC .= "</testsuite>"; } return $xmlTC; }
/** * * */ function create(&$argsObj, &$otCfg) { $parentKeywords = array(); $guiObj = $this->initGuiBean($argsObj); $guiObj->initWebEditorFromTemplate = true; $guiObj->containerID = $argsObj->container_id; if ($argsObj->container_id > 0) { $pnode_info = $this->tcaseMgr->tree_manager->get_node_hierarchy_info($argsObj->container_id); $node_descr = array_flip($this->tcaseMgr->tree_manager->get_available_node_types()); $guiObj->parent_info['name'] = $pnode_info['name']; $guiObj->parent_info['description'] = lang_get($node_descr[$pnode_info['node_type_id']]); // get keywords $tsuiteMgr = new testsuite($this->db); $parentKeywords = $tsuiteMgr->getKeywords($argsObj->container_id); } $sep_1 = config_get('gui_title_separator_1'); $sep_2 = config_get('gui_title_separator_2'); $guiObj->main_descr = $guiObj->parent_info['description'] . $sep_1 . $guiObj->parent_info['name'] . $sep_2 . lang_get('title_new_tc'); $otCfg->to->map = array(); keywords_opt_transf_cfg($otCfg, implode(',', array_keys((array) $parentKeywords))); $guiObj->tc = array('id' => 0, 'name' => '', 'importance' => config_get('testcase_importance_default'), 'status' => null, 'estimated_exec_duration' => null, 'execution_type' => TESTCASE_EXECUTION_TYPE_MANUAL); $guiObj->opt_cfg = $otCfg; $templateCfg = templateConfiguration('tcNew'); $guiObj->template = $templateCfg->default_template; $cfPlaces = $this->tcaseMgr->buildCFLocationMap(); foreach ($cfPlaces as $locationKey => $locationFilter) { $guiObj->cf[$locationKey] = $this->tcaseMgr->html_table_of_custom_field_inputs(null, null, 'design', '', null, null, $argsObj->testproject_id, $locationFilter, $_REQUEST); } return $guiObj; }
echo "<pre> testsuite - get_testcases_deep(\$id,\$details='simple')"; echo "</pre>"; echo "<pre> get_testcases_deep({$tsuite_id},'simple')"; echo "</pre>"; $testcases_deep = $tsuite_mgr->get_testcases_deep($tsuite_id); new dBug($testcases_deep); define("GET_ONLY_TESTCASE_ID", 1); echo "<pre> get_testcases_deep(\$tsuite_id,\$details='full')"; echo "</pre>"; $testcases_deep = $tsuite_mgr->get_testcases_deep($tsuite_id, 'full'); new dBug($testcases_deep); echo "<pre> testsuite - getKeywords(\$tcID,\$kwID = null)"; echo "</pre>"; echo "<pre> getKeywords({$tsuite_id})"; echo "</pre>"; $keywords = $tsuite_mgr->getKeywords($tsuite_id); new dBug($keywords); echo "<pre> testsuite - get_keywords_map(\$id,\$order_by_clause='')"; echo "</pre>"; $tsuite_id = 4; echo "<pre> get_keywords_map({$tsuite_id})"; echo "</pre>"; $keywords_map = $tsuite_mgr->get_keywords_map($tsuite_id); new dBug($keywords_map); /* $set_of_tsuite_id=array(4,6); echo "<pre> get_by_id($set_of_tsuite_id)";echo "</pre>"; $set_of_tcase_info=$tsuite_mgr->get_by_id($set_of_tsuite_id); new dBug($set_of_tcase_info);