Add a bunch of tests for StatsCaching

This commit is contained in:
Philipp 2025-04-27 01:36:30 +02:00
parent 892fa595da
commit b222aa0c48
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
15 changed files with 477 additions and 43 deletions

View file

@ -8,9 +8,11 @@
namespace Friendica\Test\src\Core\Lock;
use Exception;
use Friendica\Core\Cache\Capability\ICanCacheInMemory;
use Friendica\Core\Cache\Type\RedisCache;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\Lock\Type\CacheLock;
use Friendica\Test\CacheLockTestCase;
use Friendica\Test\LockTestCase;
use Mockery;
@ -18,9 +20,9 @@ use Mockery;
* @requires extension redis
* @group REDIS
*/
class RedisCacheLockTest extends LockTestCase
class RedisCacheLockTest extends CacheLockTestCase
{
protected function getInstance()
protected function setUp(): void
{
$configMock = Mockery::mock(IManageConfigValues::class);
@ -45,15 +47,23 @@ class RedisCacheLockTest extends LockTestCase
->with('system', 'redis_password')
->andReturn(null);
$lock = null;
try {
$cache = new RedisCache($host, $configMock);
$lock = new CacheLock($cache);
$this->cache = new RedisCache($host, $configMock);
$this->lock = new CacheLock($this->cache);
} catch (Exception $e) {
static::markTestSkipped('Redis is not available. Error: ' . $e->getMessage());
}
return $lock;
parent::setUp();
}
protected function getInstance(): CAcheLock
{
return $this->lock;
}
protected function getCache(): ICanCacheInMemory
{
return $this->cache;
}
}