Skip to content

Commit

Permalink
Assert other file did not get lock
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Dec 10, 2024
1 parent e9195e8 commit c2839b5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/AsyncFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,13 @@ public function testSimultaneousLock(): void

EventLoop::delay(0.1, function () use ($handle1, $handle2): void {
// Either file could obtain the lock first, so check both and release the one which obtained the lock.

if ($handle1->getLockType()) {
self::assertNull($handle2->getLockType());
self::assertSame(LockType::Exclusive, $handle1->getLockType());
$handle1->unlock();
}

if ($handle2->getLockType()) {
} else {
self::assertNull($handle1->getLockType());
self::assertSame(LockType::Exclusive, $handle2->getLockType());
$handle2->unlock();
}
});
Expand Down

0 comments on commit c2839b5

Please sign in to comment.