0fa1a7394b
SupplierPortalClient::loadSession, RefreshSupplierSessionJob, CsvReconcileJob and RouteSupplierLeadJob hardcode Cache::store('redis'), bypassing phpunit.xml's CACHE_STORE=array. Under pest --parallel every worker shares the same Memurai instance and the global supplier:session key, so one worker's afterEach forget()/flush() races another worker's mid-test loadSession() -- deterministic 1-2 failures in the tests/Feature/Supplier/ subdir-only run (quirk 72).
TestCase::setUp() repoints the redis cache store at the in-process array driver: each parallel worker gets a hermetic, worker-local cache. Production keeps the real redis driver -- the override only runs under APP_ENV=testing. New RedisCacheStoreIsolationTest guards the invariant.
Verified: tests/Feature/Supplier/ --parallel 6/6 runs 43/43 (was 42/43 +1 error); tests/Unit/Supplier/ 3/3 runs 38/38; full pest --parallel 794/791/3sk/0; Pint + Larastan clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
25 lines
993 B
PHP
25 lines
993 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Illuminate\Cache\ArrayStore;
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
/**
|
|
* Quirk 72 regression guard — see tests/TestCase.php::setUp().
|
|
*
|
|
* Supplier code (SupplierPortalClient::loadSession, RefreshSupplierSessionJob,
|
|
* CsvReconcileJob, RouteSupplierLeadJob) hardcodes Cache::store('redis'),
|
|
* bypassing phpunit.xml's CACHE_STORE=array. The Redis store is a shared
|
|
* external service: under `pest --parallel` every worker collides on the
|
|
* global `supplier:session` key, so one worker's afterEach forget()/flush()
|
|
* races another worker's mid-test loadSession().
|
|
*
|
|
* TestCase::setUp() repoints the `redis` cache store at the in-process
|
|
* `array` driver, making it hermetic and worker-local. This test fails
|
|
* (RedisStore) if that override is ever removed.
|
|
*/
|
|
test('redis cache store resolves to the in-process array driver under tests', function (): void {
|
|
expect(Cache::store('redis')->getStore())->toBeInstanceOf(ArrayStore::class);
|
|
});
|