25c9002cbe
- Gitea Actions 配置 (.gitea/workflows/ci.yml) - PHPUnit 测试框架 (composer.json, phpunit.xml) - 示例测试用例 (tests/Unit, tests/Feature) - .gitignore 配置 流程说明: 1. feature/* 分支 push → 部署测试环境 → 运行测试 2. 测试失败 → 自动回退 + 通知 3. 测试通过 → 自动合并到 main → 部署正式环境 4. main 分支 push → 直接部署正式环境 需要配置 Secrets: - DEPLOY_KEY: SSH 私钥 - GITEA_TOKEN: 用于自动合并的 Token
19 lines
414 B
PHP
19 lines
414 B
PHP
<?php
|
|
/**
|
|
* PHPUnit bootstrap file
|
|
*/
|
|
|
|
// 定义测试环境常量
|
|
define('TESTING', true);
|
|
|
|
// 加载配置(测试环境)
|
|
if (file_exists(__DIR__ . '/../config.php')) {
|
|
// 可以创建一个测试用的 config.test.php
|
|
// require_once __DIR__ . '/../config.test.php';
|
|
}
|
|
|
|
// 自动加载
|
|
if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
|
|
require_once __DIR__ . '/../vendor/autoload.php';
|
|
}
|