]> git.mxchange.org Git - friendica.git/blobdiff - tests/src/Core/Lock/RedisCacheLockDriverTest.php
Bugfix ConfigCacheLoaderTest
[friendica.git] / tests / src / Core / Lock / RedisCacheLockDriverTest.php
index 82d9b50def7aa8706b83a38d2303e62fc203ae4d..d21f3b6d8621dd1d9134780f7bf928d9a2f5b450 100644 (file)
@@ -3,38 +3,26 @@
 
 namespace Friendica\Test\src\Core\Lock;
 
-
-use Friendica\Core\Cache\CacheDriverFactory;
+use Friendica\Factory\CacheDriverFactory;
 use Friendica\Core\Lock\CacheLockDriver;
 
+/**
+ * @requires extension redis
+ */
 class RedisCacheLockDriverTest extends LockTest
 {
-       /**
-        * @var \Friendica\Core\Cache\IMemoryCacheDriver
-        */
-       private $cache;
-
        protected function getInstance()
        {
-               if (class_exists('Redis')) {
-                       try {
-                               $this->cache = CacheDriverFactory::create('redis');
-                       } catch (\Exception $exception) {
-                               print "Redis - TestCase failed: " . $exception->getMessage();
-                               throw new \Exception();
-                       }
-                       return new CacheLockDriver($this->cache);
-               } else {
-                       $this->markTestSkipped('Redis driver isn\'t available');
-                       return null;
-               }
-       }
+               $this->configMock
+                       ->shouldReceive('get')
+                       ->with('system', 'redis_host')
+                       ->andReturn('localhost');
 
-       public function tearDown()
-       {
-               if (class_exists('Redis')) {
-                       $this->cache->clear();
-               }
-               parent::tearDown();
+               $this->configMock
+                       ->shouldReceive('get')
+                       ->with('system', 'redis_port')
+                       ->andReturn(null);
+
+               return new CacheLockDriver(CacheDriverFactory::create('redis'));
        }
 }