]> git.mxchange.org Git - friendica.git/blob - tests/src/Core/Cache/RedisCacheDriverTest.php
e13d95df4d7f4319715c656af9405315b9262ed3
[friendica.git] / tests / src / Core / Cache / RedisCacheDriverTest.php
1 <?php
2
3
4 namespace Friendica\Test\src\Core\Cache;
5
6
7 use Friendica\Core\Cache\CacheDriverFactory;
8
9 class RedisCacheDriverTest extends MemoryCacheTest
10 {
11         /**
12          * @var \Friendica\Core\Cache\IMemoryCacheDriver
13          */
14         private $cache;
15
16         protected function getInstance()
17         {
18                 if (class_exists('Redis')) {
19                         try {
20                                 $this->cache = CacheDriverFactory::create('redis');
21                         } catch (\Exception $exception) {
22                                 print "Redis - TestCase failed: " . $exception->getMessage();
23                                 throw new \Exception();
24                         }
25                         return $this->cache;
26                 } else {
27                         $this->markTestSkipped('Redis driver isn\'t available');
28                         return null;
29                 }
30         }
31
32         public function tearDown()
33         {
34                 if (class_exists('Redis')) {
35                         $this->cache->clear(false);
36                 }
37                 parent::tearDown();
38         }
39 }