Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,15 @@ jp test coverage <project> # Generate coverage report (optional)

### PHP Testing

- `jp test php` works for all projects except `plugins/jetpack`, which uses `jp docker` commands
- Add `--verbose` for full output: `jp test php packages/connection --verbose`
- Filter to specific tests: `jp test php packages/connection --verbose -- --filter SSO_Test`
- Use PHPUnit with WordPress test framework and `yoast/phpunit-polyfills`
- Follow WordPress testing conventions, use WordPress fixtures and mocks
- Test WordPress hooks and filters
- Test class names MUST end in "Test"
- Every test class MUST be in a file with a matching name (e.g., class `My_Unit_Test` in `My_Unit_Test.php`)
- Many packages use WorDBless (not the WP test factory). Test classes extend `WorDBless\BaseTestCase`. To create test users, use `wp_insert_user()` + `get_userdata()` — do NOT use `self::factory()->user->create_and_get()` as that method is not available. See `projects/packages/connection/tests/php/sso/Helpers_Test.php` for an example.

See `docs/automated-testing.md` for full testing guidelines.

Expand Down
Loading