]> git.mxchange.org Git - friendica.git/blobdiff - tests/src/Core/Cache/RedisCacheDriverTest.php
Refactor ConfigMockTrait to mocked ConfigCache
[friendica.git] / tests / src / Core / Cache / RedisCacheDriverTest.php
index 158534602a32921669eddeb7c75c80aa1b223e0b..0a3dba439d83ace9f5b254667e06d73e50de131f 100644 (file)
@@ -3,36 +3,32 @@
 
 namespace Friendica\Test\src\Core\Cache;
 
-
 use Friendica\Core\Cache\CacheDriverFactory;
 
+/**
+ * @requires extension redis
+ */
 class RedisCacheDriverTest extends MemoryCacheTest
 {
-       /**
-        * @var \Friendica\Core\Cache\IMemoryCacheDriver
-        */
-       private $cache;
-
        protected function getInstance()
        {
-               if (class_exists('Redis')) {
-                       try {
-                               $this->cache = CacheDriverFactory::create('redis');
-                       } catch (\Exception $exception) {
-                               throw new \Exception("Redis - TestCase failed: " . $exception->getMessage(), $exception->getCode(), $exception);
-                       }
-                       return $this->cache;
-               } else {
-                       $this->markTestSkipped('Redis driver isn\'t available');
-                       return null;
-               }
+               $this->configCache
+                       ->shouldReceive('get')
+                       ->with('system', 'redis_host', NULL)
+                       ->andReturn('localhost');
+
+               $this->configCache
+                       ->shouldReceive('get')
+                       ->with('system', 'redis_port', NULL)
+                       ->andReturn(null);
+
+               $this->cache = CacheDriverFactory::create('redis');
+               return $this->cache;
        }
 
        public function tearDown()
        {
-               if (class_exists('Redis')) {
-                       $this->cache->clear(false);
-               }
+               $this->cache->clear(false);
                parent::tearDown();
        }
 }