mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-08 00:04:27 +02:00
Add a bunch of tests for StatsCaching
This commit is contained in:
parent
892fa595da
commit
b222aa0c48
15 changed files with 477 additions and 43 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue