Fix Cache tests

This commit is contained in:
Philipp 2020-08-19 14:09:16 +02:00
parent 16591077ac
commit 6ad27183a1
No known key found for this signature in database
GPG key ID: 9A28B7D4FF5667BD
7 changed files with 16 additions and 7 deletions

View file

@ -38,7 +38,7 @@ jobs:
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
tools: pecl tools: pecl
extensions: pdo_mysql, gd, zip, opcache, ctype, pcntl, ldap, apcu, memcached, redis, imagick extensions: pdo_mysql, gd, zip, opcache, ctype, pcntl, ldap, apcu, memcached, redis, imagick, memcache
coverage: xdebug coverage: xdebug
ini-values: apc.enabled=1, apc.enable_cli=1 ini-values: apc.enabled=1, apc.enable_cli=1
@ -90,6 +90,9 @@ jobs:
MYSQL_DATABASE: test MYSQL_DATABASE: test
MYSQL_PASSWORD: test MYSQL_PASSWORD: test
MYSQL_USER: test MYSQL_USER: test
REDIS_PORT: ${{ job.services.redis.ports[6379] }}
MEMCACHED_PORT: ${{ job.services.memcached.ports[11211] }}
MEMCACHE_PORT: ${{ job.services.memcached.ports[11211] }}
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
uses: codecov/codecov-action@v1 uses: codecov/codecov-action@v1

View file

@ -35,6 +35,7 @@ class MemcacheCacheTest extends MemoryCacheTest
$configMock = \Mockery::mock(IConfig::class); $configMock = \Mockery::mock(IConfig::class);
$host = $_SERVER['MEMCACHE_HOST'] ?? 'localhost'; $host = $_SERVER['MEMCACHE_HOST'] ?? 'localhost';
$port = $_SERVER['MEMCACHE_PORT'] ?? '11211';
$configMock $configMock
->shouldReceive('get') ->shouldReceive('get')
@ -43,7 +44,7 @@ class MemcacheCacheTest extends MemoryCacheTest
$configMock $configMock
->shouldReceive('get') ->shouldReceive('get')
->with('system', 'memcache_port') ->with('system', 'memcache_port')
->andReturn(11211); ->andReturn($port);
try { try {
$this->cache = new MemcacheCache($host, $configMock); $this->cache = new MemcacheCache($host, $configMock);

View file

@ -36,11 +36,12 @@ class MemcachedCacheTest extends MemoryCacheTest
$configMock = \Mockery::mock(IConfig::class); $configMock = \Mockery::mock(IConfig::class);
$host = $_SERVER['MEMCACHED_HOST'] ?? 'localhost'; $host = $_SERVER['MEMCACHED_HOST'] ?? 'localhost';
$port = $_SERVER['MEMCACHED_PORT'] ?? '11211';
$configMock $configMock
->shouldReceive('get') ->shouldReceive('get')
->with('system', 'memcached_hosts') ->with('system', 'memcached_hosts')
->andReturn([0 => $host . ', 11211']); ->andReturn([0 => $host . ', ' . $port]);
$logger = new NullLogger(); $logger = new NullLogger();

View file

@ -35,6 +35,7 @@ class RedisCacheTest extends MemoryCacheTest
$configMock = \Mockery::mock(IConfig::class); $configMock = \Mockery::mock(IConfig::class);
$host = $_SERVER['REDIS_HOST'] ?? 'localhost'; $host = $_SERVER['REDIS_HOST'] ?? 'localhost';
$port = $_SERVER['REDIS_PORT'] ?? null;
$configMock $configMock
->shouldReceive('get') ->shouldReceive('get')
@ -43,7 +44,7 @@ class RedisCacheTest extends MemoryCacheTest
$configMock $configMock
->shouldReceive('get') ->shouldReceive('get')
->with('system', 'redis_port') ->with('system', 'redis_port')
->andReturn(null); ->andReturn($port);
$configMock $configMock
->shouldReceive('get') ->shouldReceive('get')

View file

@ -36,6 +36,7 @@ class MemcacheCacheLockTest extends LockTest
$configMock = \Mockery::mock(IConfig::class); $configMock = \Mockery::mock(IConfig::class);
$host = $_SERVER['MEMCACHE_HOST'] ?? 'localhost'; $host = $_SERVER['MEMCACHE_HOST'] ?? 'localhost';
$port = $_SERVER['MEMCACHE_PORT'] ?? '11211';
$configMock $configMock
->shouldReceive('get') ->shouldReceive('get')
@ -44,7 +45,7 @@ class MemcacheCacheLockTest extends LockTest
$configMock $configMock
->shouldReceive('get') ->shouldReceive('get')
->with('system', 'memcache_port') ->with('system', 'memcache_port')
->andReturn(11211); ->andReturn($port);
$lock = null; $lock = null;

View file

@ -37,11 +37,12 @@ class MemcachedCacheLockTest extends LockTest
$configMock = \Mockery::mock(IConfig::class); $configMock = \Mockery::mock(IConfig::class);
$host = $_SERVER['MEMCACHED_HOST'] ?? 'localhost'; $host = $_SERVER['MEMCACHED_HOST'] ?? 'localhost';
$port = $_SERVER['MEMCACHED_PORT'] ?? '11211';
$configMock $configMock
->shouldReceive('get') ->shouldReceive('get')
->with('system', 'memcached_hosts') ->with('system', 'memcached_hosts')
->andReturn([0 => $host . ', 11211']); ->andReturn([0 => $host . ', ' . $port]);
$logger = new NullLogger(); $logger = new NullLogger();

View file

@ -36,6 +36,7 @@ class RedisCacheLockTest extends LockTest
$configMock = \Mockery::mock(IConfig::class); $configMock = \Mockery::mock(IConfig::class);
$host = $_SERVER['REDIS_HOST'] ?? 'localhost'; $host = $_SERVER['REDIS_HOST'] ?? 'localhost';
$port = $_SERVER['REDIS_PORT'] ?? null;
$configMock $configMock
->shouldReceive('get') ->shouldReceive('get')
@ -44,7 +45,7 @@ class RedisCacheLockTest extends LockTest
$configMock $configMock
->shouldReceive('get') ->shouldReceive('get')
->with('system', 'redis_port') ->with('system', 'redis_port')
->andReturn(null); ->andReturn($port);
$configMock $configMock
->shouldReceive('get') ->shouldReceive('get')