From 6ad27183a1a5bb73592d0c5ce6e0e41aeff537f5 Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 19 Aug 2020 14:09:16 +0200 Subject: [PATCH] Fix Cache tests --- .github/workflows/php.yml | 5 ++++- tests/src/Core/Cache/MemcacheCacheTest.php | 3 ++- tests/src/Core/Cache/MemcachedCacheTest.php | 3 ++- tests/src/Core/Cache/RedisCacheTest.php | 3 ++- tests/src/Core/Lock/MemcacheCacheLockTest.php | 3 ++- tests/src/Core/Lock/MemcachedCacheLockTest.php | 3 ++- tests/src/Core/Lock/RedisCacheLockTest.php | 3 ++- 7 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index c905ee877..eabd28ff6 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -38,7 +38,7 @@ jobs: with: php-version: ${{ matrix.php-versions }} 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 ini-values: apc.enabled=1, apc.enable_cli=1 @@ -90,6 +90,9 @@ jobs: MYSQL_DATABASE: test MYSQL_PASSWORD: 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 uses: codecov/codecov-action@v1 diff --git a/tests/src/Core/Cache/MemcacheCacheTest.php b/tests/src/Core/Cache/MemcacheCacheTest.php index ed69d887a..44600d5ee 100644 --- a/tests/src/Core/Cache/MemcacheCacheTest.php +++ b/tests/src/Core/Cache/MemcacheCacheTest.php @@ -35,6 +35,7 @@ class MemcacheCacheTest extends MemoryCacheTest $configMock = \Mockery::mock(IConfig::class); $host = $_SERVER['MEMCACHE_HOST'] ?? 'localhost'; + $port = $_SERVER['MEMCACHE_PORT'] ?? '11211'; $configMock ->shouldReceive('get') @@ -43,7 +44,7 @@ class MemcacheCacheTest extends MemoryCacheTest $configMock ->shouldReceive('get') ->with('system', 'memcache_port') - ->andReturn(11211); + ->andReturn($port); try { $this->cache = new MemcacheCache($host, $configMock); diff --git a/tests/src/Core/Cache/MemcachedCacheTest.php b/tests/src/Core/Cache/MemcachedCacheTest.php index 5fe96ddae..c6ec48a4b 100644 --- a/tests/src/Core/Cache/MemcachedCacheTest.php +++ b/tests/src/Core/Cache/MemcachedCacheTest.php @@ -36,11 +36,12 @@ class MemcachedCacheTest extends MemoryCacheTest $configMock = \Mockery::mock(IConfig::class); $host = $_SERVER['MEMCACHED_HOST'] ?? 'localhost'; + $port = $_SERVER['MEMCACHED_PORT'] ?? '11211'; $configMock ->shouldReceive('get') ->with('system', 'memcached_hosts') - ->andReturn([0 => $host . ', 11211']); + ->andReturn([0 => $host . ', ' . $port]); $logger = new NullLogger(); diff --git a/tests/src/Core/Cache/RedisCacheTest.php b/tests/src/Core/Cache/RedisCacheTest.php index 821c3c5cf..543137ca0 100644 --- a/tests/src/Core/Cache/RedisCacheTest.php +++ b/tests/src/Core/Cache/RedisCacheTest.php @@ -35,6 +35,7 @@ class RedisCacheTest extends MemoryCacheTest $configMock = \Mockery::mock(IConfig::class); $host = $_SERVER['REDIS_HOST'] ?? 'localhost'; + $port = $_SERVER['REDIS_PORT'] ?? null; $configMock ->shouldReceive('get') @@ -43,7 +44,7 @@ class RedisCacheTest extends MemoryCacheTest $configMock ->shouldReceive('get') ->with('system', 'redis_port') - ->andReturn(null); + ->andReturn($port); $configMock ->shouldReceive('get') diff --git a/tests/src/Core/Lock/MemcacheCacheLockTest.php b/tests/src/Core/Lock/MemcacheCacheLockTest.php index 8008cb0ee..f4aab0602 100644 --- a/tests/src/Core/Lock/MemcacheCacheLockTest.php +++ b/tests/src/Core/Lock/MemcacheCacheLockTest.php @@ -36,6 +36,7 @@ class MemcacheCacheLockTest extends LockTest $configMock = \Mockery::mock(IConfig::class); $host = $_SERVER['MEMCACHE_HOST'] ?? 'localhost'; + $port = $_SERVER['MEMCACHE_PORT'] ?? '11211'; $configMock ->shouldReceive('get') @@ -44,7 +45,7 @@ class MemcacheCacheLockTest extends LockTest $configMock ->shouldReceive('get') ->with('system', 'memcache_port') - ->andReturn(11211); + ->andReturn($port); $lock = null; diff --git a/tests/src/Core/Lock/MemcachedCacheLockTest.php b/tests/src/Core/Lock/MemcachedCacheLockTest.php index 232f78714..f41bf9920 100644 --- a/tests/src/Core/Lock/MemcachedCacheLockTest.php +++ b/tests/src/Core/Lock/MemcachedCacheLockTest.php @@ -37,11 +37,12 @@ class MemcachedCacheLockTest extends LockTest $configMock = \Mockery::mock(IConfig::class); $host = $_SERVER['MEMCACHED_HOST'] ?? 'localhost'; + $port = $_SERVER['MEMCACHED_PORT'] ?? '11211'; $configMock ->shouldReceive('get') ->with('system', 'memcached_hosts') - ->andReturn([0 => $host . ', 11211']); + ->andReturn([0 => $host . ', ' . $port]); $logger = new NullLogger(); diff --git a/tests/src/Core/Lock/RedisCacheLockTest.php b/tests/src/Core/Lock/RedisCacheLockTest.php index fb9bc80b7..62b15bc7c 100644 --- a/tests/src/Core/Lock/RedisCacheLockTest.php +++ b/tests/src/Core/Lock/RedisCacheLockTest.php @@ -36,6 +36,7 @@ class RedisCacheLockTest extends LockTest $configMock = \Mockery::mock(IConfig::class); $host = $_SERVER['REDIS_HOST'] ?? 'localhost'; + $port = $_SERVER['REDIS_PORT'] ?? null; $configMock ->shouldReceive('get') @@ -44,7 +45,7 @@ class RedisCacheLockTest extends LockTest $configMock ->shouldReceive('get') ->with('system', 'redis_port') - ->andReturn(null); + ->andReturn($port); $configMock ->shouldReceive('get')