From 8b9eb59b502ef71276aedff6415b7fc3fc6da211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Mon, 16 Nov 2026 13:11:20 +0100 Subject: [PATCH] test(tests): replace $this->fail with caught exception assertion in LaravelCacheLockTest --- .../Infra/Adapters/Locks/LaravelCacheLockTest.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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); }); });