From ae61e8b111d1f8256b903bf11a2a1c2b34b768fe Mon Sep 17 00:00:00 2001 From: lukinovec Date: Fri, 7 Aug 2026 14:56:58 +0200 Subject: [PATCH] Remove ErrorException assertion The assertion could cause false positives/negatives since the exception is not that specific. Just let tenancy()->initialize($tenant1) run and fail loudly, that could tell us more about what's wrong than the original assertion. --- tests/Bootstrappers/FilesystemTenancyBootstrapperTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Bootstrappers/FilesystemTenancyBootstrapperTest.php b/tests/Bootstrappers/FilesystemTenancyBootstrapperTest.php index 274a7f35..92e1483b 100644 --- a/tests/Bootstrappers/FilesystemTenancyBootstrapperTest.php +++ b/tests/Bootstrappers/FilesystemTenancyBootstrapperTest.php @@ -325,10 +325,10 @@ test('file cache stores are separated per tenant', function () { // 'redis' and 'nonexistent_store' are skipped by the driver check in scopeCache(), before it reads their path. // Without the skipping logic, the `$this->originalCachePaths[$name] = $store['path']` - // line in scopeCache() would throw an ErrorException (with 'redis', we'd get an - // 'Undefined array key "path"' exception, and with 'nonexistent_store', + // line in scopeCache() would throw an ErrorException while initializing tenancy + // (with 'redis', we'd get an 'Undefined array key "path"' exception, and with 'nonexistent_store', // we'd get 'Trying to access array offset on null'). - expect(fn () => tenancy()->initialize($tenant1))->not()->toThrow(ErrorException::class); + tenancy()->initialize($tenant1); expect(Cache::store('file')->get('key'))->toBeNull(); Cache::store('file')->put('key', 'tenant1');