Example #1
0
 /**
  * Test that attempting to obtain a lock before the min lock life time
  * results in false being returned
  *
  * @group foo
  * @covers \OpenWeatherMap\Lock\File::acquire
  */
 public function testLockReturnsFalseIfCurrentTimeLessThanMinimum()
 {
     $vfs = vfsStream::setup('exampleDir');
     $file = vfsStream::url('exampleDir/my.lock');
     $minLifetime = 100;
     $lock = new File(array('file' => $file, 'minlifetime' => $minLifetime));
     $this->assertSame($minLifetime, $lock->getMinLifetime());
     $this->assertTrue($lock->acquire());
     $this->assertTrue($lock->release());
     $this->assertFalse($lock->acquire());
 }