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


PHP testcase::copy_to方法代码示例

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


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

示例1: array

 function copy_to($id, $parent_id, $user_id, $options = null, $mappings = null)
 {
     $my['options'] = array('check_duplicate_name' => 0, 'action_on_duplicate_name' => 'allow_repeat', 'copyKeywords' => 0, 'copyRequirements' => 0);
     $my['options'] = array_merge($my['options'], (array) $options);
     $my['mappings'] = array();
     $my['mappings'] = array_merge($my['mappings'], (array) $mappings);
     $copyTCaseOpt = array('copy_also' => array('keyword_assignments' => $my['options']['copyKeywords'], 'requirement_assignments' => $my['options']['copyRequirements']));
     $copyOptions = array('keyword_assignments' => $my['options']['copyKeywords']);
     $tcase_mgr = new testcase($this->db);
     $tsuite_info = $this->get_by_id($id);
     $op = $this->create($parent_id, $tsuite_info['name'], $tsuite_info['details'], $tsuite_info['node_order'], $my['options']['check_duplicate_name'], $my['options']['action_on_duplicate_name']);
     $op['mappings'][$id] = $op['id'];
     $new_tsuite_id = $op['id'];
     // Work on root of these subtree
     // Attachments
     // Keyword assignment
     // Custom Field values
     $this->copy_attachments($id, $new_tsuite_id);
     if ($my['options']['copyKeywords']) {
         $kmap = isset($my['mappings']['keywords']) ? $my['mappings']['keywords'] : null;
         $this->copy_keyword_assignment($id, $new_tsuite_id, $kmap);
     }
     $this->copy_cfields_values($id, $new_tsuite_id);
     $my['filters'] = array('exclude_children_of' => array('testcase' => 'exclude my children'));
     $subtree = $this->tree_manager->get_subtree($id, $my['filters']);
     if (!is_null($subtree)) {
         $parent_decode = array();
         $parent_decode[$id] = $new_tsuite_id;
         foreach ($subtree as $the_key => $elem) {
             $the_parent_id = $parent_decode[$elem['parent_id']];
             switch ($elem['node_type_id']) {
                 case $this->node_types_descr_id['testcase']:
                     $tcOp = $tcase_mgr->copy_to($elem['id'], $the_parent_id, $user_id, $copyTCaseOpt);
                     $op['mappings'] += $tcOp['mappings'];
                     break;
                 case $this->node_types_descr_id['testsuite']:
                     $tsuite_info = $this->get_by_id($elem['id']);
                     $ret = $this->create($the_parent_id, $tsuite_info['name'], $tsuite_info['details'], $tsuite_info['node_order']);
                     $parent_decode[$elem['id']] = $ret['id'];
                     $op['mappings'][$elem['id']] = $ret['id'];
                     $tcase_mgr->copy_attachments($elem['id'], $ret['id']);
                     if ($my['options']['copyKeywords']) {
                         $this->copy_keyword_assignment($elem['id'], $ret['id'], $kmap);
                     }
                     $this->copy_cfields_values($elem['id'], $ret['id']);
                     break;
             }
         }
     }
     return $op;
 }
开发者ID:tamtrong,项目名称:testlink,代码行数:51,代码来源:testsuite.class.php


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