Skip to content

Commit 1a2e8fb

Browse files
authored
feat(cache): make assertLocked ensure that the checked lock has an expiration (#1758)
1 parent 96dad91 commit 1a2e8fb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/cache/src/Testing/TestingLock.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ public function assertLocked(null|Stringable|string $by = null, null|DateTimeInt
6666
$until = DateTime::now()->plus($until);
6767
}
6868

69+
Assert::assertNotNull(
70+
actual: $this->expiration,
71+
message: "Expected lock `{$this->key}` to have an expiration, but it has none.",
72+
);
73+
6974
Assert::assertTrue(
7075
condition: $this->expiration->afterOrAtTheSameTime($until),
7176
message: "Expected lock `{$this->key}` to expire at or after `{$until}`, but it expires at `{$this->expiration}`.",

0 commit comments

Comments
 (0)