diff options
Diffstat (limited to 'tests/lib/Lock')
-rw-r--r-- | tests/lib/Lock/DBLockingProviderTest.php | 7 | ||||
-rw-r--r-- | tests/lib/Lock/LockingProvider.php | 16 | ||||
-rw-r--r-- | tests/lib/Lock/MemcacheLockingProviderTest.php | 6 | ||||
-rw-r--r-- | tests/lib/Lock/NonCachingDBLockingProviderTest.php | 7 |
4 files changed, 22 insertions, 14 deletions
diff --git a/tests/lib/Lock/DBLockingProviderTest.php b/tests/lib/Lock/DBLockingProviderTest.php index 1c02e8d7d77..1216d42f343 100644 --- a/tests/lib/Lock/DBLockingProviderTest.php +++ b/tests/lib/Lock/DBLockingProviderTest.php @@ -7,8 +7,11 @@ namespace Test\Lock; +use OC\Lock\DBLockingProvider; use OCP\AppFramework\Utility\ITimeFactory; +use OCP\IDBConnection; use OCP\Lock\ILockingProvider; +use OCP\Server; /** * Class DBLockingProvider @@ -50,8 +53,8 @@ class DBLockingProviderTest extends LockingProvider { * @return \OCP\Lock\ILockingProvider */ protected function getInstance() { - $this->connection = \OC::$server->getDatabaseConnection(); - return new \OC\Lock\DBLockingProvider($this->connection, $this->timeFactory, 3600); + $this->connection = Server::get(IDBConnection::class); + return new DBLockingProvider($this->connection, $this->timeFactory, 3600); } protected function tearDown(): void { diff --git a/tests/lib/Lock/LockingProvider.php b/tests/lib/Lock/LockingProvider.php index b7e301c55a6..2f4407a8659 100644 --- a/tests/lib/Lock/LockingProvider.php +++ b/tests/lib/Lock/LockingProvider.php @@ -61,7 +61,7 @@ abstract class LockingProvider extends TestCase { public function testDoubleExclusiveLock(): void { - $this->expectException(\OCP\Lock\LockedException::class); + $this->expectException(LockedException::class); $this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE); $this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE)); @@ -78,7 +78,7 @@ abstract class LockingProvider extends TestCase { public function testExclusiveLockAfterShared(): void { - $this->expectException(\OCP\Lock\LockedException::class); + $this->expectException(LockedException::class); $this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED); $this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED)); @@ -152,7 +152,7 @@ abstract class LockingProvider extends TestCase { public function testSharedLockAfterExclusive(): void { - $this->expectException(\OCP\Lock\LockedException::class); + $this->expectException(LockedException::class); $this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE); $this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE)); @@ -199,7 +199,7 @@ abstract class LockingProvider extends TestCase { public function testChangeLockToExclusiveDoubleShared(): void { - $this->expectException(\OCP\Lock\LockedException::class); + $this->expectException(LockedException::class); $this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED); $this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED); @@ -208,14 +208,14 @@ abstract class LockingProvider extends TestCase { public function testChangeLockToExclusiveNoShared(): void { - $this->expectException(\OCP\Lock\LockedException::class); + $this->expectException(LockedException::class); $this->instance->changeLock('foo', ILockingProvider::LOCK_EXCLUSIVE); } public function testChangeLockToExclusiveFromExclusive(): void { - $this->expectException(\OCP\Lock\LockedException::class); + $this->expectException(LockedException::class); $this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE); $this->instance->changeLock('foo', ILockingProvider::LOCK_EXCLUSIVE); @@ -223,14 +223,14 @@ abstract class LockingProvider extends TestCase { public function testChangeLockToSharedNoExclusive(): void { - $this->expectException(\OCP\Lock\LockedException::class); + $this->expectException(LockedException::class); $this->instance->changeLock('foo', ILockingProvider::LOCK_SHARED); } public function testChangeLockToSharedFromShared(): void { - $this->expectException(\OCP\Lock\LockedException::class); + $this->expectException(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 a698be65aaf..ec8ded11d1e 100644 --- a/tests/lib/Lock/MemcacheLockingProviderTest.php +++ b/tests/lib/Lock/MemcacheLockingProviderTest.php @@ -7,8 +7,10 @@ namespace Test\Lock; +use OC\Lock\MemcacheLockingProvider; use OC\Memcache\ArrayCache; use OCP\AppFramework\Utility\ITimeFactory; +use OCP\Server; class MemcacheLockingProviderTest extends LockingProvider { /** @@ -21,8 +23,8 @@ class MemcacheLockingProviderTest extends LockingProvider { */ protected function getInstance() { $this->memcache = new ArrayCache(); - $timeProvider = \OC::$server->get(ITimeFactory::class); - return new \OC\Lock\MemcacheLockingProvider($this->memcache, $timeProvider); + $timeProvider = Server::get(ITimeFactory::class); + return new MemcacheLockingProvider($this->memcache, $timeProvider); } protected function tearDown(): void { diff --git a/tests/lib/Lock/NonCachingDBLockingProviderTest.php b/tests/lib/Lock/NonCachingDBLockingProviderTest.php index b79709a08e7..ad4100a3afd 100644 --- a/tests/lib/Lock/NonCachingDBLockingProviderTest.php +++ b/tests/lib/Lock/NonCachingDBLockingProviderTest.php @@ -6,7 +6,10 @@ namespace Test\Lock; +use OC\Lock\DBLockingProvider; +use OCP\IDBConnection; use OCP\Lock\ILockingProvider; +use OCP\Server; /** * @group DB @@ -18,8 +21,8 @@ class NonCachingDBLockingProviderTest extends DBLockingProviderTest { * @return \OCP\Lock\ILockingProvider */ protected function getInstance() { - $this->connection = \OC::$server->getDatabaseConnection(); - return new \OC\Lock\DBLockingProvider($this->connection, $this->timeFactory, 3600, false); + $this->connection = Server::get(IDBConnection::class); + return new DBLockingProvider($this->connection, $this->timeFactory, 3600, false); } public function testDoubleShared(): void { |