friendica/tests/src/Core/Cache/MemcacheCacheDriverTest.php

40 lines
758 B
PHP
Raw Normal View History

2018-07-07 20:07:07 +02:00
<?php
namespace Friendica\Test\src\Core\Cache;
use Friendica\Core\Cache\CacheDriverFactory;
2018-07-07 20:35:42 +02:00
class MemcacheCacheDriverTest extends MemoryCacheTest
2018-07-07 20:07:07 +02:00
{
/**
* @var \Friendica\Core\Cache\IMemoryCacheDriver
*/
private $cache;
protected function getInstance()
{
if (class_exists('Memcache')) {
try {
$this->cache = CacheDriverFactory::create('memcache');
} catch (\Exception $exception) {
print "Memcache - TestCase failed: " . $exception->getMessage();
throw new \Exception();
}
return $this->cache;
} else {
$this->markTestSkipped('Memcache driver isn\'t available');
return null;
}
}
public function tearDown()
{
if (class_exists('Memcache')) {
2018-07-07 20:35:42 +02:00
$this->cache->clear(false);
2018-07-07 20:07:07 +02:00
}
parent::tearDown();
}
}