You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix test failures caused by PHPUnit 11 strictness and test pollution
This commit resolves all code-related test failures that emerged between
October 16th and November 24th, 2025, reducing failures from 165 to 24.
The remaining 24 failures are environmental (missing PHP 8.4 PDO SQLite).
## Root Cause Analysis
Between October 16th and November 24th, PHPUnit was upgraded from 10.x to 11.x
(currently 11.5.33). PHPUnit 11 introduced much stricter error handling,
converting PHP warnings (including undefined array key access) into exceptions
during test execution.
## Fixes Applied
1. **Undefined Array Key Errors (135 failures → 0)**
- src/Products/Product.php:136 - Added null coalescing for 'price' key
- src/Orders/HasLineItems.php:37-38 - Added null coalescing for 'product'
and 'quantity' keys
2. **Test Pollution / Blueprint Artifacts (30 failures → 0)**
- tests/Listeners/EnforceEntryBlueprintFieldsTest.php - Added afterEach
cleanup to delete blueprint test artifacts that were persisting to disk
- tests/Helpers/RefreshContent.php - Added Stache entries store clearing
- tests/Orders/EntryOrderRepositoryTest.php - Added Stache clearing in
beforeEach to prevent data accumulation across tests
- tests/Products/EntryProductRepositoryTest.php - Added Stache clearing in
beforeEach to prevent data accumulation across tests
## Test Results
Before fixes: 165 failed, 3 incomplete, 30 skipped, 350 passed
After fixes: 24 failed, 3 incomplete, 30 skipped, 491 passed
The remaining 24 failures are all "could not find driver" (QueryException)
errors related to missing pdo_sqlite extension in PHP 8.4 environment. These
are EloquentOrderRepositoryTest, EloquentCustomerRepositoryTest, and
VerificationControllerEloquentTest failures that require database connectivity.
0 commit comments