From 40c4c8a3f3d160573329231cd241e7176d01752e Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Fri, 26 Apr 2024 13:35:27 +0200 Subject: [PATCH] Remove calls to `onConsecutiveCalls()` --- Tests/LockTest.php | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/Tests/LockTest.php b/Tests/LockTest.php index ee019a1..0b0349e 100644 --- a/Tests/LockTest.php +++ b/Tests/LockTest.php @@ -39,7 +39,7 @@ public function testAcquireNoBlocking() ->method('save'); $store ->method('exists') - ->willReturnOnConsecutiveCalls(true, false); + ->willReturn(true, false); $this->assertTrue($lock->acquire(false)); } @@ -55,7 +55,7 @@ public function testAcquireNoBlockingWithPersistingStoreInterface() ->method('save'); $store ->method('exists') - ->willReturnOnConsecutiveCalls(true, false); + ->willReturn(true, false); $this->assertTrue($lock->acquire(false)); } @@ -71,7 +71,7 @@ public function testAcquireBlockingWithPersistingStoreInterface() ->method('save'); $store ->method('exists') - ->willReturnOnConsecutiveCalls(true, false); + ->willReturn(true, false); $this->assertTrue($lock->acquire(true)); } @@ -93,7 +93,7 @@ public function testAcquireBlockingRetryWithPersistingStoreInterface() }); $store ->method('exists') - ->willReturnOnConsecutiveCalls(true, false); + ->willReturn(true, false); $this->assertTrue($lock->acquire(true)); } @@ -110,7 +110,7 @@ public function testAcquireReturnsFalse() ->willThrowException(new LockConflictedException()); $store ->method('exists') - ->willReturnOnConsecutiveCalls(true, false); + ->willReturn(true, false); $this->assertFalse($lock->acquire(false)); } @@ -127,7 +127,7 @@ public function testAcquireReturnsFalseStoreInterface() ->willThrowException(new LockConflictedException()); $store ->method('exists') - ->willReturnOnConsecutiveCalls(true, false); + ->willReturn(true, false); $this->assertFalse($lock->acquire(false)); } @@ -146,7 +146,7 @@ public function testAcquireBlockingWithBlockingStoreInterface() ->method('waitAndSave'); $store ->method('exists') - ->willReturnOnConsecutiveCalls(true, false); + ->willReturn(true, false); $this->assertTrue($lock->acquire(true)); } @@ -166,7 +166,7 @@ public function testAcquireSetsTtl() ->with($key, 10); $store ->method('exists') - ->willReturnOnConsecutiveCalls(true, false); + ->willReturn(true, false); $lock->acquire(); } @@ -183,7 +183,7 @@ public function testRefresh() ->with($key, 10); $store ->method('exists') - ->willReturnOnConsecutiveCalls(true, false); + ->willReturn(true, false); $lock->refresh(); } @@ -200,7 +200,7 @@ public function testRefreshCustom() ->with($key, 20); $store ->method('exists') - ->willReturnOnConsecutiveCalls(true, false); + ->willReturn(true, false); $lock->refresh(20); } @@ -214,7 +214,7 @@ public function testIsAquired() $store ->method('exists') ->with($key) - ->willReturnOnConsecutiveCalls(true, false); + ->willReturn(true, false); $this->assertTrue($lock->isAcquired()); } @@ -267,8 +267,8 @@ public function testReleaseOnDestruction() $store ->method('exists') - ->willReturnOnConsecutiveCalls(true, false) - ; + ->willReturn(true, false); + $store ->expects($this->once()) ->method('delete') @@ -286,8 +286,8 @@ public function testNoAutoReleaseWhenNotConfigured() $store ->method('exists') - ->willReturnOnConsecutiveCalls(true, false) - ; + ->willReturn(true, false); + $store ->expects($this->never()) ->method('delete') @@ -313,7 +313,8 @@ public function testReleaseThrowsExceptionWhenDeletionFail() $store ->expects($this->never()) ->method('exists') - ->with($key); + ->with($key) + ->willReturn(true); $lock->release(); } @@ -426,7 +427,7 @@ public function testAcquireReadNoBlockingWithSharedLockStoreInterface() ->method('saveRead'); $store ->method('exists') - ->willReturnOnConsecutiveCalls(true, false); + ->willReturn(true, false); $this->assertTrue($lock->acquireRead(false)); } @@ -534,7 +535,7 @@ public function testAcquireReadBlockingWithBlockingSharedLockStoreInterface() ->method('waitAndSaveRead'); $store ->method('exists') - ->willReturnOnConsecutiveCalls(true, false); + ->willReturn(true, false); $this->assertTrue($lock->acquireRead(true)); } @@ -556,7 +557,7 @@ public function testAcquireReadBlockingWithSharedLockStoreInterface() }); $store ->method('exists') - ->willReturnOnConsecutiveCalls(true, false); + ->willReturn(true, false); $this->assertTrue($lock->acquireRead(true)); } @@ -572,7 +573,7 @@ public function testAcquireReadBlockingWithBlockingLockStoreInterface() ->method('waitAndSave'); $store ->method('exists') - ->willReturnOnConsecutiveCalls(true, false); + ->willReturn(true, false); $this->assertTrue($lock->acquireRead(true)); } @@ -594,7 +595,7 @@ public function testAcquireReadBlockingWithPersistingStoreInterface() }); $store ->method('exists') - ->willReturnOnConsecutiveCalls(true, false); + ->willReturn(true, false); $this->assertTrue($lock->acquireRead(true)); }