Commit 34131d1
authored
test: add Queue::fake() to stabilize CacheStoreTest in sync-queue environments (#416)
Three tests in CacheStoreTest (Updated/Activated/Deactivated dispatch)
have failed in CI since 2026-02-25 while passing locally. Root cause:
the Updated/Activated/Deactivated events each have three listeners
wired (BustCacheImmediately sync, plus BustCache and BuildCache both
queued). BuildCache::handle() calls repository find() which uses
Cache::rememberForever() and re-populates the exact 'totem.task.{id}'
key the tests assert was cleared.
Whether the queued listeners execute synchronously during dispatch
depends on config('queue.default'). In CI the default is 'sync'
(fresh install; no vendor/orchestra/testbench-core/laravel/.env),
so BuildCache runs synchronously and repopulates the cache before
the assertion. Local environments that have a stale
testbench-core/laravel/.env setting QUEUE_CONNECTION=database
serialize the queued listeners and never execute them in tests,
masking the issue.
Fix: call Queue::fake() in the three affected tests. This ensures
only BustCacheImmediately (the non-queued listener) runs during
dispatch, which matches the tests' evident intent. The fix is
test-harness-only; no src/ changes, no runtime behavior impact.
Verified locally:
- With vendor/.env present: 8/8 CacheStoreTest tests pass (78/78 full)
- With vendor/.env removed (CI condition): 8/8 pass (78/78 full)1 parent 4dade22 commit 34131d1
1 file changed
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| 76 | + | |
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
| |||
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
| 91 | + | |
89 | 92 | | |
90 | 93 | | |
91 | 94 | | |
| |||
98 | 101 | | |
99 | 102 | | |
100 | 103 | | |
| 104 | + | |
101 | 105 | | |
102 | 106 | | |
103 | 107 | | |
| |||
0 commit comments