Skip to content

Commit 5adc0c1

Browse files
committed
guidelines: improve test creation guidelines for feature vs unit, and pest vs phpunit
1 parent 2bd81fc commit 5adc0c1

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

.ai/laravel/core.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
### Testing
3636
- When creating models for tests, use the factories for the models. Check if the factory has custom states that can be used before manually setting up the model.
3737
- Faker: Use methods such as `$this->faker->word()` or `fake()->randomDigit()`. Follow existing conventions whether to use `$this->faker` or `fake()`.
38+
- When creating tests make use of `php artisan make:test [options] <name>` to create a Feature test, and pass `--unit` to create a Unit test.
3839

3940
### Vite Error
4041
- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run `npm run build` or ask the user to run `npm run dev` or `composer run dev`.

.ai/pest/core.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
- If you need to verify a feature is working, write or update a Unit / Feature test.
55

66
### Pest Tests
7-
- All tests must be written using Pest.
7+
- All tests must be written using Pest. Use `php artisan make:test --pest <name>`.
88
- 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.
99
- Tests should test all of the happy paths, failure paths, and weird paths.
1010
- Tests live in the `tests/Feature` and `tests/Unit` directories.

.ai/phpunit/core.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## PHPUnit Core
22

3-
- This application uses PHPUnit for testing. All tests must be written as PHPUnit classes.
3+
- This application uses PHPUnit for testing. All tests must be written as PHPUnit classes. Use `php artisan make:test --phpunit <name>` to create a new test.
44
- If you see a test using "Pest", convert it to PHPUnit.
55
- Every time a test has been updated, run that singular test.
66
- When the tests relating to your feature are passing, ask the user if they would like to also run the entire test suite to make sure everything is still passing.

0 commit comments

Comments
 (0)