ThinkAdmin/tests/bootstrap.php
Anyon 4e2b7ab2fc test(quality): 增加 v8 回归测试与静态分析配置
补齐 v8 分支的自动化质量保障,使插件化迁移、发布安装和架构边界都能在目标仓库内验证。

主要内容:

- 新增 PHPUnit 配置和 smoke 测试,覆盖发布、安装与 think 命令加载。

- 新增根级 tests 用例,验证路由、构建器、插件边界和业务集成行为。

- 新增 PHPStan 配置与运行时 stub,避免 Composer 插件环境误报。

- 保留旧包、旧 View 和旧 helper 命名空间的防回归检查。
2026-05-08 15:31:09 +08:00

70 lines
3.4 KiB
PHP

<?php
declare(strict_types=1);
/**
* +----------------------------------------------------------------------
* | ThinkAdmin Plugin for ThinkAdminDeveloper
* +----------------------------------------------------------------------
* | Copyright (c) 2014~2026 ThinkAdmin [ thinkadmin.top ]
* +----------------------------------------------------------------------
* | Official Website: https://thinkadmin.top
* +----------------------------------------------------------------------
* | Licensed: https://mit-license.org
* | Disclaimer: https://thinkadmin.top/disclaimer
* | Vip Rights: https://thinkadmin.top/vip-introduce
* +----------------------------------------------------------------------
* | Gitee Repository: https://gitee.com/zoujingli/ThinkAdmin
* | Github Repository: https://github.com/zoujingli/ThinkAdmin
* +----------------------------------------------------------------------
*/
use think\Model;
/**
* +----------------------------------------------------------------------
* | ThinkAdmin Plugin for ThinkAdminDeveloper
* +----------------------------------------------------------------------
* | Copyright (c) 2014~2026 ThinkAdmin [ thinkadmin.top ]
* +----------------------------------------------------------------------
* | Official Website: https://thinkadmin.top
* +----------------------------------------------------------------------
* | Licensed: https://mit-license.org
* | Disclaimer: https://thinkadmin.top/disclaimer
* | Vip Rights: https://thinkadmin.top/vip-introduce
* +----------------------------------------------------------------------
* | Gitee Repository: https://gitee.com/zoujingli/ThinkAdmin
* | Github Repository: https://github.com/zoujingli/ThinkAdmin
* +----------------------------------------------------------------------.
*/
$projectRoot = dirname(__DIR__);
require $projectRoot . '/vendor/autoload.php';
require $projectRoot . '/vendor/topthink/framework/src/helper.php';
require $projectRoot . '/tests/support/TestSystemContext.php';
require $projectRoot . '/tests/support/SqliteIntegrationTestCase.php';
if (!class_exists(\plugin\install\command\project\InstallCommand::class, false)) {
require_once $projectRoot . '/plugin/think-plugs-install/src/command/project/InstallCommand.php';
}
defined('TEST_PROJECT_ROOT') || define('TEST_PROJECT_ROOT', $projectRoot);
defined('HELPER_TEST_PACKAGE_ROOT') || define('HELPER_TEST_PACKAGE_ROOT', $projectRoot . '/plugin/think-plugs-system/src/helper');
defined('HELPER_TEST_PROJECT_ROOT') || define('HELPER_TEST_PROJECT_ROOT', $projectRoot);
defined('INSTALL_TEST_PACKAGE_ROOT') || define('INSTALL_TEST_PACKAGE_ROOT', $projectRoot . '/plugin/think-plugs-install');
defined('INSTALL_TEST_PROJECT_ROOT') || define('INSTALL_TEST_PROJECT_ROOT', $projectRoot);
defined('SYSTEM_TEST_PACKAGE_ROOT') || define('SYSTEM_TEST_PACKAGE_ROOT', $projectRoot . '/plugin/think-plugs-system');
defined('SYSTEM_TEST_PROJECT_ROOT') || define('SYSTEM_TEST_PROJECT_ROOT', $projectRoot);
defined('WORKER_TEST_PACKAGE_ROOT') || define('WORKER_TEST_PACKAGE_ROOT', $projectRoot . '/plugin/think-plugs-worker');
defined('WORKER_TEST_PROJECT_ROOT') || define('WORKER_TEST_PROJECT_ROOT', $projectRoot);
if (!function_exists('test_reset_model_makers')) {
function test_reset_model_makers(): void
{
$reflection = new ReflectionProperty(Model::class, '_maker');
$reflection->setAccessible(true);
$reflection->setValue([]);
}
}