Example #1
0
 /**
  * Test attempting to call lock multiple times
  *
  * Test that if we attempt to call lock before the lock has been release
  * results false being returned
  *
  * @covers \OpenWeatherMap\Lock\File::acquire
  */
 public function testMultipleLocks()
 {
     $vfs = vfsStream::setup('exampleDir');
     $file = vfsStream::url('exampleDir/my.lock');
     $maxLifetime = 20;
     $minLifetime = 10;
     $lock = new File(array('file' => $file, 'maxlifetime' => $maxLifetime, 'minlifetime' => $minLifetime));
     $this->assertTrue($lock->acquire());
     $this->assertFalse($lock->acquire());
 }