예제 #1
0
 /**
  * 测试执行入口
  */
 public function runTest()
 {
     if (!\HuiLib\App\Request\RequestBase::isCli() && (APP_ENV == \HuiLib\Bootstrap::ENV_PRODUCTION || APP_ENV == \HuiLib\Bootstrap::ENV_STAGING)) {
         exit('not support.');
     }
     //bin运行
     if (RUN_METHOD == \HuiLib\Bootstrap::RUN_BIN) {
         if (!empty($_SERVER['argv'][1])) {
             $class = trim($_SERVER['argv'][1]);
         } else {
             exit('empty bin param.');
         }
         echo 'RUN_EVN:' . APP_ENV . PHP_EOL;
     } else {
         //web运行
         $queryString = \HuiLib\Helper\Param::getQueryString();
         parse_str($queryString, $info);
         if (empty($info)) {
             exit('empty web param.');
         }
         //获取类名
         $class = key($info);
     }
     //初始化测试库
     $instance = $class::getInstance();
     //执行
     $instance->run();
 }
예제 #2
0
 /**
  * 是否通过命令行访问
  * @return boolean
  */
 protected function isCli()
 {
     return \HuiLib\App\Request\RequestBase::isCli();
 }
예제 #3
0
 /**
  * 获取Adapter对象
  * 
  * @param string $platform
  * @param array $config 全局connect配置
  * @return OpenConnectBase
  */
 public static function getAdapter($platform, $config)
 {
     $class = '\\HuiLib\\OpenConnect\\Platform\\' . RequestBase::mapRouteSegToClass($platform);
     try {
         $adapter = new $class();
         $adapter->config = $config;
         return $adapter;
     } catch (AutoLoaderException $e) {
         return NULL;
     }
 }