Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2019-11-27 17:27:18 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2019-11-27 17:27:18 +0300
commit3a7cf40aaa678bea1df143d2982d603b7a334eec (patch)
tree63c1e3ad7f7f401d14411a4d44c523632906afc9 /tests/lib/Lock
parent0568b012672d650c6b5a49e72c4028dde5463c60 (diff)
Mode to modern phpunit
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests/lib/Lock')
-rw-r--r--tests/lib/Lock/DBLockingProviderTest.php4
-rw-r--r--tests/lib/Lock/LockingProvider.php48
-rw-r--r--tests/lib/Lock/MemcacheLockingProviderTest.php2
3 files changed, 27 insertions, 27 deletions
diff --git a/tests/lib/Lock/DBLockingProviderTest.php b/tests/lib/Lock/DBLockingProviderTest.php
index b7929aee476..73a7b6c3f83 100644
--- a/tests/lib/Lock/DBLockingProviderTest.php
+++ b/tests/lib/Lock/DBLockingProviderTest.php
@@ -49,7 +49,7 @@ class DBLockingProviderTest extends LockingProvider {
protected $currentTime;
- public function setUp(): void {
+ protected function setUp(): void {
$this->currentTime = time();
$this->timeFactory = $this->createMock(ITimeFactory::class);
$this->timeFactory->expects($this->any())
@@ -68,7 +68,7 @@ class DBLockingProviderTest extends LockingProvider {
return new \OC\Lock\DBLockingProvider($this->connection, \OC::$server->getLogger(), $this->timeFactory, 3600);
}
- public function tearDown(): void {
+ protected function tearDown(): void {
$this->connection->executeQuery('DELETE FROM `*PREFIX*file_locks`');
parent::tearDown();
}
diff --git a/tests/lib/Lock/LockingProvider.php b/tests/lib/Lock/LockingProvider.php
index 75117657bf2..93eba367af2 100644
--- a/tests/lib/Lock/LockingProvider.php
+++ b/tests/lib/Lock/LockingProvider.php
@@ -73,10 +73,10 @@ abstract class LockingProvider extends TestCase {
$this->assertFalse($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED));
}
- /**
- * @expectedException \OCP\Lock\LockedException
- */
+
public function testDoubleExclusiveLock() {
+ $this->expectException(\OCP\Lock\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);
@@ -90,10 +90,10 @@ abstract class LockingProvider extends TestCase {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
}
- /**
- * @expectedException \OCP\Lock\LockedException
- */
+
public function testExclusiveLockAfterShared() {
+ $this->expectException(\OCP\Lock\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);
@@ -164,10 +164,10 @@ abstract class LockingProvider extends TestCase {
}
- /**
- * @expectedException \OCP\Lock\LockedException
- */
+
public function testSharedLockAfterExclusive() {
+ $this->expectException(\OCP\Lock\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);
@@ -211,41 +211,41 @@ abstract class LockingProvider extends TestCase {
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED));
}
- /**
- * @expectedException \OCP\Lock\LockedException
- */
+
public function testChangeLockToExclusiveDoubleShared() {
+ $this->expectException(\OCP\Lock\LockedException::class);
+
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->changeLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
}
- /**
- * @expectedException \OCP\Lock\LockedException
- */
+
public function testChangeLockToExclusiveNoShared() {
+ $this->expectException(\OCP\Lock\LockedException::class);
+
$this->instance->changeLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
}
- /**
- * @expectedException \OCP\Lock\LockedException
- */
+
public function testChangeLockToExclusiveFromExclusive() {
+ $this->expectException(\OCP\Lock\LockedException::class);
+
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
$this->instance->changeLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
}
- /**
- * @expectedException \OCP\Lock\LockedException
- */
+
public function testChangeLockToSharedNoExclusive() {
+ $this->expectException(\OCP\Lock\LockedException::class);
+
$this->instance->changeLock('foo', ILockingProvider::LOCK_SHARED);
}
- /**
- * @expectedException \OCP\Lock\LockedException
- */
+
public function testChangeLockToSharedFromShared() {
+ $this->expectException(\OCP\Lock\LockedException::class);
+
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->changeLock('foo', ILockingProvider::LOCK_SHARED);
}
diff --git a/tests/lib/Lock/MemcacheLockingProviderTest.php b/tests/lib/Lock/MemcacheLockingProviderTest.php
index 6d37aaa5367..7b7c649c886 100644
--- a/tests/lib/Lock/MemcacheLockingProviderTest.php
+++ b/tests/lib/Lock/MemcacheLockingProviderTest.php
@@ -38,7 +38,7 @@ class MemcacheLockingProviderTest extends LockingProvider {
return new \OC\Lock\MemcacheLockingProvider($this->memcache);
}
- public function tearDown(): void {
+ protected function tearDown(): void {
$this->memcache->clear();
parent::tearDown();
}