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\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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue