zhamao-framework/test/bootstrap.php

31 lines
891 B
PHP
Raw Normal View History

2021-06-16 00:17:30 +08:00
<?php
/**
* @since 2.5
*/
2021-09-10 11:24:32 +08:00
use ZM\Config\ZMConfig;
use ZM\Console\Console;
use ZM\Store\LightCacheInside;
use ZM\Store\ZMAtomic;
use ZM\Utils\DataProvider;
use ZM\Utils\Terminal;
2021-06-16 00:17:30 +08:00
set_coroutine_params([]);
// 模拟define
2021-09-10 11:24:32 +08:00
chdir(__DIR__ . '/../');
2021-06-16 00:17:30 +08:00
define("WORKING_DIR", getcwd());
define("SOURCE_ROOT_DIR", WORKING_DIR);
2021-09-10 11:24:32 +08:00
define("ZM_DATA", WORKING_DIR . "/zm_data/");
2021-06-16 00:17:30 +08:00
define("LOAD_MODE", 0);
define("FRAMEWORK_ROOT_DIR", realpath(__DIR__ . "/../"));
2021-09-10 11:24:32 +08:00
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();
Terminal::init();
Console::setLevel(4);