本文整理汇总了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;
}