Files
portal/app/tests/Feature/RedisCacheStoreIsolationTest.php
T

25 lines
993 B
PHP
Raw Normal View History

<?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);
});