aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Lock/LockingProvider.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Lock/LockingProvider.php')
-rw-r--r--tests/lib/Lock/LockingProvider.php83
1 files changed, 42 insertions, 41 deletions
diff --git a/tests/lib/Lock/LockingProvider.php b/tests/lib/Lock/LockingProvider.php
index 2aa3980542b..2827f2c9160 100644
--- a/tests/lib/Lock/LockingProvider.php
+++ b/tests/lib/Lock/LockingProvider.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -13,12 +14,12 @@ use Test\TestCase;
abstract class LockingProvider extends TestCase {
/**
- * @var \OCP\Lock\ILockingProvider
+ * @var ILockingProvider
*/
protected $instance;
/**
- * @return \OCP\Lock\ILockingProvider
+ * @return ILockingProvider
*/
abstract protected function getInstance();
@@ -27,19 +28,19 @@ abstract class LockingProvider extends TestCase {
$this->instance = $this->getInstance();
}
- public function testExclusiveLock() {
+ public function testExclusiveLock(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
$this->assertFalse($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED));
}
- public function testSharedLock() {
+ public function testSharedLock(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->assertFalse($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED));
}
- public function testDoubleSharedLock() {
+ public function testDoubleSharedLock(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->assertFalse($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED));
@@ -47,7 +48,7 @@ abstract class LockingProvider extends TestCase {
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED));
}
- public function testReleaseSharedLock() {
+ public function testReleaseSharedLock(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->assertFalse($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED));
@@ -59,16 +60,16 @@ abstract class LockingProvider extends TestCase {
$this->assertFalse($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED));
}
-
- public function testDoubleExclusiveLock() {
- $this->expectException(\OCP\Lock\LockedException::class);
+
+ public function testDoubleExclusiveLock(): void {
+ $this->expectException(LockedException::class);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
}
- public function testReleaseExclusiveLock() {
+ public function testReleaseExclusiveLock(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
$this->instance->releaseLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
@@ -76,16 +77,16 @@ abstract class LockingProvider extends TestCase {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
}
-
- public function testExclusiveLockAfterShared() {
- $this->expectException(\OCP\Lock\LockedException::class);
+
+ public function testExclusiveLockAfterShared(): void {
+ $this->expectException(LockedException::class);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED));
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
}
- public function testExclusiveLockAfterSharedReleased() {
+ public function testExclusiveLockAfterSharedReleased(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED));
$this->instance->releaseLock('foo', ILockingProvider::LOCK_SHARED);
@@ -93,7 +94,7 @@ abstract class LockingProvider extends TestCase {
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
}
- public function testReleaseAll() {
+ public function testReleaseAll(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->acquireLock('bar', ILockingProvider::LOCK_SHARED);
@@ -108,7 +109,7 @@ abstract class LockingProvider extends TestCase {
$this->assertFalse($this->instance->isLocked('fizz#A=23', ILockingProvider::LOCK_EXCLUSIVE));
}
- public function testReleaseAllAfterChange() {
+ public function testReleaseAllAfterChange(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->acquireLock('bar', ILockingProvider::LOCK_SHARED);
@@ -124,7 +125,7 @@ abstract class LockingProvider extends TestCase {
$this->assertFalse($this->instance->isLocked('asd', ILockingProvider::LOCK_EXCLUSIVE));
}
- public function testReleaseAllAfterUnlock() {
+ public function testReleaseAllAfterUnlock(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->acquireLock('bar', ILockingProvider::LOCK_SHARED);
@@ -138,7 +139,7 @@ abstract class LockingProvider extends TestCase {
$this->assertFalse($this->instance->isLocked('asd', ILockingProvider::LOCK_EXCLUSIVE));
}
- public function testReleaseAfterReleaseAll() {
+ public function testReleaseAfterReleaseAll(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
@@ -150,16 +151,16 @@ abstract class LockingProvider extends TestCase {
}
-
- public function testSharedLockAfterExclusive() {
- $this->expectException(\OCP\Lock\LockedException::class);
+
+ public function testSharedLockAfterExclusive(): void {
+ $this->expectException(LockedException::class);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
}
- public function testLockedExceptionHasPathForShared() {
+ public function testLockedExceptionHasPathForShared(): void {
try {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
@@ -171,7 +172,7 @@ abstract class LockingProvider extends TestCase {
}
}
- public function testLockedExceptionHasPathForExclusive() {
+ public function testLockedExceptionHasPathForExclusive(): void {
try {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
@@ -183,60 +184,60 @@ abstract class LockingProvider extends TestCase {
}
}
- public function testChangeLockToExclusive() {
+ public function testChangeLockToExclusive(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->changeLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
$this->assertFalse($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED));
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
}
- public function testChangeLockToShared() {
+ public function testChangeLockToShared(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
$this->instance->changeLock('foo', ILockingProvider::LOCK_SHARED);
$this->assertFalse($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED));
}
-
- public function testChangeLockToExclusiveDoubleShared() {
- $this->expectException(\OCP\Lock\LockedException::class);
+
+ public function testChangeLockToExclusiveDoubleShared(): void {
+ $this->expectException(LockedException::class);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->changeLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
}
-
- public function testChangeLockToExclusiveNoShared() {
- $this->expectException(\OCP\Lock\LockedException::class);
+
+ public function testChangeLockToExclusiveNoShared(): void {
+ $this->expectException(LockedException::class);
$this->instance->changeLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
}
-
- public function testChangeLockToExclusiveFromExclusive() {
- $this->expectException(\OCP\Lock\LockedException::class);
+
+ public function testChangeLockToExclusiveFromExclusive(): void {
+ $this->expectException(LockedException::class);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
$this->instance->changeLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
}
-
- public function testChangeLockToSharedNoExclusive() {
- $this->expectException(\OCP\Lock\LockedException::class);
+
+ public function testChangeLockToSharedNoExclusive(): void {
+ $this->expectException(LockedException::class);
$this->instance->changeLock('foo', ILockingProvider::LOCK_SHARED);
}
-
- public function testChangeLockToSharedFromShared() {
- $this->expectException(\OCP\Lock\LockedException::class);
+
+ public function testChangeLockToSharedFromShared(): void {
+ $this->expectException(LockedException::class);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->changeLock('foo', ILockingProvider::LOCK_SHARED);
}
- public function testReleaseNonExistingShared() {
+ public function testReleaseNonExistingShared(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->releaseLock('foo', ILockingProvider::LOCK_SHARED);