Ejemplo n.º 1
0
 /**
  * @covers ::requestAdvisoryLock
  * @covers ::releaseAdvisoryLocks
  */
 public function testAnAdvisoryLockCanBeReleased()
 {
     $this->assertTrue($this->database->requestAdvisoryLock(1, 'test', 'lock'));
     $this->assertFalse($this->database->requestAdvisoryLock(2, 'test', 'lock'));
     $this->assertFalse($this->database->requestAdvisoryLock(3, 'test', 'lock'));
     $this->database->releaseAdvisoryLocks(1);
     $this->database->releaseAdvisoryLocks(3);
     $this->assertTrue($this->database->requestAdvisoryLock(2, 'test', 'lock'));
     $this->assertFalse($this->database->requestAdvisoryLock(1, 'test', 'lock'));
     $this->assertFalse($this->database->requestAdvisoryLock(3, 'test', 'lock'));
 }
Ejemplo n.º 2
0
 /**
  * @param string $category
  * @param string $name
  * @return bool
  */
 public function requestAdvisoryLock($category, $name)
 {
     return $this->database->requestAdvisoryLock($this->connection_id, $category, $name);
 }
Ejemplo n.º 3
0
 /**
  * @covers ::__construct
  * @covers ::requestProcessLock
  * @covers ::<private>
  */
 public function testAdvisoryLockCanBeAcquired()
 {
     $this->assertTrue($this->superqueue->requestProcessLock());
     $this->assertFalse($this->database->requestAdvisoryLock(2, 'superqueuer', 'default'));
     $this->assertTrue($this->superqueue->requestProcessLock());
 }