mirror of
https://github.com/friendica/friendica
synced 2025-04-24 00:30:11 +00:00
Added Unittests for cache
fixed Lock & Cache bugs
This commit is contained in:
parent
1dafaa69c5
commit
80a4e6263f
18 changed files with 317 additions and 25 deletions
|
@ -86,4 +86,24 @@ abstract class LockTest extends DatabaseTest
|
|||
$this->assertFalse($this->instance->isLocked('bar'));
|
||||
$this->assertFalse($this->instance->isLocked('nice'));
|
||||
}
|
||||
|
||||
function testLockTTL() {
|
||||
|
||||
// TODO [nupplaphil] - Because of the Datetime-Utils for the database, we have to wait a FULL second between the checks to invalidate the db-locks/cache
|
||||
$this->instance->acquireLock('foo', 1, 1);
|
||||
$this->instance->acquireLock('bar', 1, 3);
|
||||
|
||||
$this->assertTrue($this->instance->isLocked('foo'));
|
||||
$this->assertTrue($this->instance->isLocked('bar'));
|
||||
|
||||
sleep(2);
|
||||
|
||||
$this->assertFalse($this->instance->isLocked('foo'));
|
||||
$this->assertTrue($this->instance->isLocked('bar'));
|
||||
|
||||
sleep(2);
|
||||
|
||||
$this->assertFalse($this->instance->isLocked('foo'));
|
||||
$this->assertFalse($this->instance->isLocked('bar'));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue