本文整理汇总了PHP中testcase::exportRelationToXML方法的典型用法代码示例。如果您正苦于以下问题:PHP testcase::exportRelationToXML方法的具体用法?PHP testcase::exportRelationToXML怎么用?PHP testcase::exportRelationToXML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testcase
的用法示例。
在下文中一共展示了testcase::exportRelationToXML方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exportTestSuiteDataToXML
function exportTestSuiteDataToXML($container_id, $tproject_id, $optExport = array())
{
static $keywordMgr;
static $getLastVersionOpt = array('output' => 'minimun');
static $tcase_mgr;
if (is_null($keywordMgr)) {
$keywordMgr = new tlKeyword();
}
$xmlTC = null;
$relCache = array();
$doRecursion = isset($optExport['RECURSIVE']) ? $optExport['RECURSIVE'] : 0;
if ($doRecursion) {
$cfXML = null;
$kwXML = null;
$tsuiteData = $this->get_by_id($container_id);
if (isset($optExport['KEYWORDS']) && $optExport['KEYWORDS']) {
$kwMap = $this->getKeywords($container_id);
if ($kwMap) {
$kwXML = "<keywords>" . $keywordMgr->toXMLString($kwMap, true) . "</keywords>";
}
}
if (isset($optExport['CFIELDS']) && $optExport['CFIELDS']) {
$cfMap = (array) $this->get_linked_cfields_at_design($container_id, null, null, $tproject_id);
if (count($cfMap) > 0) {
$cfXML = $this->cfield_mgr->exportValueAsXML($cfMap);
}
}
$xmlTC = '<testsuite id="' . $tsuiteData['id'] . '" ' . 'name="' . htmlspecialchars($tsuiteData['name']) . '" >' . "\n<node_order><![CDATA[{$tsuiteData['node_order']}]]></node_order>\n" . "<details><![CDATA[{$tsuiteData['details']}]]></details> \n{$kwXML}{$cfXML}";
} else {
$xmlTC = "<testcases>";
}
$test_spec = $this->get_subtree($container_id, self::USE_RECURSIVE_MODE);
$childNodes = isset($test_spec['childNodes']) ? $test_spec['childNodes'] : null;
$tcase_mgr = null;
$relXmlData = '';
if (!is_null($childNodes)) {
$loop_qty = sizeof($childNodes);
for ($idx = 0; $idx < $loop_qty; $idx++) {
$cNode = $childNodes[$idx];
$nTable = $cNode['node_table'];
if ($doRecursion && $nTable == 'testsuites') {
$xmlTC .= $this->exportTestSuiteDataToXML($cNode['id'], $tproject_id, $optExport);
} else {
if ($nTable == 'testcases') {
if (is_null($tcase_mgr)) {
$tcase_mgr = new testcase($this->db);
}
$xmlTC .= $tcase_mgr->exportTestCaseDataToXML($cNode['id'], testcase::LATEST_VERSION, $tproject_id, true, $optExport);
// 20140816
// Collect and do cache of all test case relations that exists inside this test suite.
$relSet = $tcase_mgr->getRelations($cNode['id']);
if ($relSet['num_relations'] > 0) {
foreach ($relSet['relations'] as $key => $rel) {
// If we have already found this relation, skip it.
if (!in_array($rel['id'], $relCache)) {
$relXmlData .= $tcase_mgr->exportRelationToXML($rel, $relSet['item']);
$relCache[] = $rel['id'];
}
}
}
}
}
}
}
// after we scanned all relations and exported all relations to xml, let's output it to the XML buffer
$xmlTC .= $relXmlData;
$xmlTC .= $doRecursion ? "</testsuite>" : "</testcases>";
return $xmlTC;
}