File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,10 @@ protected function exists()
6767 */
6868 public function release ()
6969 {
70+ if (! $ this ->exists ()) {
71+ return false ;
72+ }
73+
7074 if (! $ this ->isOwnedByCurrentProcess ()) {
7175 return false ;
7276 }
Original file line number Diff line number Diff line change @@ -181,4 +181,15 @@ public function testAnotherOwnerCanForceReleaseALock()
181181
182182 $ this ->assertTrue ($ wannabeOwner ->acquire ());
183183 }
184+
185+ public function testReleasingLockAfterAlreadyForceReleasedByAnotherOwnerFails ()
186+ {
187+ $ store = new ArrayStore ;
188+ $ owner = $ store ->lock ('foo ' , 10 );
189+ $ wannabeOwner = $ store ->lock ('foo ' , 10 );
190+ $ owner ->acquire ();
191+ $ wannabeOwner ->forceRelease ();
192+
193+ $ this ->assertFalse ($ wannabeOwner ->release ());
194+ }
184195}
You can’t perform that action at this time.
0 commit comments