From e8eb8874f9f97b6227d2d14de402739836e019dc Mon Sep 17 00:00:00 2001 From: Kevin Dees Date: Wed, 1 Jul 2026 14:20:36 -0400 Subject: [PATCH 1/2] Fix flaky HomeController tests: use array cache in test env --- .env.ci | 4 +++- .env.testing | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.env.ci b/.env.ci index 0f42aca9..3cff4186 100644 --- a/.env.ci +++ b/.env.ci @@ -16,7 +16,9 @@ DB_USERNAME=hackgreenville DB_PASSWORD=test BROADCAST_DRIVER=log -CACHE_DRIVER=file +# Tests must use an isolated in-memory cache. A persistent driver leaks +# Cache::remember() values (e.g. the homepage stats) across test methods. +CACHE_DRIVER=array SESSION_DRIVER=file SESSION_LIFETIME=120 QUEUE_DRIVER=sync diff --git a/.env.testing b/.env.testing index 5ab21a64..9053eb59 100644 --- a/.env.testing +++ b/.env.testing @@ -12,7 +12,9 @@ DB_CONNECTION=sqlite DB_HOST=:memory: BROADCAST_DRIVER=log -CACHE_DRIVER=file +# Tests must use an isolated in-memory cache. A persistent driver leaks +# Cache::remember() values (e.g. the homepage stats) across test methods. +CACHE_DRIVER=array SESSION_DRIVER=file SESSION_LIFETIME=120 QUEUE_DRIVER=sync From ed2cb8f9fd1e7fd155559693b2963680a882363e Mon Sep 17 00:00:00 2001 From: Kevin Dees Date: Wed, 1 Jul 2026 16:57:06 -0400 Subject: [PATCH 2/2] Move to CACHE_STORE --- .env.ci | 2 +- .env.docker | 2 +- .env.example | 4 ++-- .env.testing | 2 +- config/cache.php | 30 ++++++++++++++---------------- phpunit.xml | 2 +- 6 files changed, 20 insertions(+), 22 deletions(-) diff --git a/.env.ci b/.env.ci index 3cff4186..9f09acca 100644 --- a/.env.ci +++ b/.env.ci @@ -18,7 +18,7 @@ DB_PASSWORD=test BROADCAST_DRIVER=log # Tests must use an isolated in-memory cache. A persistent driver leaks # Cache::remember() values (e.g. the homepage stats) across test methods. -CACHE_DRIVER=array +CACHE_STORE=array SESSION_DRIVER=file SESSION_LIFETIME=120 QUEUE_DRIVER=sync diff --git a/.env.docker b/.env.docker index eb319be6..a6186d17 100644 --- a/.env.docker +++ b/.env.docker @@ -26,7 +26,7 @@ MYSQL_PASSWORD="${DB_PASSWORD}" MYSQL_ALLOW_EMPTY_PASSWORD="yes" BROADCAST_DRIVER=log -CACHE_DRIVER=file +CACHE_STORE=file SESSION_DRIVER=file SESSION_LIFETIME=120 QUEUE_DRIVER=sync diff --git a/.env.example b/.env.example index 933cab4b..ad26b5c0 100644 --- a/.env.example +++ b/.env.example @@ -32,8 +32,8 @@ DB_USERNAME=homestead DB_PASSWORD=secret BROADCAST_DRIVER=log -# Setting the cache driver to "array" will disable the cache -CACHE_DRIVER=file +# Setting the cache store to "array" will disable the cache +CACHE_STORE=file SESSION_DRIVER=file SESSION_LIFETIME=120 QUEUE_DRIVER=sync diff --git a/.env.testing b/.env.testing index 9053eb59..22d158c6 100644 --- a/.env.testing +++ b/.env.testing @@ -14,7 +14,7 @@ DB_HOST=:memory: BROADCAST_DRIVER=log # Tests must use an isolated in-memory cache. A persistent driver leaks # Cache::remember() values (e.g. the homepage stats) across test methods. -CACHE_DRIVER=array +CACHE_STORE=array SESSION_DRIVER=file SESSION_LIFETIME=120 QUEUE_DRIVER=sync diff --git a/config/cache.php b/config/cache.php index 6d571961..a0f38dfa 100644 --- a/config/cache.php +++ b/config/cache.php @@ -7,15 +7,13 @@ | Default Cache Store |-------------------------------------------------------------------------- | - | This option controls the default cache connection that gets used while - | using this caching library. This connection is used when another is - | not explicitly specified when executing a given caching function. - | - | Supported: "apc", "array", "database", "file", "memcached", "redis" + | This option controls the default cache store that will be used by the + | framework. This connection is utilized if another isn't explicitly + | specified when running a cache operation inside the application. | */ - 'default' => env('CACHE_DRIVER', 'file'), + 'default' => env('CACHE_STORE', 'file'), /* |-------------------------------------------------------------------------- @@ -39,37 +37,37 @@ ], 'database' => [ - 'driver' => 'database', - 'table' => 'cache', + 'driver' => 'database', + 'table' => 'cache', 'connection' => null, ], 'file' => [ 'driver' => 'file', - 'path' => storage_path('framework/cache/data'), + 'path' => storage_path('framework/cache/data'), ], 'memcached' => [ - 'driver' => 'memcached', + 'driver' => 'memcached', 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), - 'sasl' => [ + 'sasl' => [ env('MEMCACHED_USERNAME'), env('MEMCACHED_PASSWORD'), ], - 'options' => [ + 'options' => [ // Memcached::OPT_CONNECT_TIMEOUT => 2000, ], - 'servers' => [ + 'servers' => [ [ - 'host' => env('MEMCACHED_HOST', '127.0.0.1'), - 'port' => env('MEMCACHED_PORT', 11211), + 'host' => env('MEMCACHED_HOST', '127.0.0.1'), + 'port' => env('MEMCACHED_PORT', 11211), 'weight' => 100, ], ], ], 'redis' => [ - 'driver' => 'redis', + 'driver' => 'redis', 'connection' => 'default', ], diff --git a/phpunit.xml b/phpunit.xml index 0f8463bb..436a820f 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -23,7 +23,7 @@ - +