diff --git a/src/Session.php b/src/Session.php index 4d37700..e0382bb 100644 --- a/src/Session.php +++ b/src/Session.php @@ -67,7 +67,7 @@ public function getId(): ?string */ public function isRead(): bool { - return $this->status & self::STATUS_READ !== 0; + return ($this->status & self::STATUS_READ) !== 0; } /** @@ -75,7 +75,7 @@ public function isRead(): bool */ public function isLocked(): bool { - return $this->status & self::STATUS_LOCKED !== 0; + return ($this->status & self::STATUS_LOCKED) !== 0; } /** diff --git a/test/DriverTest.php b/test/DriverTest.php index f604768..6ec270c 100644 --- a/test/DriverTest.php +++ b/test/DriverTest.php @@ -83,8 +83,14 @@ public function testConcurrentLocking(): \Generator $sessionA = $driver->create($sessionId); $sessionB = $driver->create($sessionId); + $this->assertFalse($sessionA->isRead()); + $this->assertFalse($sessionA->isLocked()); + yield $sessionA->open(); + $this->assertTrue($sessionA->isRead()); + $this->assertTrue($sessionA->isLocked()); + $this->expectException(TimeoutException::class); try {