]> git.mxchange.org Git - friendica.git/blob - tests/src/Core/Cache/MemcachedCacheTest.php
Merge pull request #8079 from ozero/patch-1
[friendica.git] / tests / src / Core / Cache / MemcachedCacheTest.php
1 <?php
2
3
4 namespace Friendica\Test\src\Core\Cache;
5
6 use Friendica\Core\Cache\MemcachedCache;
7 use Friendica\Core\Config\IConfiguration;
8 use Psr\Log\NullLogger;
9
10 /**
11  * @requires extension memcached
12  * @group MEMCACHED
13  */
14 class MemcachedCacheTest extends MemoryCacheTest
15 {
16         protected function getInstance()
17         {
18                 $configMock = \Mockery::mock(IConfiguration::class);
19
20                 $host = $_SERVER['MEMCACHED_HOST'] ?? 'localhost';
21
22                 $configMock
23                         ->shouldReceive('get')
24                         ->with('system', 'memcached_hosts')
25                         ->andReturn([0 => $host . ', 11211']);
26
27                 $logger = new NullLogger();
28
29                 try {
30                         $this->cache = new MemcachedCache($host, $configMock, $logger);
31                 } catch (\Exception $exception) {
32                         $this->markTestSkipped('Memcached is not available');
33                 }
34                 return $this->cache;
35         }
36
37         public function tearDown()
38         {
39                 $this->cache->clear(false);
40                 parent::tearDown();
41         }
42
43         /**
44          * @small
45          *
46          * @dataProvider dataSimple
47          */
48         public function testGetAllKeys($value1, $value2, $value3)
49         {
50                 $this->markTestIncomplete('Race condition because of too fast getAllKeys() which uses a workaround');
51         }
52 }