WeChatDeveloper/tests/bootstrap.php
Anyon cdf868deec style(header): 统一核心契约缓存和测试文件格式
- 按 PHP-CS-Fixer 规则补齐核心契约、异常、缓存和 XML 工具文件头。

- 规范导入、PHPDoc 类型顺序与注释格式,保持项目头信息不丢失。

- 同步整理缓存键、缓存实现、XML 编解码相关测试和 bootstrap 格式。
2026-05-08 11:33:26 +08:00

33 lines
930 B
PHP

<?php
declare(strict_types=1);
/**
* This file is part of HyperfAdmin.
*
* @Link https://thinkadmin.top
* @Author Anyon<zoujingli@qq.com>
*/
$autoloadCandidates = [
dirname(__DIR__) . '/vendor/autoload.php',
dirname(__DIR__, 2) . '/vendor/autoload.php',
dirname(__DIR__, 3) . '/vendor/autoload.php',
];
foreach ($autoloadCandidates as $autoloadFile) {
if (is_file($autoloadFile)) {
require $autoloadFile;
spl_autoload_register(static function (string $class): void {
$prefix = 'We\\';
if (str_starts_with($class, $prefix)) {
$path = dirname(__DIR__) . '/src/' . str_replace('\\', '/', substr($class, strlen($prefix))) . '.php';
if (is_file($path)) {
require $path;
}
}
});
return;
}
}
throw new RuntimeException('Cannot locate Composer autoload.php for We tests.');