zhamao-framework/tests/bootstrap.php

28 lines
880 B
PHP
Raw Normal View History

2021-06-16 00:17:30 +08:00
<?php
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;
2022-03-28 17:27:36 +08:00
require_once __DIR__ . '/../vendor/autoload.php';
2021-06-16 00:17:30 +08:00
// 模拟define
2021-09-10 11:24:32 +08:00
chdir(__DIR__ . '/../');
2022-03-28 17:27:36 +08:00
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__) . '/');
2021-09-10 11:24:32 +08:00
2022-03-28 17:27:36 +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");
2021-09-10 11:24:32 +08:00
}
LightCacheInside::init();
ZMAtomic::init();
Terminal::init();
Console::setLevel(4);