Files
portal/app/tests/TestCase.php
T

26 lines
1020 B
PHP
Raw Normal View History

<?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
protected function setUp(): void
{
parent::setUp();
// Quirk 72: 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(). Repoint the `redis`
// cache store at the in-process `array` driver: each worker then gets
// a hermetic, worker-local cache. Production keeps the real `redis`
// driver — this override only ever runs under APP_ENV=testing.
config(['cache.stores.redis.driver' => 'array']);
}
}