Skip to content

Commit

Permalink
Fix Session::isRead() / Session::isLocked()
Browse files Browse the repository at this point in the history
  • Loading branch information
kelunik committed Sep 27, 2019
1 parent 76eb5f8 commit 938e1ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Session.php
Expand Up @@ -67,15 +67,15 @@ public function getId(): ?string
*/
public function isRead(): bool
{
return $this->status & self::STATUS_READ !== 0;
return ($this->status & self::STATUS_READ) !== 0;
}

/**
* @return bool `true` if the session has been locked.
*/
public function isLocked(): bool
{
return $this->status & self::STATUS_LOCKED !== 0;
return ($this->status & self::STATUS_LOCKED) !== 0;
}

/**
Expand Down
6 changes: 6 additions & 0 deletions test/DriverTest.php
Expand Up @@ -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 {
Expand Down

0 comments on commit 938e1ff

Please sign in to comment.