diff --git a/tests/Integration/Standalones/Infra/Adapters/Locks/LaravelCacheLockTest.php b/tests/Integration/Standalones/Infra/Adapters/Locks/LaravelCacheLockTest.php index 3c309327..4730703e 100644 --- a/tests/Integration/Standalones/Infra/Adapters/Locks/LaravelCacheLockTest.php +++ b/tests/Integration/Standalones/Infra/Adapters/Locks/LaravelCacheLockTest.php @@ -91,13 +91,17 @@ describe('LaravelCacheLock', function (): void { $cacheLock = new LaravelCacheLock($cache); // WHEN + $caught = null; + try { $cacheLock->synchronize('test:lock:wrapped', fn (): string => 'never', 30, 5); - $this->fail('Expected LockTimeoutException was not thrown.'); } catch (LockTimeoutException $e) { - // THEN - expect($e->getMessage())->toBe('Timed out') - ->and($e->getPrevious())->toBeInstanceOf(LaravelLockTimeoutException::class); + $caught = $e; } + + // THEN + expect($caught)->toBeInstanceOf(LockTimeoutException::class) + ->and($caught?->getMessage())->toBe('Timed out') + ->and($caught?->getPrevious())->toBeInstanceOf(LaravelLockTimeoutException::class); }); });