]> git.mxchange.org Git - friendica.git/blob - tests/src/Core/Cache/MemcacheCacheDriverTest.php
Merge branch 'develop' into item-activities
[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                                 print "Memcache - TestCase failed: " . $exception->getMessage();
23                                 throw new \Exception();
24                         }
25                         return $this->cache;
26                 } else {
27                         $this->markTestSkipped('Memcache driver isn\'t available');
28                         return null;
29                 }
30         }
31
32         public function tearDown()
33         {
34                 if (class_exists('Memcache')) {
35                         $this->cache->clear(false);
36                 }
37                 parent::tearDown();
38         }
39 }