QueryBuilder Regression Notes
Why this file exists
This note captures test patterns that previously caused regressions in CRUD request-to-query behavior.
Important edge cases
- Relation filters must use
whereinsidewhereHas/orWhereHascallbacks.- Propagating
orWhereinto relation subqueries can bypass relation constraints.
- Propagating
- SQL
LIKEpatterns should avoid_in token-style fixtures unless wildcard behavior is intended._matches a single character in SQL and can create false positives.
- Tests using
GREAT_EQUALSon IDs should create the threshold fixture last or constrain candidate IDs.- Otherwise unrelated fixtures with higher IDs can be included.
- Nested relation eager-load constraints should be asserted on both parent and child relations.
- Example: filtering on
roles.permissions.nameshould also constrain loadedroles.
- Example: filtering on
Aggregate method mapping
ColumnType::AVGmust map to EloquentwithAvg(notwithAverage).- Nested aggregates (
roles.permissions.idwithMIN/MAX) are applied on relation callbacks, not on the root query SQL.