1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-09-20 14:14:03 +00:00

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.
This commit is contained in:
lukinovec 2026-08-07 14:56:58 +02:00
parent 8c8bd6e88e
commit ae61e8b111

View file

@ -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');