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