From f3400313b8e44220f936c452bcdedc3e5a14fbaa Mon Sep 17 00:00:00 2001 From: liugang Date: Thu, 18 Sep 2025 10:24:08 +0800 Subject: [PATCH 1/2] * [misc] Define unit test class file of zen. --- .claude/rules/zentao-unit-test-guide.md | 34 +++++++++++++------------ 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/.claude/rules/zentao-unit-test-guide.md b/.claude/rules/zentao-unit-test-guide.md index 86817e93d8..06d72a5fcb 100644 --- a/.claude/rules/zentao-unit-test-guide.md +++ b/.claude/rules/zentao-unit-test-guide.md @@ -76,21 +76,22 @@ r($userTest->getByIdTest('abc')) && p() && e(false); // 测试步骤5 ``` module/{moduleName}/test/ -├── lib/ # 测试类库 -│ └── {moduleName}.unittest.class.php # 单元测试类 -├── model/ # Model层单元测试 -│ ├── {methodName}.php # 测试执行脚本 -│ └── yaml/ # 测试数据目录 -│ │ ├── {tableName}_{methodName}.yaml # YAML测试数据 -├── tao/ # TAO层业务逻辑测试 -│ ├── {methodName}.php # 测试执行脚本 -│ └── yaml/ # 测试数据目录 -│ │ ├── {tableName}_{methodName}.yaml # YAML测试数据 -├── zen/ # ZEN层新架构测试 -│ ├── {methodName}.php # 测试执行脚本 -│ └── yaml/ # 测试数据目录 -│ │ ├── {tableName}_{methodName}.yaml # YAML测试数据 -└── ui/ # UI自动化测试(独立文档) +├── lib/ # 测试类库 +│ └── {moduleName}.unittest.class.php # model层和tao层单元测试类 +│ └── {moduleName}zen.unittest.class.php # zen层单元测试类 +├── model/ # model层单元测试 +│ ├── {methodName}.php # 测试执行脚本 +│ └── yaml/ # 测试数据目录 +│ │ ├── {tableName}_{methodName}.yaml # YAML测试数据 +├── tao/ # tao层业务逻辑测试 +│ ├── {methodName}.php # 测试执行脚本 +│ └── yaml/ # 测试数据目录 +│ │ ├── {tableName}_{methodName}.yaml # YAML测试数据 +├── zen/ # zen层新架构测试 +│ ├── {methodName}.php # 测试执行脚本 +│ └── yaml/ # 测试数据目录 +│ │ ├── {tableName}_{methodName}.yaml # YAML测试数据 +└── ui/ # UI自动化测试(独立文档) ``` ## 核心文件类型详解 @@ -136,7 +137,7 @@ cid=0 // 1. 导入依赖(路径固定,不可修改) include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/{moduleName}.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/{moduleName}.unittest.class.php'; // 或 include dirname(__FILE__, 2) . '/lib/{moduleName}zen.unittest.class.php'; 根据测试需要 // 2. zendata数据准备(根据需要配置) $table = zenData('{tableName}'); @@ -491,6 +492,7 @@ test/runtime/ztf module/{moduleName}/test/{layerName}/{methodName}.php ```bash git add module/{moduleName}/test/lib/{moduleName}.unittest.class.php + git add module/{moduleName}/test/lib/{moduleName}zen.unittest.class.php git add module/{moduleName}/test/{layerName}/{methodName}.php git add module/{moduleName}/test/{layerName}/yaml/{tableName}_{methodName}.yaml ``` From 81a4527433f360e9d87a9ee9f167735562b8392e Mon Sep 17 00:00:00 2001 From: liugang Date: Thu, 18 Sep 2025 10:33:05 +0800 Subject: [PATCH 2/2] * [misc] Add .editorconfig to unify coding style. --- .editorconfig | 39 +++++++++++++++++++++++++++++++++++++++ .gitignore | 1 - 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..854e20aeca --- /dev/null +++ b/.editorconfig @@ -0,0 +1,39 @@ +# 顶级 EditorConfig 文件 +root = true + +[*] +# 缩进风格:空格或制表符 +indent_style = space + +# 缩进大小 +indent_size = 4 + +# 行结束符:lf, cr, crlf +end_of_line = lf + +# 字符编码 +charset = utf-8 + +# 是否删除行尾空白字符 +trim_trailing_whitespace = true + +# 是否在文件末尾插入空行 +insert_final_newline = true + +# 最大行长度(关闭此规则) +max_line_length = off + +# 制表符宽度(当 indent_style = tab 时) +tab_width = 4 + +# 为 Markdown 文件保留尾部空格(用于换行) +[*.md] +trim_trailing_whitespace = false + +# 为 YAML 文件使用 2 空格缩进 +[*.{yml,yaml}] +indent_size = 2 + +# 为 Makefile 使用制表符(必须) +[Makefile] +indent_style = tab diff --git a/.gitignore b/.gitignore index 8306902ab4..1b2d9f4c54 100644 --- a/.gitignore +++ b/.gitignore @@ -29,7 +29,6 @@ vendor/ docker .docker-sync composer.lock -.editorconfig CodeSniffer.conf test/runtime test/runtime/*