<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2022, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
namespace Friendica\Test\src\Core\Lock;
use Exception;
-use Friendica\Core\Cache\RedisCache;
-use Friendica\Core\Config\IConfig;
-use Friendica\Core\Lock\CacheLock;
+use Friendica\Core\Cache\Type\RedisCache;
+use Friendica\Core\Config\Capability\IManageConfigValues;
+use Friendica\Core\Lock\Type\CacheLock;
use Mockery;
/**
{
protected function getInstance()
{
- $configMock = Mockery::mock(IConfig::class);
+ $configMock = Mockery::mock(IManageConfigValues::class);
$host = $_SERVER['REDIS_HOST'] ?? 'localhost';
- $port = $_SERVER['REDIS_PORT'] ?? null;
+ $port = $_SERVER['REDIS_PORT'] ?? 6379;
$configMock
->shouldReceive('get')
$configMock
->shouldReceive('get')
->with('system', 'redis_db', 0)
- ->andReturn(3);
+ ->andReturn(0);
$configMock
->shouldReceive('get')
->with('system', 'redis_password')
try {
$cache = new RedisCache($host, $configMock);
- $lock = new CacheLock($cache);
+ $lock = new \Friendica\Core\Lock\Type\CacheLock($cache);
} catch (Exception $e) {
- static::markTestSkipped('Redis is not available');
+ static::markTestSkipped('Redis is not available. Error: ' . $e->getMessage());
}
return $lock;