summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-05-21 15:57:33 +0200
committerRobin Appelman <icewind@owncloud.com>2015-06-01 13:22:56 +0200
commitc72ea9f7d72d3ab22ff56195235808b17cecb0ba (patch)
tree81bb5c4a526d758cf9b3c95af51691b5b6485348 /tests/lib
parent6df502a5aa29b137d17bb7c17cb2552719386203 (diff)
downloadnextcloud-server-c72ea9f7d72d3ab22ff56195235808b17cecb0ba.tar.gz
nextcloud-server-c72ea9f7d72d3ab22ff56195235808b17cecb0ba.zip
unit test for releaseall
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/lock/lockingprovider.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/lib/lock/lockingprovider.php b/tests/lib/lock/lockingprovider.php
index 08d879da8bb..337aa4cea7e 100644
--- a/tests/lib/lock/lockingprovider.php
+++ b/tests/lib/lock/lockingprovider.php
@@ -107,6 +107,30 @@ abstract class LockingProvider extends TestCase {
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
}
+ public function testReleaseAll() {
+ $this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
+ $this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
+ $this->instance->acquireLock('bar', ILockingProvider::LOCK_SHARED);
+ $this->instance->acquireLock('asd', ILockingProvider::LOCK_EXCLUSIVE);
+
+ $this->instance->releaseAll();
+
+ $this->assertFalse($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED));
+ $this->assertFalse($this->instance->isLocked('bar', ILockingProvider::LOCK_SHARED));
+ $this->assertFalse($this->instance->isLocked('asd', ILockingProvider::LOCK_EXCLUSIVE));
+ }
+
+ public function testReleaseAfterReleaseAll() {
+ $this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
+ $this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
+
+ $this->instance->releaseAll();
+
+ $this->assertFalse($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED));
+
+ $this->instance->releaseLock('foo', ILockingProvider::LOCK_SHARED);
+ }
+
/**
* @expectedException \OCP\Lock\LockedException