chore: 添加缺失的静态资源文件

添加多个前端界面所需的图片、字体、音频等静态资源文件,包括:
- 管理员后台的图标、背景图、组件图片
- 移动端页面的商品图片、用户中心图片、活动图标
- 第三方库的示例图片和字体文件
- 浏览器兼容性配置文件
- 图标字体文件(eot、ttf、woff、woff2格式)

这些资源是前端界面正常显示所必需的,之前可能因版本控制忽略或遗漏而缺失。
This commit is contained in:
2026-03-06 20:15:52 +08:00
parent c9a98f342c
commit 0060b2798f
7739 changed files with 1314791 additions and 0 deletions

View File

@@ -0,0 +1,87 @@
<?php
declare(strict_types=1);
namespace tests;
use PHPUnit\Framework\TestCase;
abstract class Base extends TestCase {
static $ROOT_PATH = __DIR__ . "/../vendor/topthink/think";
static $RUNTIME_PATH = __DIR__ . "/../runtime/";
protected $app;
protected $throttle_config = [];
protected $middleware_file = __DIR__ . "/config/global-middleware.php";
protected $middleware_type = 'global';
/**
* thinkphp 一般运行在 php-fpm 模式下,每次处理请求都要重新加载配置文件
* @param \think\Request $request
* @return \think\Response
*/
function get_response(\think\Request $request): \think\Response {
// 创建 \think\App 对象,设置配置
$app = new GCApp(static::$ROOT_PATH);
$app->setRuntimePath(static::$RUNTIME_PATH);
// 加载中间件
$app->middleware->import(include $this->middleware_file, $this->middleware_type);
// 设置 throttle 配置
$app->config->set($this->throttle_config, 'throttle');
$response = $app->http->run($request);
$app->refClear();
return $response;
}
protected function tearDown(): void
{
parent::tearDown();
// 每次测试完毕都需要清理 runtime cache 目录,避免影响其他单元测试
$cache_dir = static::$RUNTIME_PATH . "cache";
$dirs = glob($cache_dir . '/*', GLOB_ONLYDIR);
foreach ($dirs as $dir) {
$files = glob($dir . '/*.php');
foreach ($files as $file) {
unlink($file);
}
}
// 删除 cache 下的空目录
foreach ($dirs as $dir) {
rmdir($dir);
}
unset($cache_dir);
unset($dirs);
gc_collect_cycles(); // 进行垃圾回收
}
/**
* 获取默认的 throttle 基础配置信息
* @return array
*/
function get_default_throttle_config(): array {
static $config = []; // 默认配置从文件中读取,可以设置为静态变量
if (!$config) {
$config = include dirname(__DIR__) . "/src/config.php";
}
return $config;
}
/**
* 设置中间件配置文件
* @param string $file 文件的路径 eg: $this->app->getBasePath() . 'middleware.php'
* @param string $type 类型:global 全局;route 路由;controller 控制器
*/
function set_middleware(string $file, string $type = 'global') {
$this->middleware_file = $file;
$this->middleware_type = $type;
}
/**
* 设置 throttle 配置
* @param array $config
*/
function set_throttle_config(array $config) {
$this->throttle_config = $config;
}
}