當前位置: 首頁>>代碼示例>>PHP>>正文


PHP testcase::getRelations方法代碼示例

本文整理匯總了PHP中testcase::getRelations方法的典型用法代碼示例。如果您正苦於以下問題:PHP testcase::getRelations方法的具體用法?PHP testcase::getRelations怎麽用?PHP testcase::getRelations使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在testcase的用法示例。


在下文中一共展示了testcase::getRelations方法的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;
 }
開發者ID:JacekKarwas,項目名稱:smutek,代碼行數:69,代碼來源:testsuite.class.php


注:本文中的testcase::getRelations方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。