shopware-phpunit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseShopware PHPUnit Best Practices
Shopware PHPUnit 最佳实践
When to Apply
适用场景
- Writing new PHPUnit tests for a Shopware 6 plugin or app
- Setting up test infrastructure for a Shopware project
- Testing repositories, services, commands, or event subscribers
- Writing integration tests that require the Shopware kernel
- Testing Storefront controllers or Store API / Admin API routes
- Debugging failing tests in a Shopware context
- 为Shopware 6插件或应用编写新的PHPUnit测试
- 为Shopware项目搭建测试基础设施
- 测试仓库、服务、命令或事件订阅器
- 编写需要Shopware内核的集成测试
- 测试Storefront控制器或Store API / Admin API路由
- 在Shopware环境中调试失败的测试
Rule Categories by Priority
按优先级划分的规则类别
| Priority | Category | Prefix | Description |
|---|---|---|---|
| CRITICAL | Test Setup | | Kernel bootstrap, base test classes, PHPUnit configuration |
| HIGH | Integration Testing | | Repository tests, service tests, database transactions |
| HIGH | API Testing | | Store API and Admin API endpoint testing |
| MEDIUM | Mocking | | Service mocking, dependency injection in tests |
| MEDIUM | Data | | Test data creation, fixtures, cleanup |
| LOW | Performance | | Test execution speed, parallel testing |
| 优先级 | 类别 | 前缀 | 描述 |
|---|---|---|---|
| 关键 | 测试设置 | | 内核启动、基础测试类、PHPUnit配置 |
| 高 | 集成测试 | | 仓库测试、服务测试、数据库事务 |
| 高 | API测试 | | Store API和Admin API端点测试 |
| 中 | 模拟 | | 服务模拟、测试中的依赖注入 |
| 中 | 数据 | | 测试数据创建、测试夹具、清理 |
| 低 | 性能 | | 测试执行速度、并行测试 |
How to Use
使用方法
Read relevant reference files from the directory based on the task at hand. Files are prefixed by category for easy discovery.
references/根据手头的任务,从目录中读取相关的参考文件。文件按类别加前缀,便于查找。
references/