本文整理汇总了PHP中exportDataToXML函数的典型用法代码示例。如果您正苦于以下问题:PHP exportDataToXML函数的具体用法?PHP exportDataToXML怎么用?PHP exportDataToXML使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了exportDataToXML函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: exportReqDataToXML
/**
* exportReqDataToXML
*
*/
function exportReqDataToXML($reqData)
{
$rootElem = "<requirements>{{XMLCODE}}</requirements>";
$elemTpl = "\t" . '<requirement><docid><![CDATA[' . "\n||DOCID||\n]]>" . '</docid><title><![CDATA[' . "\n||TITLE||\n]]>" . '</title>' . '<description><![CDATA[' . "\n||DESCRIPTION||\n]]>" . '</description>' . '</requirement>' . "\n";
$info = array("||DOCID||" => "req_doc_id", "||TITLE||" => "title", "||DESCRIPTION||" => "scope");
return exportDataToXML($reqData, $rootElem, $elemTpl, $info);
}
开发者ID:mokal,项目名称:DCN_TestLink,代码行数:11,代码来源:requirements.inc.php
示例2: exportTestCaseDataToXML
function exportTestCaseDataToXML($tcase_id, $tcversion_id, $tproject_id = null, $bNoXMLHeader = false, $optExport = array())
{
static $reqMgr;
static $keywordMgr;
static $cfieldMgr;
if (is_null($reqMgr)) {
$reqMgr = new requirement_mgr($this->db);
$keywordMgr = new tlKeyword();
$cfieldMgr = new cfield_mgr($this->db);
}
// Useful when you need to get info but do not have tcase id
$tcase_id = intval((int) $tcase_id);
$tcversion_id = intval((int) $tcversion_id);
if ($tcase_id <= 0 && $tcversion_id > 0) {
$info = $this->tree_manager->get_node_hierarchy_info($tcversion_id);
$tcase_id = $info['parent_id'];
}
$tc_data = $this->get_by_id($tcase_id, $tcversion_id);
$testCaseVersionID = $tc_data[0]['id'];
if (!$tproject_id) {
$tproject_id = $this->getTestProjectFromTestCase($tcase_id);
}
if (isset($optExport['CFIELDS']) && $optExport['CFIELDS']) {
$cfMap = $this->get_linked_cfields_at_design($tcase_id, $testCaseVersionID, null, null, $tproject_id);
// ||yyy||-> tags, {{xxx}} -> attribute
// tags and attributes receive different treatment on exportDataToXML()
//
// each UPPER CASE word in this map KEY, MUST HAVE AN OCCURENCE on $elemTpl
// value is a key inside $tc_data[0]
//
if (!is_null($cfMap) && count($cfMap) > 0) {
// $cfRootElem = "<custom_fields>{{XMLCODE}}</custom_fields>";
// $cfElemTemplate = "\t" . "<custom_field>\n" .
// "\t<name><![CDATA[||NAME||]]></name>\n" .
// "\t<value><![CDATA[||VALUE||]]></value>\n</custom_field>\n";
// $cfDecode = array ("||NAME||" => "name","||VALUE||" => "value");
// $tc_data[0]['xmlcustomfields'] = $cfieldMgr->exportDataToXML($cfMap,$cfRootElem,$cfElemTemplate,$cfDecode,true);
$tc_data[0]['xmlcustomfields'] = $cfieldMgr->exportValueAsXML($cfMap);
}
}
if (isset($optExport['KEYWORDS']) && $optExport['KEYWORDS']) {
$keywords = $this->getKeywords($tcase_id);
if (!is_null($keywords)) {
$xmlKW = "<keywords>" . $keywordMgr->toXMLString($keywords, true) . "</keywords>";
$tc_data[0]['xmlkeywords'] = $xmlKW;
}
}
if (isset($optExport['REQS']) && $optExport['REQS']) {
$requirements = $reqMgr->get_all_for_tcase($tcase_id);
if (!is_null($requirements) && count($requirements) > 0) {
$reqRootElem = "\t<requirements>\n{{XMLCODE}}\t</requirements>\n";
$reqElemTemplate = "\t\t<requirement>\n" . "\t\t\t<req_spec_title><![CDATA[||REQ_SPEC_TITLE||]]></req_spec_title>\n" . "\t\t\t<doc_id><![CDATA[||REQ_DOC_ID||]]></doc_id>\n" . "\t\t\t<title><![CDATA[||REQ_TITLE||]]></title>\n" . "\t\t</requirement>\n";
$reqDecode = array("||REQ_SPEC_TITLE||" => "req_spec_title", "||REQ_DOC_ID||" => "req_doc_id", "||REQ_TITLE||" => "title");
$tc_data[0]['xmlrequirements'] = exportDataToXML($requirements, $reqRootElem, $reqElemTemplate, $reqDecode, true);
}
}
// ------------------------------------------------------------------------------------
$stepRootElem = "<steps>{{XMLCODE}}</steps>";
$stepTemplate = "\n" . '<step>' . "\n" . "\t<step_number><![CDATA[||STEP_NUMBER||]]></step_number>\n" . "\t<actions><![CDATA[||ACTIONS||]]></actions>\n" . "\t<expectedresults><![CDATA[||EXPECTEDRESULTS||]]></expectedresults>\n" . "\t<execution_type><![CDATA[||EXECUTIONTYPE||]]></execution_type>\n" . "</step>\n";
$stepInfo = array("||STEP_NUMBER||" => "step_number", "||ACTIONS||" => "actions", "||EXPECTEDRESULTS||" => "expected_results", "||EXECUTIONTYPE||" => "execution_type");
$stepSet = $tc_data[0]['steps'];
$xmlsteps = exportDataToXML($stepSet, $stepRootElem, $stepTemplate, $stepInfo, true);
$tc_data[0]['xmlsteps'] = $xmlsteps;
// ------------------------------------------------------------------------------------
$rootElem = "{{XMLCODE}}";
if (isset($optExport['ROOTELEM'])) {
$rootElem = $optExport['ROOTELEM'];
}
$elemTpl = "\n" . '<testcase internalid="{{TESTCASE_ID}}" name="{{NAME}}">' . "\n" . "\t<node_order><![CDATA[||NODE_ORDER||]]></node_order>\n";
if (!isset($optExport['EXTERNALID']) || $optExport['EXTERNALID']) {
$elemTpl .= "\t<externalid><![CDATA[||EXTERNALID||]]></externalid>\n";
}
$elemTpl .= "\t<version><![CDATA[||VERSION||]]></version>\n" . "\t<summary><![CDATA[||SUMMARY||]]></summary>\n" . "\t<preconditions><![CDATA[||PRECONDITIONS||]]></preconditions>\n" . "\t<execution_type><![CDATA[||EXECUTIONTYPE||]]></execution_type>\n" . "\t<importance><![CDATA[||IMPORTANCE||]]></importance>\n" . "\t<estimated_exec_duration>||ESTIMATED_EXEC_DURATION||</estimated_exec_duration>\n" . "\t<status>||STATUS||</status>\n" . "||STEPS||\n" . "||KEYWORDS||||CUSTOMFIELDS||||REQUIREMENTS||</testcase>\n";
// ||yyy||-> tags, {{xxx}} -> attribute
// tags and attributes receive different treatment on exportDataToXML()
//
// each UPPER CASE word in this map KEY, MUST HAVE AN OCCURENCE on $elemTpl
// value is a key inside $tc_data[0]
//
$info = array("{{TESTCASE_ID}}" => "testcase_id", "{{NAME}}" => "name", "||NODE_ORDER||" => "node_order", "||EXTERNALID||" => "tc_external_id", "||VERSION||" => "version", "||SUMMARY||" => "summary", "||PRECONDITIONS||" => "preconditions", "||EXECUTIONTYPE||" => "execution_type", "||IMPORTANCE||" => "importance", "||ESTIMATED_EXEC_DURATION||" => "estimated_exec_duration", "||STATUS||" => "status", "||STEPS||" => "xmlsteps", "||KEYWORDS||" => "xmlkeywords", "||CUSTOMFIELDS||" => "xmlcustomfields", "||REQUIREMENTS||" => "xmlrequirements");
$xmlTC = exportDataToXML($tc_data, $rootElem, $elemTpl, $info, $bNoXMLHeader);
return $xmlTC;
}
开发者ID:mokal,项目名称:DCN_TestLink,代码行数:83,代码来源:testcase.class.php
示例3: exportTestSuiteDataToXML
function exportTestSuiteDataToXML($container_id, $tproject_id, $optExport = array())
{
static $keywordMgr;
if (is_null($keywordMgr)) {
$keywordMgr = new tlKeyword();
}
// echo __FUNCTION__ . '<br>';
$xmlTC = null;
$doRecursion = isset($optExport['RECURSIVE']) ? $optExport['RECURSIVE'] : 0;
if ($doRecursion) {
$cfXML = null;
$kwXML = null;
$tsuiteData = $this->get_by_id($container_id);
if (@$optExport['KEYWORDS']) {
$kwMap = $this->getKeywords($container_id);
if ($kwMap) {
$kwXML = "<keywords>" . $keywordMgr->toXMLString($kwMap, true) . "</keywords>";
}
}
if ($optExport['CFIELDS']) {
// 20090106 - franciscom - custom fields
$cfMap = $this->get_linked_cfields_at_design($container_id, null, null, $tproject_id);
if (!is_null($cfMap) && count($cfMap) > 0) {
$cfRootElem = "<custom_fields>{{XMLCODE}}</custom_fields>";
$cfElemTemplate = "\t" . '<custom_field><name><![CDATA[' . "\n||NAME||\n]]>" . "</name>" . '<value><![CDATA[' . "\n||VALUE||\n]]>" . '</value></custom_field>' . "\n";
$cfDecode = array("||NAME||" => "name", "||VALUE||" => "value");
$cfXML = exportDataToXML($cfMap, $cfRootElem, $cfElemTemplate, $cfDecode, true);
}
}
$xmlTC = "<testsuite name=\"" . htmlspecialchars($tsuiteData['name']) . '" >' . "\n<node_order><![CDATA[{$tsuiteData['node_order']}]]></node_order>\n" . "<details><![CDATA[{$tsuiteData['details']}]]> \n{$kwXML}{$cfXML}</details>";
} 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;
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);
}
}
}
}
$xmlTC .= $doRecursion ? "</testsuite>" : "</testcases>";
return $xmlTC;
}
开发者ID:tamtrong,项目名称:testlink,代码行数:56,代码来源:testsuite.class.php
示例4: exportLinkedItemsToXML
/**
* create XML string with following structure
*
* <?xml version="1.0" encoding="UTF-8"?>
* <testplan>
* <name></name>
* <platforms>
* <platform>
* <name> </name>
* <internal_id> </internal_id>
* </platform>
* <platform>
* ...
* </platform>
* </platforms>
* <executables>
* <link>
* <platform>
* <name> </name>
* </platform>
* <testcase>
* <name> </name>
* <externalid> </externalid>
* <version> </version>
* <execution_order> </execution_order>
* </testcase>
* </link>
* <link>
* ...
* </link>
* </executables>
* </testplan>
* </xml>
*
*/
function exportLinkedItemsToXML($id)
{
$item_info = $this->get_by_id($id);
// Linked platforms
$xml_root = "<platforms>{{XMLCODE}}\n</platforms>";
// ||yyy||-> tags, {{xxx}} -> attribute
// tags and attributes receive different treatment on exportDataToXML()
//
// each UPPER CASE word in this map is a KEY, that MUST HAVE AN OCCURENCE on $elemTpl
//
$xml_template = "\n\t" . "<platform>" . "\t\t" . "<name><![CDATA[||PLATFORMNAME||]]></name>" . "\t\t" . "<internal_id><![CDATA[||PLATFORMID||]]></internal_id>" . "\n\t" . "</platform>";
$xml_mapping = null;
$xml_mapping = array("||PLATFORMNAME||" => "platform_name", "||PLATFORMID||" => 'id');
$mm = (array) $this->platform_mgr->getLinkedToTestplanAsMap($id);
$loop2do = count($mm);
if ($loop2do > 0) {
$items2loop = array_keys($mm);
foreach ($items2loop as $itemkey) {
$mm[$itemkey] = array('platform_name' => $mm[$itemkey], 'id' => $itemkey);
}
}
$linked_platforms = exportDataToXML($mm, $xml_root, $xml_template, $xml_mapping, 'noXMLHeader' == 'noXMLHeader');
// Linked test cases
$xml_root = "\n<executables>{{XMLCODE}}\n</executables>";
$xml_template = "\n\t" . "<link>" . "\n" . "\t\t" . "<platform>" . "\n" . "\t\t\t" . "<name><![CDATA[||PLATFORMNAME||]]></name>" . "\n" . "\t\t" . "</platform>" . "\n" . "\t\t" . "<testcase>" . "\n" . "\t\t\t" . "<name><![CDATA[||NAME||]]></name>\n" . "\t\t\t" . "<externalid><![CDATA[||EXTERNALID||]]></externalid>\n" . "\t\t\t" . "<version><![CDATA[||VERSION||]]></version>\n" . "\t\t\t" . "<execution_order><![CDATA[||EXECUTION_ORDER||]]></execution_order>\n" . "\t\t" . "</testcase>" . "\n" . "</link>" . "\n" . ($xml_mapping = null);
$xml_mapping = array("||PLATFORMNAME||" => "platform_name", "||EXTERNALID||" => "external_id", "||NAME||" => "name", "||VERSION||" => "version", "||EXECUTION_ORDER||" => "execution_order");
$mm = $this->get_linked_tcversions($id, null, array('output' => 'array'));
$linked_testcases = exportDataToXML($mm, $xml_root, $xml_template, $xml_mapping, 'noXMLHeader' == 'noXMLHeader');
$item_info['linked_platforms'] = $linked_platforms;
$item_info['linked_testcases'] = $linked_testcases;
$xml_root = "\n\t<testplan>{{XMLCODE}}\n\t</testplan>";
$xml_template = "\n\t\t" . "<name><![CDATA[||TESTPLANNAME||]]></name>" . "\n" . "\t\t||LINKED_PLATFORMS||\n" . "\t\t||LINKED_TESTCASES||\n";
$xml_mapping = null;
$xml_mapping = array("||TESTPLANNAME||" => "name", "||LINKED_PLATFORMS||" => "linked_platforms", "||LINKED_TESTCASES||" => "linked_testcases");
$xml = exportDataToXML(array($item_info), $xml_root, $xml_template, $xml_mapping);
// for debug -
// file_put_contents('c:\testplan.class.php.xml',$xml,FILE_APPEND);
// file_put_contents('c:\testplan.class.php.xml',$xml);
return $xml;
}
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:75,代码来源:testplan.class.php
示例5: exportForResultsToXML
/**
*
*/
function exportForResultsToXML($id, $context, $optExport = array(), $filters = null)
{
$my['filters'] = array('platform_id' => null, 'tcaseSet' => null);
$my['filters'] = array_merge($my['filters'], (array) $filters);
$item = $this->get_by_id($id, array('output' => 'minimun', 'caller' => __METHOD__));
$xmlString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" . "<!-- TestLink - www.testlink.org - xml to allow results import -->\n";
$xmlString .= "<results>\n";
$xmlString .= "\t<testproject name=\"" . htmlspecialchars($item['tproject_name']) . '"' . " prefix=\"" . htmlspecialchars($item['prefix']) . '"' . " />\n";
$xmlString .= "\t<testplan name=\"" . htmlspecialchars($item['name']) . '"' . " />\n";
if (isset($context['build_id']) && $context['build_id'] > 0) {
$dummy = $this->get_builds($id);
$info = $dummy[$context['build_id']];
$xmlString .= "\t<build name=\"" . htmlspecialchars($info['name']) . "\" />\n";
}
// get target platform (if exists)
if ($context['platform_id'] > 0) {
$info = $this->platform_mgr->getByID($context['platform_id']);
$xmlString .= "\t<platform name=\"" . htmlspecialchars($info['name']) . "\" />\n";
$my['filters']['platform_id'] = $context['platform_id'];
}
// <testcase external_id="BB-1" >
// <!-- if not present logged user will be used -->
// <!-- tester LOGIN Name -->
// <tester>u0113</tester>
// <!-- if not present now() will be used -->
// <timestamp>2008-09-08 14:00:00</timestamp>
// <result>p</result>
// <notes>functionality works great </notes>
// </testcase>
$mm = $this->getLinkedStaticView($id, $my['filters'], array('output' => 'array', 'detail' => '4results'));
if (!is_null($mm) && ($tcaseQty = count($mm)) > 0) {
// Custom fields processing
$xcf = $this->cfield_mgr->get_linked_cfields_at_execution($item['tproject_id'], 1, 'testcase');
if (!is_null($xcf) && ($cfQty = count($xcf)) > 0) {
for ($gdx = 0; $gdx < $tcaseQty; $gdx++) {
$mm[$gdx]['xmlcustomfields'] = $this->cfield_mgr->exportValueAsXML($xcf);
}
}
// Test Case Steps
$gso = array('fields2get' => 'TCSTEPS.id,TCSTEPS.step_number', 'renderGhostSteps' => false, 'renderImageInline' => false);
$stepRootElem = "<steps>{{XMLCODE}}</steps>";
$stepTemplate = "\n" . '<step>' . "\n" . "\t<step_number>||STEP_NUMBER||</step_number>\n" . "\t<result>p</result>\n" . "\t<notes>||NOTES||</notes>\n" . "</step>\n";
$stepInfo = array("||STEP_NUMBER||" => "step_number", "||NOTES||" => "notes");
for ($gdx = 0; $gdx < $tcaseQty; $gdx++) {
$mm[$gdx]['steps'] = $this->tcase_mgr->getStepsSimple($mm[$gdx]['tcversion_id'], 0, $gso);
if (!is_null($mm[$gdx]['steps'])) {
$qs = count($mm[$gdx]['steps']);
for ($scx = 0; $scx < $qs; $scx++) {
$mm[$gdx]['steps'][$scx]['notes'] = 'your step exec notes';
}
$mm[$gdx]['xmlsteps'] = exportDataToXML($mm[$gdx]['steps'], $stepRootElem, $stepTemplate, $stepInfo, true);
}
}
}
$xml_root = null;
$xml_template = "\n" . "\t<testcase external_id=\"{{FULLEXTERNALID}}\">" . "\n" . "\t\t" . "<result>X</result>" . "\n" . "\t\t" . "<notes>test link rocks </notes>" . "\n" . "\t\t" . "<tester>put login here</tester>" . "\n" . "\t\t" . "<!-- if not present now() will be used -->" . "\n" . "\t\t" . "<timestamp>YYYY-MM-DD HH:MM:SS</timestamp>" . "\n" . "\t\t" . "<bug_id>put your bug id here</bug_id>" . "\n" . "\t\t" . "||STEPS||" . "\n" . "\t\t" . "||CUSTOMFIELDS||" . "\n" . "\t</testcase>" . "\n";
$xml_mapping = null;
$xml_mapping = array("{{FULLEXTERNALID}}" => "full_external_id", "||CUSTOMFIELDS||" => "xmlcustomfields", "||STEPS||" => "xmlsteps");
$linked_testcases = exportDataToXML($mm, $xml_root, $xml_template, $xml_mapping, 'noXMLHeader' == 'noXMLHeader');
$zorba = $xmlString .= $linked_testcases . "\n</results>\n";
return $zorba;
}
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:65,代码来源:testplan.class.php
示例6: exportReqToXML
/**
* exportReqToXML
*
* @param int $id requirement id
* @param int $tproject_id: optional default null.
* useful to get custom fields (when this feature will be developed).
*
* @return string with XML code
*
*/
function exportReqToXML($id, $tproject_id = null)
{
$req = $this->get_by_id($id, requirement_mgr::LATEST_VERSION);
$reqData[] = $req[0];
// BUGID 2169
// BUGID 2877 - Custom Fields linked to Requirement Versions
// $cfXML = $this->customFieldValuesAsXML($id,$tproject_id);
$cfXML = $this->customFieldValuesAsXML($id, $req[0]['version_id'], $tproject_id);
$rootElem = "{{XMLCODE}}";
$elemTpl = "\t" . "<requirement>" . "\n\t\t" . "<docid><![CDATA[||DOCID||]]></docid>" . "\n\t\t" . "<title><![CDATA[||TITLE||]]></title>" . "\n\t\t" . "<node_order><![CDATA[||NODE_ORDER||]]></node_order>" . "\n\t\t" . "<description><![CDATA[\n||DESCRIPTION||\n]]></description>" . "\n\t\t" . "<status><![CDATA[||STATUS||]]></status>" . "\n\t\t" . "<type><![CDATA[||TYPE||]]></type>" . "\n\t\t" . "<expected_coverage><![CDATA[||EXPECTED_COVERAGE||]]></expected_coverage>" . "\n\t\t" . $cfXML . "\n\t" . "</requirement>" . "\n";
$info = array("||DOCID||" => "req_doc_id", "||TITLE||" => "title", "||DESCRIPTION||" => "scope", "||STATUS||" => "status", "||TYPE||" => "type", "||NODE_ORDER||" => "node_order", "||EXPECTED_COVERAGE||" => "expected_coverage");
$xmlStr = exportDataToXML($reqData, $rootElem, $elemTpl, $info, true);
return $xmlStr;
}
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:24,代码来源:requirement_mgr.class.php
示例7: toXMLString
public function toXMLString($keywordSet = null, $noHeader = false)
{
$keywords = is_null($keywordSet) ? array($this->getInfo()) : $keywordSet;
$rootElem = "{{XMLCODE}}";
$elemXMLTemplate = '<keyword name="{{NAME}}"><notes><![CDATA[' . "\n||NOTES||\n]]>" . '</notes></keyword>' . "\n";
$keywordInfo = array("{{NAME}}" => "keyword", "||NOTES||" => "notes");
$xml = exportDataToXML($keywords, $rootElem, $elemXMLTemplate, $keywordInfo, $noHeader);
return $xml;
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:9,代码来源:tlKeyword.class.php
示例8: exportForResultsToXML
/**
*
*/
function exportForResultsToXML($id, $context, $optExport = array())
{
$filters = null;
$item = $this->get_by_id($id, array('output' => 'minimun', 'caller' => __METHOD__));
$xmlString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" . "<!-- TestLink - www.teamst.org - xml to allow results import -->\n";
$xmlString .= "<results>\n";
$xmlString .= "\t<testproject name=\"" . htmlspecialchars($item['tproject_name']) . '"' . " prefix=\"" . htmlspecialchars($item['prefix']) . '"' . " />\n";
$xmlString .= "\t<testplan name=\"" . htmlspecialchars($item['name']) . '"' . " />\n";
if (isset($context['build_id']) && $context['build_id'] > 0) {
$dummy = $this->get_builds($id);
$info = $dummy[$context['build_id']];
$xmlString .= "\t<build name=\"" . htmlspecialchars($info['name']) . "\" />\n";
}
// get target platform (if exists)
if ($context['platform_id'] > 0) {
$info = $this->platform_mgr->getByID($context['platform_id']);
$xmlString .= "\t<platform name=\"" . htmlspecialchars($info['name']) . "\" />\n";
$filters['platform_id'] = $context['platform_id'];
}
// <testcase external_id="BB-1" >
// <!-- if not present logged user will be used -->
// <!-- tester LOGIN Name -->
// <tester>u0113</tester>
// <!-- if not present now() will be used -->
// <timestamp>2008-09-08 14:00:00</timestamp>
// <result>p</result>
// <notes>functionality works great </notes>
// </testcase>
$mm = $this->getLinkedStaticView($id, $filters, array('output' => 'array', 'detail' => '4results'));
$xml_root = null;
$xml_template = "\n" . "\t<testcase external_id=\"{{FULLEXTERNALID}}\">" . "\n" . "\t\t" . "<result>X</result>" . "\n" . "\t\t" . "<notes>test link rocks </notes>" . "\n" . "\t\t" . "<tester>put login here</tester>" . "\n" . "\t\t" . "<!-- if not present now() will be used -->" . "\n" . "\t\t" . "<timestamp>YYYY-MM-DD HH:MM:SS</timestamp>" . "\n" . "\t\t" . "<bug_id>put your bug id here</bug_id>" . "\n" . "\t</testcase>" . "\n" . ($xml_mapping = null);
$xml_mapping = array("{{FULLEXTERNALID}}" => "full_external_id");
$linked_testcases = exportDataToXML($mm, $xml_root, $xml_template, $xml_mapping, 'noXMLHeader' == 'noXMLHeader');
$zorba = $xmlString .= $linked_testcases . "\n</results>\n";
return $zorba;
}
开发者ID:mokal,项目名称:DCN_TestLink,代码行数:39,代码来源:testplan.class.php
示例9: exportValueAsXML
/**
* exportValueAsXML
* generate XML with custom field name, and custom field value
* useful on export to XML method for items that can have custom fields,
* example: test cases, test suites, req specification, etc.
*
* @param map $cfMap: key: custom file ID, value: map with at least keys 'name', 'value'
*
*/
function exportValueAsXML($cfMap)
{
$cfRootElem = "<custom_fields>\n{{XMLCODE}}\n</custom_fields>";
$cfElemTemplate = "\t" . "<custom_field>\n\t\t<name><![CDATA[||NAME||]]></name>\n\t\t" . "<value><![CDATA[||VALUE||]]></value>\n" . "\t" . "</custom_field>";
$cfDecode = array("||NAME||" => "name", "||VALUE||" => "value");
$cfXML = exportDataToXML($cfMap, $cfRootElem, $cfElemTemplate, $cfDecode, true);
return $cfXML;
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:17,代码来源:cfield_mgr.class.php
示例10: contextAsXML
/**
*
*
*/
function contextAsXML(&$dbHandler, $contextSet, &$tplanMgr)
{
$info = array();
$tprojectMgr = new testproject($dbHandler);
$info['tproject'] = $tprojectMgr->get_by_id($contextSet->tproject_id);
unset($tprojectMgr);
$info['tplan'] = $tplanMgr->get_by_id($contextSet->tplan_id);
$buildMgr = new build_mgr($dbHandler);
$info['build'] = $buildMgr->get_by_id($contextSet->build_id);
unset($buildMgr);
$info['platform'] = null;
$platform_template = '';
if ($contextSet->platform_id > 0) {
$platformMgr = new tlPlatform($dbHandler, $contextSet->tproject_id);
$info['platform'] = $platformMgr->getByID($contextSet->platform_id);
unset($platformMgr);
$platform_template = "\n\t" . "<platform>" . "\t\t" . "<name><![CDATA[||PLATFORMNAME||]]></name>" . "\t\t" . "<internal_id><![CDATA[||PLATFORMID||]]></internal_id>" . "\n\t" . "</platform>";
}
$key2loop = array_keys($info);
foreach ($key2loop as $item_key) {
if (!is_null($info[$item_key])) {
$contextInfo[$item_key . '_id'] = $info[$item_key]['id'];
$contextInfo[$item_key . '_name'] = $info[$item_key]['name'];
}
}
$contextInfo['prefix'] = $info['tproject']['prefix'];
$xml_root = "<context>{{XMLCODE}}\n</context>";
$xml_template = "\n\t" . "<testproject>" . "\t\t" . "<name><![CDATA[||TPROJECTNAME||]]></name>" . "\t\t" . "<internal_id><![CDATA[||TPROJECTID||]]></internal_id>" . "\t\t" . "<prefix><![CDATA[||TPROJECTPREFIX||]]></prefix>" . "\n\t" . "</testproject>" . "\n\t" . "<testplan>" . "\t\t" . "<name><![CDATA[||TPLANNAME||]]></name>" . "\t\t" . "<internal_id><![CDATA[||TPLANID||]]></internal_id>" . "\n\t" . "</testplan>" . $platform_template . "\n\t" . "<build>" . "\t\t" . "<name><![CDATA[||BUILDNAME||]]></name>" . "\t\t" . "<internal_id><![CDATA[||BUILDID||]]></internal_id>" . "\n\t" . "</build>";
$xml_mapping = null;
$xml_mapping = array("||TPROJECTNAME||" => "tproject_name", "||TPROJECTID||" => 'tproject_id', "||TPROJECTPREFIX||" => "prefix", "||TPLANNAME||" => "tplan_name", "||TPLANID||" => 'tplan_id', "||BUILDNAME||" => "build_name", "||BUILDID||" => 'build_id', "||PLATFORMNAME||" => "platform_name", "||PLATFORMID||" => 'platform_id');
$mm = array($contextInfo);
$contextXML = exportDataToXML($mm, $xml_root, $xml_template, $xml_mapping, 'noXMLHeader' == 'noXMLHeader');
// echo '<pre><xmp>';
// echo $contextXML;
// echo '</xmp></pre>';
return $contextXML;
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:41,代码来源:execExport.php
示例11: exportRelationToXML
/**
* exportRequirementRelationToXML
*
* Function to export a requirement relation to XML.
*
* @param int $relation relation data array
* @param string $troject_id
* @param bool $check_for_req_project (for interproject_linking output)
*
* @return string with XML code
*
* @internal revisions
* 20110314 - kinow - Created function.
*
*/
function exportRelationToXML($relation, $tproject_id = null, $check_for_req_project = false)
{
$xmlStr = '';
$source_docid = null;
$destination_docid = null;
$source_project = null;
$destination_project = null;
if (!is_null($relation)) {
// FRL : interproject linking support
$tproject_mgr = new testproject($this->db);
$reqs = $this->get_by_id($relation['source_id'], requirement_mgr::LATEST_VERSION);
if (!is_null($reqs) && count($reqs) > 0) {
$source_docid = $reqs[0]['req_doc_id'];
if ($check_for_req_project) {
$tproject = $tproject_mgr->get_by_id($reqs[0]['testproject_id']);
if ($tproject['id'] != $tproject_id) {
$source_project = $tproject['name'];
}
}
}
$reqs = $this->get_by_id($relation['destination_id'], requirement_mgr::LATEST_VERSION);
if (!is_null($reqs) && count($reqs) > 0) {
$destination_docid = $reqs[0]['req_doc_id'];
if ($check_for_req_project) {
$tproject = $tproject_mgr->get_by_id($reqs[0]['testproject_id']);
if ($tproject['id'] != $tproject_id) {
$destination_project = $tproject['name'];
}
}
}
if (!is_null($source_docid) && !is_null($destination_docid)) {
$relation['source_doc_id'] = $source_docid;
$relation['destination_doc_id'] = $destination_docid;
$info = array("||SOURCE||" => "source_doc_id", "||DESTINATION||" => "destination_doc_id", "||TYPE||" => "relation_type");
$elemTpl = "\t" . "<relation>" . "\n\t\t" . "<source>||SOURCE||</source>";
if (!is_null($source_project)) {
$elemTpl .= "\n\t\t" . "<source_project>||SRC_PROJECT||</source_project>";
$relation['source_project'] = $source_project;
$info["||SRC_PROJECT||"] = "source_project";
}
$elemTpl .= "\n\t\t" . "<destination>||DESTINATION||</destination>";
if (!is_null($destination_project)) {
$elemTpl .= "\n\t\t" . "<destination_project>||DST_PROJECT||</destination_project>";
$relation['destination_project'] = $destination_project;
$info["||DST_PROJECT||"] = "destination_project";
}
$elemTpl .= "\n\t\t" . "<type>||TYPE||</type>" . "\n\t" . "</relation>" . "\n";
$relations[] = $relation;
$xmlStr = exportDataToXML($relations, "{{XMLCODE}}", $elemTpl, $info, true);
}
}
return $xmlStr;
}
开发者ID:mokal,项目名称:DCN_TestLink,代码行数:68,代码来源:requirement_mgr.class.php
示例12: exportRelationToXML
/**
* exportRelationToXML
*
* Function to export a test case relation to XML.
*
* @param int $relation relation data array
* @param string $troject_id
*
* @return string with XML code
*
* <relation>
* <source>testcase external id</source>
* <source_project>prj</source_project>
* <destination>doc2_id</destination>
* <destination_project>testcase external id</destination_project>
* <type>0</type>
* </relation>
*
* @internal revisions
*
*/
function exportRelationToXML($relation, $item)
{
$xmlStr = '';
if (!is_null($relation)) {
// need to understand if swap is needed, this happens when
// relation type is
// - child_of
// - depends_on
// where item is DESTINATION and NOT SOURCE
if ($relation['source_id'] == $item['testcase_id']) {
$ele['source_ext_id'] = $item['fullExternalID'];
$ele['destination_ext_id'] = $relation['related_tcase']['fullExternalID'];
} else {
// SWAP
$ele['source_ext_id'] = $relation['related_tcase']['fullExternalID'];
$ele['destination_ext_id'] = $item['fullExternalID'];
}
$ele['relation_type'] = $relation['relation_type'];
$info = array("||SOURCE||" => "source_ext_id", "||DESTINATION||" => "destination_ext_id", "||TYPE||" => "relation_type");
$elemTpl = "\t" . "<relation>" . "\n\t\t" . "<source>||SOURCE||</source>";
$elemTpl .= "\n\t\t" . "<destination>||DESTINATION||</destination>";
$elemTpl .= "\n\t\t" . "<type>||TYPE||</type>" . "\n\t" . "</relation>" . "\n";
$work[] = $ele;
$xmlStr = exportDataToXML($work, "{{XMLCODE}}", $elemTpl, $info, true);
}
return $xmlStr;
}
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:48,代码来源:testcase.class.php
示例13: exportTestPlanDataToXML
/**
* create XML string with following structure
*
* <?xml version="1.0" encoding="UTF-8"?>
*
* @param mixed context: map with following keys
* platform_id: MANDATORY
* build_id: OPTIONAL
* tproject_id: OPTIONAL
*/
function exportTestPlanDataToXML($id, $context, $optExport = array())
{
$platform_id = $context['platform_id'];
if (!isset($context['tproject_id']) || is_null($context['tproject_id'])) {
$dummy = $this->tree_manager->get_node_hierarchy_info($id);
$context['tproject_id'] = $dummy['parent_id'];
}
$context['tproject_id'] = intval($context['tproject_id']);
$xmlTC = null;
// CRITIC - this has to be firt population of item_info.
// Other processes adds info to this map.
$item_info = $this->get_by_id($id);
// Need to get family
// $tplan_spec = $this->tree_manager->get_subtree($id,tree::USE_RECURSIVE_MODE);
$nt2exclude = array('testplan' => 'exclude_me', 'requirement_spec' => 'exclude_me', 'requirement' => 'exclude_me');
$nt2exclude_children = array('testcase' => 'exclude_my_children', 'requirement_spec' => 'exclude_my_children');
$my = array();
// this can be a litte weird but ...
// when
// 'order_cfg' => array("type" =>'exec_order'
// additional info test plan id, and platform id are used to get
// a filtered view of tree.
//
$order_cfg = array("type" => 'exec_order', "tplan_id" => $id);
if ($context['platform_id'] > 0) {
$order_cfg['platform_id'] = $context['platform_id'];
}
$my['options'] = array('recursive' => true, 'order_cfg' => $order_cfg, 'remove_empty_nodes_of_type' => $this->tree_manager->node_descr_id['testsuite']);
$my['filters'] = array('exclude_node_types' => $nt2exclude, 'exclude_children_of' => $nt2exclude_children);
$tplan_spec = $this->tree_manager->get_subtree($context['tproject_id'], $my['filters'], $my['options']);
// -----------------------------------------------------------------------------------------------------
// Generate test project info
$tproject_mgr = new testproject($this->db);
$tproject_info = $tproject_mgr->get_by_id($context['tproject_id']);
// ||yyy||-> tags, {{xxx}} -> attribute
// tags and attributes receive different treatment on exportDataToXML()
//
// each UPPER CASE word in this map is a KEY, that MUST HAVE AN OCCURENCE on $elemTpl
//
$xml_template = "\n\t" . "<testproject>" . "\t\t" . "<name><![CDATA[||TESTPROJECTNAME||]]></name>" . "\t\t" . "<internal_id><![CDATA[||TESTPROJECTID||]]></internal_id>" . "\n\t" . "</testproject>";
$xml_root = "{{XMLCODE}}";
$xml_mapping = null;
$xml_mapping = array("||TESTPROJECTNAME||" => "name", "||TESTPROJECTID||" => 'id');
$mm = array();
$mm[$context['tproject_id']] = array('name' => $tproject_info['name'], 'id' => $context['tproject_id']);
$item_info['testproject'] = exportDataToXML($mm, $xml_root, $xml_template, $xml_mapping, 'noXMLHeader' == 'noXMLHeader');
// -----------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------
// get target platform (if exists)
$target_platform = '';
if ($context['platform_id'] > 0) {
$info = $this->platform_mgr->getByID($context['platform_id']);
// ||yyy||-> tags, {{xxx}} -> attribute
// tags and attributes receive different treatment on exportDataToXML()
//
// each UPPER CASE word in this map is a KEY, that MUST HAVE AN OCCURENCE on $elemTpl
//
$xml_template = "\n\t" . "<platform>" . "\t\t" . "<name><![CDATA[||PLATFORMNAME||]]></name>" . "\t\t" . "<internal_id><![CDATA[||PLATFORMID||]]></internal_id>" . "\n\t" . "</platform>";
$xml_root = "{{XMLCODE}}";
$xml_mapping = null;
$xml_mapping = array("||PLATFORMNAME||" => "platform_name", "||PLATFORMID||" => 'id');
$mm = array();
$mm[$context['platform_id']] = array('platform_name' => $info['name'], 'id' => $context['platform_id']);
$item_info['target_platform'] = exportDataToXML($mm, $xml_root, $xml_template, $xml_mapping, 'noXMLHeader' == 'noXMLHeader');
$target_platform = "\t\t||TARGET_PLATFORM||\n";
}
// -----------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------
// get Build info (if possible)
$target_build = '';
if (isset($context['build_id']) && $context['build_id'] > 0) {
$dummy = $this->get_builds($id);
$info = $dummy[$context['build_id']];
// ||yyy||-> tags, {{xxx}} -> attribute
// tags and attributes receive different treatment on exportDataToXML()
//
// each UPPER CASE word in this map is a KEY, that MUST HAVE AN OCCURENCE on $elemTpl
//
$xml_template = "\n\t" . "<build>" . "\t\t" . "<name><![CDATA[||BUILDNAME||]]></name>" . "\t\t" . "<internal_id><![CDATA[||BUILDID||]]></internal_id>" . "\n\t" . "</build>";
$xml_root = "{{XMLCODE}}";
$xml_mapping = null;
$xml_mapping = array("||BUILDNAME||" => "name", "||BUILDID||" => 'id');
$mm = array();
$mm[$context['build_id']] = array('name' => $info['name'], 'id' => $context['build_id']);
$item_info['target_build'] = exportDataToXML($mm, $xml_root, $xml_template, $xml_mapping, 'noXMLHeader' == 'noXMLHeader');
$target_build = "\t\t||TARGET_BUILD||\n";
}
// -----------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------
// get test plan contents (test suites and test cases)
//.........这里部分代码省略.........
开发者ID:moraesmv,项目名称:testlink-code,代码行数:101,代码来源:testplan.class.php
示例14: exportValueAsXML
/**
* exportValueAsXML
* generate XML with custom field name, and custom field value
* useful on export to XML method for items that can have custom fields,
* example: test cases, test suites, req specification, etc.
*
* @param map $cfMap: key: custom file ID, value: map with at least keys 'name', 'value'
*
*/
function exportValueAsXML($cfMap)
{
$cfRootElem = "<custom_fields>{{XMLCODE}}</custom_fields>";
$cfElemTemplate = "\t" . '<custom_field><name><![CDATA[' . "\n||NAME||\n]]>" . "</name>" . '<value><![CDATA[' . "\n||VALUE||\n]]>" . '</value></custom_field>' . "\n";
$cfDecode = array("||NAME||" => &qu
|
请发表评论