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


PHP testproject::get_subtree方法代码示例

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


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

示例1: getTestSpecFromNode

/**
 * get Test Specification data within a Node
 *  
 *	using nodeId (that normally is a test suite id) as starting point
 *	will return subtree that start at nodeId.
 *	If filters are given, the subtree returned is filtered.
 * 
 *	Important Notice regaring keyword filtering
 *	Keyword filter logic inside this function seems to work ONLY on OR mode.
 *	Then how the AND mode is implemented ?
 *	Filter for test case id is used, and the test case set has been generated
 *	applying AND or OR logic (following user's choice).
 *	Then seems that logic regarding keywords here, may be can be removed
 *
 * @param integer $masterContainerId can be a Test Project Id, or a Test Plan id.
 *                is used only if keyword id filter has been specified
 *                to get all keyword defined on masterContainer.
 *
 * @param integer $nodeId node that will be root of the view we want to build.
 * 
 * @param string $specViewType: type of view requested
 *
 * @param array $filters
 *	  			filters['keyword_id']: array of keywords 
 *
 * 
 * @return array map with view (test cases subtree)
 * 
 * @internal revisions
 * 20100417 - franciscom - BUGID 2498 - added logic to filter by importance (defined on test case spec)
 * 20100411 - franciscom - added logic to filter by execution type
 */
function getTestSpecFromNode(&$dbHandler, &$tcaseMgr, &$linkedItems, $masterContainerId, $nodeId, $specViewType, $filters)
{
    $applyFilters = false;
    $testCaseSet = null;
    $tck_map = null;
    $tobj_mgr = new testproject($dbHandler);
    $test_spec = $tobj_mgr->get_subtree($nodeId);
    $key2loop = null;
    $useAllowed = false;
    // 20100411 - BUGID 2797 - filter by test case execution type
    $useFilter = array('keyword_id' => false, 'tcase_id' => false, 'exec_type' => false);
    // BUGID 3768
    if (!is_array($filters['keyword_id'])) {
        $filters['keyword_id'] = array($filters['keyword_id']);
    }
    if ($useFilter['keyword_id'] = $filters['keyword_id'][0] > 0) {
        $applyFilters = true;
        switch ($specViewType) {
            case 'testplan':
                $tobj_mgr = new testplan($dbHandler);
                break;
        }
        $tck_map = $tobj_mgr->get_keywords_tcases($masterContainerId, $filters['keyword_id']);
    }
    if ($useFilter['tcase_id'] = !is_null($filters['tcase_id'])) {
        $applyFilters = true;
        $testCaseSet = is_array($filters['tcase_id']) ? $filters['tcase_id'] : array($filters['tcase_id']);
    }
    if ($useFilter['execution_type'] = !is_null($filters['execution_type'])) {
        $applyFilters = true;
    }
    // BUGID
    if ($useFilter['importance'] = !is_null($filters['importance'])) {
        $applyFilters = true;
    }
    if ($applyFilters) {
        $key2loop = array_keys($test_spec);
        // first step: generate list of TEST CASE NODES
        $itemSet = null;
        foreach ($key2loop as $key) {
            if ($test_spec[$key]['node_type_id'] == $filters['tcase_node_type_id']) {
                $itemSet[$test_spec[$key]['id']] = $key;
            }
        }
        $itemKeys = $itemSet;
        foreach ($itemKeys as $key => $tspecKey) {
            if ($useFilter['keyword_id'] && !isset($tck_map[$test_spec[$tspecKey]['id']]) || $useFilter['tcase_id'] && !in_array($test_spec[$tspecKey]['id'], $testCaseSet)) {
                $test_spec[$tspecKey] = null;
                unset($itemSet[$key]);
            }
        }
        if (count($itemSet) > 0 && ($useFilter['execution_type'] || $useFilter['importance'])) {
            $targetSet = array_keys($itemSet);
            $options = $specViewType == 'testPlanLinking' ? array('access_key' => 'testcase_id') : null;
            $tcversionSet = $tcaseMgr->get_last_active_version($targetSet, $options);
            switch ($specViewType) {
                case 'testPlanLinking':
                    // We need to analise linked items and spec
                    foreach ($targetSet as $idx => $key) {
                        $targetTestCase = $tcversionSet[$key]['testcase_id'];
                        if (isset($linkedItems[$targetTestCase])) {
                            $item = current($linkedItems[$targetTestCase]);
                        } else {
                            $item = null;
                            if (isset($test_spec[$itemSet[$targetTestCase]])) {
                                $item = $tcversionSet[$targetTestCase];
                            }
                        }
//.........这里部分代码省略.........
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:101,代码来源:specview.php

示例2: get_testplan_nodes_testcount

/**
 * @return array a map:
 *         key    => node_id
 *         values => node test case count considering test cases presents
 *                   in the nodes of the subtree that starts on node_id
 *                   Means test case can not be sons/daughters of node_id.
 * 
 *                   node name (useful only for debug purpouses).
 */
function get_testplan_nodes_testcount(&$db, $tproject_id, $tproject_name, $tplan_id, $tplan_name, $keywordsFilter = null)
{
    $tplan_mgr = new testplan($db);
    $tproject_mgr = new testproject($db);
    $tree_manager = $tplan_mgr->tree_manager;
    $tcase_node_type = $tree_manager->node_descr_id['testcase'];
    $hash_descr_id = $tree_manager->get_available_node_types();
    $hash_id_descr = array_flip($hash_descr_id);
    $resultsCfg = config_get('results');
    $decoding_hash = array('node_id_descr' => $hash_id_descr, 'status_descr_code' => $resultsCfg['status_code'], 'status_code_descr' => $resultsCfg['code_status']);
    $test_spec = $tproject_mgr->get_subtree($tproject_id, RECURSIVE_MODE);
    $linkedFilters = array('keyword_id' => $keywordsFilter->items);
    $tplan_tcases = $tplan_mgr->get_linked_tcversions($tplan_id, $linkedFilters);
    if (is_null($tplan_tcases)) {
        $tplan_tcases = array();
    }
    $test_spec['name'] = $tproject_name;
    $test_spec['id'] = $tproject_id;
    $test_spec['node_type_id'] = $hash_descr_id['testproject'];
    $map_node_tccount = array();
    if ($test_spec) {
        $tck_map = null;
        if (!is_null($keywordsFilter)) {
            $tck_map = $tproject_mgr->get_keywords_tcases($tproject_id, $keywordsFilter->items, $keywordsFilter->type);
        }
        //@TODO: schlundus, can we speed up with NO_EXTERNAL?
        $filters = null;
        $options = array('hideTestCases' => 0, 'viewType' => 'executionTree');
        $testcase_counters = prepareNode($db, $test_spec, $decoding_hash, $map_node_tccount, $tck_map, $tplan_tcases, $filters, $options);
        $test_spec['testcase_count'] = $testcase_counters['testcase_count'];
    }
    return $map_node_tccount;
}
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:42,代码来源:treeMenu.inc.php

示例3: generateExecTree

 /**
  * initializes linked_tcversions object
  *
  * Builds a multi-dimentional array which represents the tree structure.
  * Specifically an array is returned in the following pattern
  * every 3rd index is null if suite does not contain other suites
  * or array of same pattern if it does contain suites
  *
  * KL took this code from menuTree.inc.php.
  * Builds both $this->flatArray and $this->suiteStructure
  *
  * @param resource &$db reference to database handler
  * 
  * @return array structured map
  * 
  *  suite[0] = suite id
  *	suite[1] = suite name
  *	suite[2] = array() of child suites or null
  *	suite[3] = suite id
  *	suite[4] = suite name
  *	suite[5] = array() of child suites or null
  *
  */
 private function generateExecTree(&$db, $keyword_id = 0, $owner = null)
 {
     $RECURSIVE_MODE = true;
     $tplan_mgr = $this->tplanMgr;
     $tproject_mgr = new testproject($this->db);
     $tree_manager = $tplan_mgr->tree_manager;
     $hash_descr_id = $tree_manager->get_available_node_types();
     $test_spec = $tproject_mgr->get_subtree($this->tprojectID, $RECURSIVE_MODE);
     $filters = array('keyword_id' => $keyword_id, 'assigned_to' => $owner);
     // $options = array('output' => 'mapOfArray'); // needed to have platform info
     $options = array('output' => 'mapOfMap');
     // needed to have platform info
     $tplan_tcversions = $tplan_mgr->get_linked_tcversions($this->testPlanID, $filters, $options);
     // $this->linked_tcversions = &$tp_tcs;
     if (is_null($tplan_tcversions)) {
         $tplan_tcversions = array();
     }
     $test_spec['name'] = $this->tplanName;
     $test_spec['id'] = $this->tprojectID;
     $test_spec['node_type_id'] = $hash_descr_id['testproject'];
     $suiteStructure = null;
     $tck_map = null;
     if ($keyword_id) {
         $tck_map = $tproject_mgr->get_keywords_tcases($this->tprojectID, $keyword_id);
     }
     $hash_id_descr = array_flip($hash_descr_id);
     $testcase_count = $this->removeEmptySuites($test_spec, $hash_id_descr, $tck_map, $tplan_tcversions, $owner);
     // $mem[]=self::memory_status(__CLASS__,__FILE__,__FUNCTION__,__LINE__);
     // $xmem=current($mem);
     // echo "<pre>debug 20080928 - \ - " . __FUNCTION__ . " --- "; print_r($xmem['msg']); echo "</pre>";
     // ob_flush();flush();
     $suiteStructure = $this->processExecTreeNode(1, $test_spec, $hash_id_descr);
     return array($suiteStructure, $tplan_tcversions);
 }
开发者ID:moraesmv,项目名称:testlink-code,代码行数:57,代码来源:results.class.php

示例4: getTestSpecFromNode

/**
 * get Test Specification data within a Node
 *  
 *  using nodeId (that normally is a test suite id) as starting point
 *  will return subtree that start at nodeId.
 *  If filters are given, the subtree returned is filtered.
 * 
 *  Important Notice regaring keyword filtering
 *  Keyword filter logic inside this function seems to work ONLY on OR mode.
 *  Then how the AND mode is implemented ?
 *  Filter for test case id is used, and the test case set has been generated
 *  applying AND or OR logic (following user's choice).
 *  Then seems that logic regarding keywords here, may be can be removed
 *
 * @param integer $masterContainerId can be a Test Project Id, or a Test Plan id.
 *                is used only if keyword id filter has been specified
 *                to get all keyword defined on masterContainer.
 *
 * @param integer $nodeId node that will be root of the view we want to build.
 * 
 * @param string $specViewType: type of view requested
 *
 * @param array $filters
 *          filters['keyword_id']: array of keywords  
 *          filters['tcase_id']: 
 *          filters['execution_type']: 
 *          filters['importance']: 
 *          filters['cfields']: 
 *          filters['tcase_name']: 
 *
 * 
 * @return array map with view (test cases subtree)
 * 
 * @internal revisions
 *
 */
function getTestSpecFromNode(&$dbHandler, &$tcaseMgr, &$linkedItems, $masterContainerId, $nodeId, $specViewType, $filters)
{
    $applyFilters = false;
    $testCaseSet = null;
    $tck_map = null;
    $tobj_mgr = new testproject($dbHandler);
    $opt = null;
    if ($specViewType == 'testplan') {
        $opt['order_cfg'] = array("type" => 'exec_order', 'tplan_id' => $masterContainerId);
    }
    $test_spec = $tobj_mgr->get_subtree($nodeId, null, $opt);
    $key2loop = null;
    $useAllowed = false;
    $nullCheckFilter = array('tcase_id' => false, 'importance' => false, 'tcase_name' => false, 'cfields' => false, 'status' => false);
    $zeroNullCheckFilter = array('execution_type' => false);
    $useFilter = array('keyword_id' => false) + $nullCheckFilter + $zeroNullCheckFilter;
    $applyFilters = false;
    foreach ($nullCheckFilter as $key => $value) {
        $useFilter[$key] = !is_null($filters[$key]);
        $applyFilters = $applyFilters || $useFilter[$key];
    }
    // more specif analisys
    if ($useFilter['status'] = $filters['status'][0] > 0) {
        $applyFilters = true;
        $filtersByValue['status'] = array_flip((array) $filters['status']);
    }
    if ($useFilter['importance'] = $filters['importance'][0] > 0) {
        $applyFilters = true;
        $filtersByValue['importance'] = array_flip((array) $filters['importance']);
    }
    foreach ($zeroNullCheckFilter as $key => $value) {
        // need to check for > 0, because for some items 0 has same meaning that null -> no filter
        $useFilter[$key] = !is_null($filters[$key]) && $filters[$key] > 0;
        $applyFilters = $applyFilters || $useFilter[$key];
    }
    if ($useFilter['tcase_id']) {
        $testCaseSet = is_array($filters['tcase_id']) ? $filters['tcase_id'] : array($filters['tcase_id']);
    }
    if (!is_array($filters['keyword_id'])) {
        $filters['keyword_id'] = array($filters['keyword_id']);
    }
    if ($useFilter['keyword_id'] = $filters['keyword_id'][0] > 0) {
        $applyFilters = true;
        switch ($specViewType) {
            case 'testplan':
                $tobj_mgr = new testplan($dbHandler);
                break;
        }
        $tck_map = $tobj_mgr->get_keywords_tcases($masterContainerId, $filters['keyword_id']);
    }
    if ($applyFilters) {
        $key2loop = array_keys($test_spec);
        // first step: generate list of TEST CASE NODES
        $itemSet = null;
        foreach ($key2loop as $key) {
            if ($test_spec[$key]['node_type_id'] == $filters['tcase_node_type_id']) {
                $itemSet[$test_spec[$key]['id']] = $key;
            }
        }
        $itemKeys = $itemSet;
        foreach ($itemKeys as $key => $tspecKey) {
            // case insensitive search
            if ($useFilter['keyword_id'] && !isset($tck_map[$test_spec[$tspecKey]['id']]) || $useFilter['tcase_id'] && !in_array($test_spec[$tspecKey]['id'], $testCaseSet) || $useFilter['tcase_name'] && stripos($test_spec[$tspecKey]['name'], $filters['tcase_name']) === false) {
                $test_spec[$tspecKey] = null;
//.........这里部分代码省略.........
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:101,代码来源:specview.php

示例5: getTestSpecFromNode

/**
 * get Test Specification data within a Node
 *  
 *	using nodeId (that normally is a test suite id) as starting point
 *	will return subtree that start at nodeId.
 *	If filters are given, the subtree returned is filtered.
 * 
 *	Important Notice regaring keyword filtering
 *	Keyword filter logic inside this function seems to work ONLY on OR mode.
 *	Then how the AND mode is implemented ?
 *	Filter for test case id is used, and the test case set has been generated
 *	applying AND or OR logic (following user's choice).
 *	Then seems that logic regarding keywords here, may be can be removed
 *
 * @param integer $masterContainerId can be a Test Project Id, or a Test Plan id.
 *                is used only if keyword id filter has been specified
 *                to get all keyword defined on masterContainer.
 *
 * @param integer $nodeId node that will be root of the view we want to build.
 * 
 * @param string $specViewType: type of view requested
 *
 * @param array $filters
 *	  			filters['keyword_id']: array of keywords  
 *	  			filters['tcase_id']: 
 *	  			filters['execution_type']: 
 *	  			filters['importance']: 
 *	  			filters['cfields']: 
 *	  			filters['tcase_name']: 
 *
 * 
 * @return array map with view (test cases subtree)
 * 
 * @internal revisions
 * 20101024 - franciscom - BUGID 3932: Add test case to test plan - Execution type filter does not affect right pane
 *						   BUGID 3936: Assign Test Case Execution - Right pane does not reflect custom field filter.
 *
 * 20100417 - franciscom - BUGID 2498 - added logic to filter by importance (defined on test case spec)
 * 20100411 - franciscom - added logic to filter by execution type
 */
function getTestSpecFromNode(&$dbHandler, &$tcaseMgr, &$linkedItems, $masterContainerId, $nodeId, $specViewType, $filters)
{
    $applyFilters = false;
    $testCaseSet = null;
    $tck_map = null;
    $tobj_mgr = new testproject($dbHandler);
    $test_spec = $tobj_mgr->get_subtree($nodeId);
    $key2loop = null;
    $useAllowed = false;
    // 20100411 - BUGID 2797 - filter by test case execution type
    $nullCheckFilter = array('tcase_id' => false, 'importance' => false, 'tcase_name' => false, 'cfields' => false);
    $zeroNullCheckFilter = array('execution_type' => false);
    $useFilter = array('keyword_id' => false) + $nullCheckFilter + $zeroNullCheckFilter;
    foreach ($nullCheckFilter as $key => $value) {
        $useFilter[$key] = !is_null($filters[$key]);
        $applyFilters = $applyFilters || $useFilter[$key];
    }
    foreach ($zeroNullCheckFilter as $key => $value) {
        // need to check for > 0, because for some items 0 has same meaning that null -> no filter
        $useFilter[$key] = !is_null($filters[$key]) && $filters[$key] > 0;
        $applyFilters = $applyFilters || $useFilter[$key];
    }
    if ($useFilter['tcase_id']) {
        $testCaseSet = is_array($filters['tcase_id']) ? $filters['tcase_id'] : array($filters['tcase_id']);
    }
    // BUGID 3768
    if (!is_array($filters['keyword_id'])) {
        $filters['keyword_id'] = array($filters['keyword_id']);
    }
    if ($useFilter['keyword_id'] = $filters['keyword_id'][0] > 0) {
        $applyFilters = true;
        switch ($specViewType) {
            case 'testplan':
                $tobj_mgr = new testplan($dbHandler);
                break;
        }
        $tck_map = $tobj_mgr->get_keywords_tcases($masterContainerId, $filters['keyword_id']);
    }
    if ($applyFilters) {
        $key2loop = array_keys($test_spec);
        // first step: generate list of TEST CASE NODES
        $itemSet = null;
        foreach ($key2loop as $key) {
            if ($test_spec[$key]['node_type_id'] == $filters['tcase_node_type_id']) {
                $itemSet[$test_spec[$key]['id']] = $key;
            }
        }
        $itemKeys = $itemSet;
        foreach ($itemKeys as $key => $tspecKey) {
            // 20101209 - asimon - exchanged strpos by stripos to make search case insensitive
            if ($useFilter['keyword_id'] && !isset($tck_map[$test_spec[$tspecKey]['id']]) || $useFilter['tcase_id'] && !in_array($test_spec[$tspecKey]['id'], $testCaseSet) || $useFilter['tcase_name'] && stripos($test_spec[$tspecKey]['name'], $filters['tcase_name']) === false) {
                $test_spec[$tspecKey] = null;
                unset($itemSet[$key]);
            }
        }
        if (count($itemSet) > 0 && ($useFilter['execution_type'] || $useFilter['importance'] || $useFilter['cfields'])) {
            $targetSet = array_keys($itemSet);
            $options = $specViewType == 'testPlanLinking' ? array('access_key' => 'testcase_id') : null;
            // BUGID 3889: Add Test Cases to Test plan - Right pane does not honor custom field filter
            $getFilters = $useFilter['cfields'] ? array('cfields' => $filters['cfields']) : null;
//.........这里部分代码省略.........
开发者ID:moraesmv,项目名称:testlink-code,代码行数:101,代码来源:specview.php

示例6: getTestSuite

 /**
  * Returns all test suites inside target 
  * test project with target name
  *
  * @param
  * @param struct $args
  * @param string $args["devKey"]
  * @param int $args["testsuitename"]
  * @param string $args["prefix"]
  * @return mixed $resultInfo
  * 
  * @access public
  */
 public function getTestSuite($args)
 {
     $ope = __FUNCTION__;
     $msg_prefix = "({$ope}) - ";
     $this->_setArgs($args);
     $status_ok = $this->_runChecks(array('authenticate'), $msg_prefix);
     if ($status_ok) {
         // Check for mandatory parameters
         $k2s = array(self::$testSuiteNameParamName, self::$prefixParamName);
         foreach ($k2s as $target) {
             $ok = $this->_isParamPresent($target, $msg_prefix, self::SET_ERROR);
             $status_ok = $status_ok && $ok;
         }
     }
     if ($status_ok) {
         // optionals
         //$details='simple';
         //$k2s=self::$detailsParamName;
         //if( $this->_isParamPresent($k2s) )
         //{
         //  $details = $this->args[$k2s];
         //}
     }
     if ($status_ok) {
         $tprojectMgr = new testproject($this->dbObj);
         $pfx = $this->args[self::$prefixParamName];
         $tproj = $tprojectMgr->get_by_prefix($pfx);
         if (is_null($tproj)) {
             $status_ok = false;
             $msg = $msg_prefix . sprintf(TPROJECT_PREFIX_DOESNOT_EXIST_STR, $pfx);
             $this->errors[] = new IXR_Error(TPROJECT_PREFIX_DOESNOT_EXIST, $msg);
         } else {
             $ctx[self::$testProjectIDParamName] = $dummy['id'];
         }
     }
     if ($status_ok && $this->userHasRight("mgt_view_tc", self::CHECK_PUBLIC_PRIVATE_ATTR, $ctx)) {
         $opt = array('recursive' => false, 'exclude_testcases' => true);
         // $target = $this->dbObj->prepare_string($tg);
         // $filters['additionalWhereClause'] =
         // " AND name = '{$target}' ";
         $filters = null;
         $items = $tprojectMgr->get_subtree($tproj['id'], $filters, $opt);
         $ni = array();
         if (!is_null($items) && ($l2d = count($items)) > 0) {
             $tg = $this->args[self::$testSuiteNameParamName];
             for ($ydx = 0; $ydx <= $l2d; $ydx++) {
                 if (strcmp($items[$ydx]['name'], $tg) == 0) {
                     unset($items[$ydx]['tcversion_id']);
                     $ni[] = $items[$ydx];
                 }
             }
         } else {
             $ni = $items;
         }
     }
     return $status_ok ? $ni : $this->errors;
 }
开发者ID:mweyamutsvene,项目名称:testlink,代码行数:70,代码来源:xmlrpc.class.php


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