testing
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTesting
测试
Instructions
说明
- All tests must be written using Pest.
- Tests use Pest PHP with Laravel plugin. Feature tests extend with RefreshDatabase trait available (commented out in
Tests\TestCaseby default).tests/Pest.php - Always start all work using TDD–write tests before writing any code.
- If you need to verify a feature is working, write or update a Unit / Feature test.
- You must not remove any tests or test files from the tests directory without approval. These are not temporary or helper files - these are core to the application.
- Tests should test all of the happy paths, failure paths, and weird paths.
- Tests live in the and
tests/Featuredirectories.tests/Unit
- 所有测试必须使用Pest编写。
- 测试使用带有Laravel插件的Pest PHP。功能测试继承,默认情况下
Tests\TestCase中注释掉的RefreshDatabase trait可用。tests/Pest.php - 所有工作必须从TDD开始——在编写任何代码之前先编写测试。
- 如果需要验证某个功能是否正常工作,请编写或更新单元/功能测试。
- 未经批准,不得从tests目录中删除任何测试或测试文件。这些不是临时文件或辅助文件——它们是应用程序的核心部分。
- 测试应覆盖所有正常流程、异常流程和边缘场景。
- 测试文件存放在和
tests/Feature目录中。tests/Unit
Running Tests
运行测试
- Run the minimal number of tests using an appropriate filter before finalizing code edits.
- To run all tests: .
php artisan test - To run all tests in a file: .
php artisan test tests/Feature/ExampleTest.php - To filter on a particular test name: (recommended after making a change to a related file).
php artisan test --filter=testName - When the tests relating to your changes are passing, ask the user if they would like to run the entire test suite to ensure everything is still passing.
- 在完成代码编辑前,使用合适的过滤器运行最少数量的测试。
- 运行所有测试:。
php artisan test - 运行单个文件中的所有测试:。
php artisan test tests/Feature/ExampleTest.php - 根据特定测试名称过滤运行:(修改相关文件后推荐使用)。
php artisan test --filter=testName - 当与你的更改相关的测试全部通过后,请询问用户是否要运行整个测试套件,以确保所有功能仍能正常运行。