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


PHP testcase::get_by_name方法代碼示例

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


在下文中一共展示了testcase::get_by_name方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getTestCaseIDByName

 /**
  * Find a test case by its name
  * 
  * <b>Searching is case sensitive.</b> The test case will only be returned if there is a definite match.
  * If possible also pass the string for the test suite name. 
  *
  * No results will be returned if there are test cases with the same name that match the criteria provided.  
  * 
  * @param struct $args
  * @param string $args["devKey"]
  * @param string $args["testcasename"]
  * @param string $args["testsuitename"] - optional
  * @param string $args["testprojectname"] - optional
  * @param string $args["testcasepathname"] - optional
  *               Full test case path name, starts with test project name
  *               pieces separator -> :: -> default value of getByPathName()
  * @return mixed $resultInfo
  */
 public function getTestCaseIDByName($args)
 {
     $msg_prefix = "(" . __FUNCTION__ . ") - ";
     $status_ok = true;
     $this->_setArgs($args);
     $result = null;
     $checkFunctions = array('authenticate', 'checkTestCaseName');
     $status_ok = $this->_runChecks($checkFunctions, $msg_prefix);
     if ($status_ok) {
         $testCaseName = $this->args[self::$testCaseNameParamName];
         $testCaseMgr = new testcase($this->dbObj);
         $keys2check = array(self::$testSuiteNameParamName, self::$testCasePathNameParamName, self::$testProjectNameParamName);
         foreach ($keys2check as $key) {
             $optional[$key] = $this->_isParamPresent($key) ? trim($this->args[$key]) : '';
         }
         if ($optional[self::$testCasePathNameParamName] != '') {
             $dummy = $testCaseMgr->getByPathName($optional[self::$testCasePathNameParamName]);
             if (!is_null($dummy)) {
                 $result[0] = $dummy;
             }
         } else {
             $result = $testCaseMgr->get_by_name($testCaseName, $optional[self::$testSuiteNameParamName], $optional[self::$testProjectNameParamName]);
         }
         $match_count = count($result);
         switch ($match_count) {
             case 0:
                 $status_ok = false;
                 $this->errors[] = new IXR_ERROR(NO_TESTCASE_BY_THIS_NAME, $msg_prefix . NO_TESTCASE_BY_THIS_NAME_STR);
                 break;
             case 1:
                 $status_ok = true;
                 break;
             default:
                 // multiple matches.
                 $status_ok = true;
                 break;
         }
     }
     // $this->userHasRight("mgt_view_tc",self::CHECK_PUBLIC_PRIVATE_ATTR);
     // if we have multiple matches, we have issues to check test project access for user
     // requesting operation.
     // what to do ?
     // check access for each result and remove result if user has no access to corresponding
     // test project.
     if ($status_ok) {
         $out = null;
         foreach ($result as $testcase) {
             $this->args[self::$testProjectIDParamName] = $this->tcaseMgr->get_testproject($testcase['id']);
             if ($this->userHasRight("mgt_view_tc", self::CHECK_PUBLIC_PRIVATE_ATTR)) {
                 $out[] = $testcase;
             }
         }
     }
     return $status_ok ? $out : $this->errors;
 }
開發者ID:JacekKarwas,項目名稱:smutek,代碼行數:73,代碼來源:xmlrpc.class.php

示例2: getTestCaseIDByName

 /**
  * Find a test case by its name
  * 
  * <b>Searching is case sensitive.</b> The test case will only be returned if there is a definite match.
  * If possible also pass the string for the test suite name. 
  *
  * No results will be returned if there are test cases with the same name that match the criteria provided.  
  * 
  * @param struct $args
  * @param string $args["devKey"]
  * @param string $args["testcasename"]
  * @param string $args["testsuitename"] - optional
  * @param string $args["testprojectname"] - optional
  * @param string $args["testcasepathname"] - optional
  *               Full test case path name, starts with test project name
  *               pieces separator -> :: -> default value of getByPathName()
  * @return mixed $resultInfo
  */
 public function getTestCaseIDByName($args)
 {
     $msg_prefix = "(" . __FUNCTION__ . ") - ";
     $status_ok = true;
     $this->_setArgs($args);
     $result = null;
     $checkFunctions = array('authenticate', 'checkTestCaseName');
     $status_ok = $this->_runChecks($checkFunctions, $msg_prefix) && $this->userHasRight("mgt_view_tc");
     if ($status_ok) {
         $testCaseName = $this->args[self::$testCaseNameParamName];
         $testCaseMgr = new testcase($this->dbObj);
         $keys2check = array(self::$testSuiteNameParamName, self::$testCasePathNameParamName, self::$testProjectNameParamName);
         foreach ($keys2check as $key) {
             $optional[$key] = $this->_isParamPresent($key) ? trim($this->args[$key]) : '';
         }
         // 20091128 - franciscom
         if ($optional[self::$testCasePathNameParamName] != '') {
             $dummy = $testCaseMgr->getByPathName($optional[self::$testCasePathNameParamName]);
             if (!is_null($dummy)) {
                 $result[0] = $dummy;
             }
         } else {
             $result = $testCaseMgr->get_by_name($testCaseName, $optional[self::$testSuiteNameParamName], $optional[self::$testProjectNameParamName]);
         }
         if (0 == sizeof($result)) {
             $status_ok = false;
             $this->errors[] = new IXR_ERROR(NO_TESTCASE_BY_THIS_NAME, $msg_prefix . NO_TESTCASE_BY_THIS_NAME_STR);
             return $this->errors;
         }
     }
     return $status_ok ? $result : $this->errors;
 }
開發者ID:viglesiasce,項目名稱:tl_RC1,代碼行數:50,代碼來源:xmlrpc.class.php


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