diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-07-15 15:44:51 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-08-03 14:12:56 +0200 |
commit | a8552a1b24e7df8c4822b5b0dd7c690312ae810d (patch) | |
tree | 616ca1d6f7e3ac82f0613cccef03e3e3c7cba932 /tests | |
parent | af7bcb43b1b74a5f0ad94b645d400510a2ae6bc4 (diff) | |
download | nextcloud-server-a8552a1b24e7df8c4822b5b0dd7c690312ae810d.tar.gz nextcloud-server-a8552a1b24e7df8c4822b5b0dd7c690312ae810d.zip |
split off keeping track of acquire locks
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/lock/lockingprovider.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/lib/lock/lockingprovider.php b/tests/lib/lock/lockingprovider.php index efd6e1939f2..ca72c1bb7f3 100644 --- a/tests/lib/lock/lockingprovider.php +++ b/tests/lib/lock/lockingprovider.php @@ -120,6 +120,36 @@ abstract class LockingProvider extends TestCase { $this->assertFalse($this->instance->isLocked('asd', ILockingProvider::LOCK_EXCLUSIVE)); } + public function testReleaseAllAfterChange() { + $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->changeLock('bar', 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('bar', ILockingProvider::LOCK_EXCLUSIVE)); + $this->assertFalse($this->instance->isLocked('asd', ILockingProvider::LOCK_EXCLUSIVE)); + } + + public function testReleaseAllAfterUnlock() { + $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->releaseLock('bar', ILockingProvider::LOCK_SHARED); + + $this->instance->releaseAll(); + + $this->assertFalse($this->instance->isLocked('foo', 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); |