Exemple #1
0
<?php

if (!defined('DA_INIT')) {
    // 防止重复初始化
    define("DA_INIT", 1);
    // 版本检查
    if (PHP_VERSION_ID < 50400) {
        exit("Need PHP-5.4.0 or upper." . PHP_EOL);
    }
    ini_set('memory_limit', '30G');
    define('DA_PATH_INIT_FILE', dirname(__FILE__));
    define('DA_PATH_HOME', dirname(DA_PATH_INIT_FILE));
    define('DA_PATH_SYS', DA_PATH_INIT_FILE . '/sys');
    // functions
    require_once DA_PATH_SYS . '/function.php';
    // start app
    require_once DA_PATH_SYS . '/app.php';
    Da\Sys_App::app(DA_PATH_HOME . '/conf/app.ini')->bootstrap();
    file_exists(DA_PATH_INIT_FILE . '/extra.php') && (require_once DA_PATH_INIT_FILE . '/extra.php');
    Lib_Log::DEBUG('Framework(v' . DA_VERSION . ') init ok');
}
// end of if DA_LIB_INIT
Exemple #2
0
 /**
  * @param array $module_data
  * @return array
  */
 private function _get_same_fields_of_other_module($module_data)
 {
     $other_module_fields = [];
     $interface_info = $this->_interface_info[$this->_current_flow_id];
     $flow_modules = $interface_info[self::IIK_FLOW_MODULES];
     foreach ($module_data as $_field_name => $_module_name) {
         //查看此次会不会有这个module载入,有则跳过,没有则取出来
         if (in_array($_module_name, $flow_modules)) {
             Lib_Log::DEBUG('Module %s would be loaded', $_module_name);
             continue;
         } else {
             $fields = $this->get_registered_fields();
             if (!isset($fields[$_module_name])) {
                 Lib_Log::WARN('No such module: %s', [$_module_name]);
                 continue;
             }
             if (!isset($fields[$_module_name][Const_Interface::FIELDS_KEY_FIELDS])) {
                 Lib_Log::WARN('No such fields in module: [%s]', [$_module_name]);
                 continue;
             }
             $values_in_field = $fields[$_module_name][Const_Interface::FIELDS_KEY_FIELDS];
             if (!isset($values_in_field[$_field_name])) {
                 Lib_Log::WARN('No such field [%s] in module: [%s]', [$_field_name, $_module_name]);
                 continue;
             }
             $field_data = $values_in_field[$_field_name];
             $other_module_fields[] = self::_format_field($_module_name, $_field_name, $field_data);
         }
     }
     return $other_module_fields;
 }
Exemple #3
0
<?php

if (!defined('DA_UT_PATH')) {
    define('DA_UT_PATH', dirname(__FILE__));
    define('DA_UT_DATA_PATH', DA_UT_PATH . '/data');
    // 版本检查
    if (PHP_VERSION_ID < 50400) {
        exit("Need PHP-5.4.0 or upper." . PHP_EOL);
    }
    ini_set('memory_limit', '10240M');
    //require_once 'PHPUnit/Autoload.php';
    // start app
    defined('DA_PATH_HOME') || define('DA_PATH_HOME', dirname(dirname(DA_UT_PATH)));
    // functions
    if (DA_PATH_HOME) {
        $app = DA_PATH_HOME . '/app/sys/app.php';
        $conf = DA_PATH_HOME . '/conf/unit.ini';
        require_once $app;
        require_once DA_PATH_HOME . '/app/sys/function.php';
        Da\Sys_App::app($conf)->bootstrap();
        Lib_Log::DEBUG('Unit test init ok');
    } else {
        throw new Exception('UT: wrong path.');
    }
    require_once DA_UT_PATH . '/helper.php';
}
// end of if DA_UT_INIT