当前位置: 首页>>代码示例>>PHP>>正文


PHP testcase::exportTestCaseDataToXML方法代码示例

本文整理汇总了PHP中testcase::exportTestCaseDataToXML方法的典型用法代码示例。如果您正苦于以下问题:PHP testcase::exportTestCaseDataToXML方法的具体用法?PHP testcase::exportTestCaseDataToXML怎么用?PHP testcase::exportTestCaseDataToXML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在testcase的用法示例。


在下文中一共展示了testcase::exportTestCaseDataToXML方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: exportTestSuiteDataToXML

 /**
  * 
  *
  */
 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;
 }
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:58,代码来源:testplan.class.php

示例3: tcaseSetAsXML

/**
 * 
 *
 */
function tcaseSetAsXML(&$dbHandler, $contextSet)
{
    $tcaseMgr = new testcase($dbHandler);
    $tcversionSet = explode(',', $contextSet->tcversionSet);
    $xmlTC = "<testcases>\n\t";
    foreach ($tcversionSet as $tcversion_id) {
        $xmlTC .= $tcaseMgr->exportTestCaseDataToXML(0, $tcversion_id, $contextSet->tproject_id, true);
    }
    $xmlTC .= "</testcases>\n\t";
    return $xmlTC;
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:15,代码来源:execExport.php

示例4: 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;
     $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 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:moraesmv,项目名称:testlink-code,代码行数:53,代码来源:testsuite.class.php

示例5: 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;
 }
开发者ID:JacekKarwas,项目名称:smutek,代码行数:69,代码来源:testsuite.class.php


注:本文中的testcase::exportTestCaseDataToXML方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。