Rename LockTest to LockTestCase

This commit is contained in:
Art4 2024-12-15 21:15:21 +00:00
parent a676e738e0
commit 75632a1490
8 changed files with 22 additions and 14 deletions

View file

@ -5,12 +5,12 @@
// //
// SPDX-License-Identifier: AGPL-3.0-or-later // SPDX-License-Identifier: AGPL-3.0-or-later
namespace Friendica\Test\src\Core\Lock; namespace Friendica\Test;
use Friendica\Core\Lock\Capability\ICanLock; use Friendica\Core\Lock\Capability\ICanLock;
use Friendica\Test\MockedTestCase; use Friendica\Test\MockedTestCase;
abstract class LockTest extends MockedTestCase abstract class LockTestCase extends MockedTestCase
{ {
/** /**
* @var int Start time of the mock (used for time operations) * @var int Start time of the mock (used for time operations)

View file

@ -9,11 +9,12 @@ namespace Friendica\Test\src\Core\Lock;
use Friendica\Core\Cache\Type\APCuCache; use Friendica\Core\Cache\Type\APCuCache;
use Friendica\Core\Lock\Type\CacheLock; use Friendica\Core\Lock\Type\CacheLock;
use Friendica\Test\LockTestCase;
/** /**
* @group APCU * @group APCU
*/ */
class APCuCacheLockTest extends LockTest class APCuCacheLockTest extends LockTestCase
{ {
protected function setUp(): void protected function setUp(): void
{ {
@ -26,6 +27,6 @@ class APCuCacheLockTest extends LockTest
protected function getInstance() protected function getInstance()
{ {
return new \Friendica\Core\Lock\Type\CacheLock(new APCuCache('localhost')); return new CacheLock(new APCuCache('localhost'));
} }
} }

View file

@ -9,12 +9,13 @@ namespace Friendica\Test\src\Core\Lock;
use Friendica\Core\Cache\Type\ArrayCache; use Friendica\Core\Cache\Type\ArrayCache;
use Friendica\Core\Lock\Type\CacheLock; use Friendica\Core\Lock\Type\CacheLock;
use Friendica\Test\LockTestCase;
class ArrayCacheLockTest extends LockTest class ArrayCacheLockTest extends LockTestCase
{ {
protected function getInstance() protected function getInstance()
{ {
return new \Friendica\Core\Lock\Type\CacheLock(new ArrayCache('localhost')); return new CacheLock(new ArrayCache('localhost'));
} }
/** /**

View file

@ -8,9 +8,10 @@
namespace Friendica\Test\src\Core\Lock; namespace Friendica\Test\src\Core\Lock;
use Friendica\Core\Lock\Type\DatabaseLock; use Friendica\Core\Lock\Type\DatabaseLock;
use Friendica\Test\LockTestCase;
use Friendica\Test\Util\CreateDatabaseTrait; use Friendica\Test\Util\CreateDatabaseTrait;
class DatabaseLockDriverTest extends LockTest class DatabaseLockDriverTest extends LockTestCase
{ {
use CreateDatabaseTrait; use CreateDatabaseTrait;

View file

@ -11,13 +11,14 @@ use Exception;
use Friendica\Core\Cache\Type\MemcacheCache; use Friendica\Core\Cache\Type\MemcacheCache;
use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\Lock\Type\CacheLock; use Friendica\Core\Lock\Type\CacheLock;
use Friendica\Test\LockTestCase;
use Mockery; use Mockery;
/** /**
* @requires extension Memcache * @requires extension Memcache
* @group MEMCACHE * @group MEMCACHE
*/ */
class MemcacheCacheLockTest extends LockTest class MemcacheCacheLockTest extends LockTestCase
{ {
protected function getInstance() protected function getInstance()
{ {
@ -39,7 +40,7 @@ class MemcacheCacheLockTest extends LockTest
try { try {
$cache = new MemcacheCache($host, $configMock); $cache = new MemcacheCache($host, $configMock);
$lock = new \Friendica\Core\Lock\Type\CacheLock($cache); $lock = new CacheLock($cache);
} catch (Exception $e) { } catch (Exception $e) {
static::markTestSkipped('Memcache is not available'); static::markTestSkipped('Memcache is not available');
} }

View file

@ -11,6 +11,7 @@ use Exception;
use Friendica\Core\Cache\Type\MemcachedCache; use Friendica\Core\Cache\Type\MemcachedCache;
use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\Lock\Type\CacheLock; use Friendica\Core\Lock\Type\CacheLock;
use Friendica\Test\LockTestCase;
use Mockery; use Mockery;
use Psr\Log\NullLogger; use Psr\Log\NullLogger;
@ -18,7 +19,7 @@ use Psr\Log\NullLogger;
* @requires extension memcached * @requires extension memcached
* @group MEMCACHED * @group MEMCACHED
*/ */
class MemcachedCacheLockTest extends LockTest class MemcachedCacheLockTest extends LockTestCase
{ {
protected function getInstance() protected function getInstance()
{ {

View file

@ -11,13 +11,14 @@ use Exception;
use Friendica\Core\Cache\Type\RedisCache; use Friendica\Core\Cache\Type\RedisCache;
use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\Lock\Type\CacheLock; use Friendica\Core\Lock\Type\CacheLock;
use Friendica\Test\LockTestCase;
use Mockery; use Mockery;
/** /**
* @requires extension redis * @requires extension redis
* @group REDIS * @group REDIS
*/ */
class RedisCacheLockTest extends LockTest class RedisCacheLockTest extends LockTestCase
{ {
protected function getInstance() protected function getInstance()
{ {
@ -48,7 +49,7 @@ class RedisCacheLockTest extends LockTest
try { try {
$cache = new RedisCache($host, $configMock); $cache = new RedisCache($host, $configMock);
$lock = new \Friendica\Core\Lock\Type\CacheLock($cache); $lock = new CacheLock($cache);
} catch (Exception $e) { } catch (Exception $e) {
static::markTestSkipped('Redis is not available. Error: ' . $e->getMessage()); static::markTestSkipped('Redis is not available. Error: ' . $e->getMessage());
} }

View file

@ -12,12 +12,14 @@ use Friendica\App;
use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\Config\Model\ReadOnlyFileConfig; use Friendica\Core\Config\Model\ReadOnlyFileConfig;
use Friendica\Core\Config\ValueObject\Cache; use Friendica\Core\Config\ValueObject\Cache;
use Friendica\Core\Lock\Type\SemaphoreLock;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\DI; use Friendica\DI;
use Friendica\Test\LockTestCase;
use Mockery; use Mockery;
use Mockery\MockInterface; use Mockery\MockInterface;
class SemaphoreLockTest extends LockTest class SemaphoreLockTest extends LockTestCase
{ {
protected function setUp(): void protected function setUp(): void
{ {
@ -40,7 +42,7 @@ class SemaphoreLockTest extends LockTest
protected function getInstance() protected function getInstance()
{ {
return new \Friendica\Core\Lock\Type\SemaphoreLock(); return new SemaphoreLock();
} }
/** /**