]> git.mxchange.org Git - friendica.git/blobdiff - tests/src/Core/Cache/MemcacheCacheDriverTest.php
Merge pull request #7029 from nupplaphil/task/mod_manifest
[friendica.git] / tests / src / Core / Cache / MemcacheCacheDriverTest.php
index 4dbd10289e717383b790b117f7ecdc83714fbbe8..f8de88ac95a52e3d2b263a5e76e44ed72eb04d6e 100644 (file)
@@ -3,37 +3,33 @@
 
 namespace Friendica\Test\src\Core\Cache;
 
+use Friendica\Factory\CacheDriverFactory;
 
-use Friendica\Core\Cache\CacheDriverFactory;
-
-class MemcachedCacheDriverTest extends CacheTest
+/**
+ * @requires extension memcache
+ */
+class MemcacheCacheDriverTest extends MemoryCacheTest
 {
-       /**
-        * @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;
-               }
+               $this->configMock
+                       ->shouldReceive('get')
+                       ->with('system', 'memcache_host')
+                       ->andReturn('localhost');
+
+               $this->configMock
+                       ->shouldReceive('get')
+                       ->with('system', 'memcache_port')
+                       ->andReturn(11211);
+
+               $this->cache = CacheDriverFactory::create('memcache');
+               return $this->cache;
+
        }
 
        public function tearDown()
        {
-               if (class_exists('Memcache')) {
-                       $this->cache->clear();
-               }
+               $this->cache->clear(false);
                parent::tearDown();
        }
 }