bootstrap.php 935 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. declare(strict_types=1);
  3. if (!defined('IS_SCF')) {
  4. define('IS_SCF', false);
  5. }
  6. if (!defined('IS_CLI')) {
  7. define('IS_CLI', true);
  8. }
  9. if (!defined('DS')) {
  10. define('DS', DIRECTORY_SEPARATOR);
  11. }
  12. if (!defined('ROOT_PATH')) {
  13. define('ROOT_PATH', dirname(__DIR__));
  14. }
  15. if (!defined('VENDOR_PATH')) {
  16. define('VENDOR_PATH', ROOT_PATH . DS . 'vendor');
  17. }
  18. if (!defined('APP_PATH')) {
  19. define('APP_PATH', ROOT_PATH . DS . 'app');
  20. }
  21. if (!defined('DATA_PATH')) {
  22. define('DATA_PATH', ROOT_PATH . DS . 'tests' . DS . 'runtime' . DS . 'data');
  23. }
  24. if (!defined('RESOURCES_PATH')) {
  25. define('RESOURCES_PATH', ROOT_PATH . DS . 'resources');
  26. }
  27. date_default_timezone_set('Asia/Shanghai');
  28. $runtimeDirs = [
  29. ROOT_PATH . DS . 'tests' . DS . 'runtime',
  30. DATA_PATH,
  31. ];
  32. foreach ($runtimeDirs as $dir) {
  33. if (!is_dir($dir)) {
  34. mkdir($dir, 0777, true);
  35. }
  36. }
  37. require VENDOR_PATH . DS . 'autoload.php';