+
+ /**
+ * @small
+ */
+ public function testReleaseWitTTL()
+ {
+ $this->assertFalse($this->instance->isLocked('test'));
+ $this->assertTrue($this->instance->acquireLock('test', 1, 10));
+ $this->assertTrue($this->instance->isLocked('test'));
+ $this->assertTrue($this->instance->releaseLock('test'));
+ $this->assertFalse($this->instance->isLocked('test'));
+ }
+
+ /**
+ * @medium
+ */
+ function testLockTTL() {
+ $this->markTestSkipped('taking too much time without mocking');
+
+ $this->assertFalse($this->instance->isLocked('foo'));
+ $this->assertFalse($this->instance->isLocked('bar'));
+
+ // 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->assertTrue($this->instance->acquireLock('foo', 2, 1));
+ $this->assertTrue($this->instance->acquireLock('bar', 2, 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'));
+ }