本文整理汇总了PHP中testplan::get_keywords_tcases方法的典型用法代码示例。如果您正苦于以下问题:PHP testplan::get_keywords_tcases方法的具体用法?PHP testplan::get_keywords_tcases怎么用?PHP testplan::get_keywords_tcases使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testplan
的用法示例。
在下文中一共展示了testplan::get_keywords_tcases方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
* 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;
//.........这里部分代码省略.........
示例2: 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];
}
}
//.........这里部分代码省略.........
示例3: 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;
//.........这里部分代码省略.........