refactor phpunit-swoole

This commit is contained in:
sunxyw
2022-03-28 17:27:36 +08:00
parent 6f5575b155
commit 4e9199c68e
4 changed files with 48 additions and 68 deletions

View File

@@ -1,7 +1,4 @@
<?php
/**
* @since 2.5
*/
use ZM\Config\ZMConfig;
use ZM\Console\Console;
@@ -10,20 +7,20 @@ use ZM\Store\ZMAtomic;
use ZM\Utils\DataProvider;
use ZM\Utils\Terminal;
set_coroutine_params([]);
require_once __DIR__ . '/../vendor/autoload.php';
// 模拟define
chdir(__DIR__ . '/../');
define("WORKING_DIR", getcwd());
define("SOURCE_ROOT_DIR", WORKING_DIR);
define("ZM_DATA", WORKING_DIR . "/zm_data/");
define("LOAD_MODE", 0);
define("FRAMEWORK_ROOT_DIR", realpath(__DIR__ . "/../"));
define('WORKING_DIR', getcwd());
const SOURCE_ROOT_DIR = WORKING_DIR;
const ZM_DATA = WORKING_DIR . '/zm_data/';
const LOAD_MODE = 0;
define('FRAMEWORK_ROOT_DIR', dirname(__DIR__) . '/');
ZMConfig::setDirectory(WORKING_DIR."/config/");
ZMConfig::setEnv("");
if (ZMConfig::get("global") === false) {
die (zm_internal_errcode("E00007") . "Global config load failed: " . ZMConfig::$last_error . "\nError path: " . DataProvider::getSourceRootDir() . "\nPlease init first!\nSee: https://github.com/zhamao-robot/zhamao-framework/issues/37\n");
ZMConfig::setDirectory(WORKING_DIR . '/config/');
ZMConfig::setEnv();
if (ZMConfig::get('global') === false) {
die (zm_internal_errcode('E00007') . 'Global config load failed: ' . ZMConfig::$last_error . "\nError path: " . DataProvider::getSourceRootDir() . "\nPlease init first!\nSee: https://github.com/zhamao-robot/zhamao-framework/issues/37\n");
}
LightCacheInside::init();
ZMAtomic::init();