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\MemcachedCache;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\Lock\Type\CacheLock;
use Friendica\Test\CacheLockTestCase;
use Friendica\Test\LockTestCase;
use Mockery;
use Psr\Log\NullLogger;
@ -19,9 +21,12 @@ use Psr\Log\NullLogger;
* @requires extension memcached
* @group MEMCACHED
*/
class MemcachedCacheLockTest extends LockTestCase
class MemcachedCacheLockTest extends CacheLockTestCase
{
protected function getInstance()
private MemcachedCache $cache;
private CacheLock $lock;
protected function setUp(): void
{
$configMock = Mockery::mock(IManageConfigValues::class);
@ -35,16 +40,24 @@ class MemcachedCacheLockTest extends LockTestCase
$logger = new NullLogger();
$lock = null;
try {
$cache = new MemcachedCache($host, $configMock, $logger);
$lock = new CacheLock($cache);
$this->cache = new MemcachedCache($host, $configMock, $logger);
$this->lock = new CacheLock($this->cache);
} catch (Exception $e) {
static::markTestSkipped('Memcached is not available');
}
return $lock;
parent::setUp();
}
protected function getInstance(): CacheLock
{
return $this->lock;
}
protected function getCache(): ICanCacheInMemory
{
return $this->cache;
}
/**