Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Testing
csarcrr/invoicing-integration
cursor
laravel
csarcrr
invoicing-integration

Testing Conventions

Install
php artisan boost:add-skill csarcrr/invoicing-integration

Save this content to: .cursor/rules/testing.md

# Testing Conventions

- Write tests using Pest syntax — `it()`, `test()`, `expect()` — never raw PHPUnit
- Use `pestphp/pest-plugin-arch` for architecture tests
- Organize tests by operation under `tests/Unit/<Resource>/<Operation>/` and `tests/Feature/<Resource>/`, not by `src/` structure. An operation with many payload fields splits them into `ProviderData/`; the others keep a single `PayloadTest.php`
- Provider internals with no counterpart in other providers go in `tests/Unit/Providers/<Provider>/`
- Before writing a test, read a sibling test for the same kind of operation and follow its structure
- Fake provider HTTP with `Http::fake(mockResponse(fixtures()->...))` and no URL key; `fixtures()` already resolves the active provider
- Put per-provider differences in a `match ($provider)` inside the assertion (e.g. inside `Http::assertSent`), including when providers behave differently, instead of one copied test per provider
- Give both providers' fixtures the same values where the provider format allows it, so the expected values stay shared
- When only some providers support an operation, its tests call `mockConfiguration(Provider::X)` in `beforeEach` and do not use the `providers` dataset. The structure test runs on the `providers` dataset and is the one place that asserts `OperationNotSupportedException`
- When a provider gains support for an operation, move that operation's tests to the `providers` dataset

Testing Conventions

  • Write tests using Pest syntax — it(), test(), expect() — never raw PHPUnit
  • Use pestphp/pest-plugin-arch for architecture tests
  • Organize tests by operation under tests/Unit/<Resource>/<Operation>/ and tests/Feature/<Resource>/, not by src/ structure. An operation with many payload fields splits them into ProviderData/; the others keep a single PayloadTest.php
  • Provider internals with no counterpart in other providers go in tests/Unit/Providers/<Provider>/
  • Before writing a test, read a sibling test for the same kind of operation and follow its structure
  • Fake provider HTTP with Http::fake(mockResponse(fixtures()->...)) and no URL key; fixtures() already resolves the active provider
  • Put per-provider differences in a match ($provider) inside the assertion (e.g. inside Http::assertSent), including when providers behave differently, instead of one copied test per provider
  • Give both providers' fixtures the same values where the provider format allows it, so the expected values stay shared
  • When only some providers support an operation, its tests call mockConfiguration(Provider::X) in beforeEach and do not use the providers dataset. The structure test runs on the providers dataset and is the one place that asserts OperationNotSupportedException
  • When a provider gains support for an operation, move that operation's tests to the providers dataset
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route