shopware-phpunit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Shopware 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

按优先级划分的规则类别

PriorityCategoryPrefixDescription
CRITICALTest Setup
setup-
Kernel bootstrap, base test classes, PHPUnit configuration
HIGHIntegration Testing
integration-
Repository tests, service tests, database transactions
HIGHAPI Testing
api-
Store API and Admin API endpoint testing
MEDIUMMocking
mock-
Service mocking, dependency injection in tests
MEDIUMData
data-
Test data creation, fixtures, cleanup
LOWPerformance
perf-
Test execution speed, parallel testing
优先级类别前缀描述
关键测试设置
setup-
内核启动、基础测试类、PHPUnit配置
集成测试
integration-
仓库测试、服务测试、数据库事务
API测试
api-
Store API和Admin API端点测试
模拟
mock-
服务模拟、测试中的依赖注入
数据
data-
测试数据创建、测试夹具、清理
性能
perf-
测试执行速度、并行测试

How to Use

使用方法

Read relevant reference files from the
references/
directory based on the task at hand. Files are prefixed by category for easy discovery.
根据手头的任务,从
references/
目录中读取相关的参考文件。文件按类别加前缀,便于查找。

External References

外部参考