Passed
Push — master ( b006d5...d6dac1 )
by Mihail
09:00 queued 06:14
created

MemcachedTest::setUp()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 16
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
cc 3
eloc 9
nc 4
nop 0
dl 0
loc 16
rs 9.9666
c 4
b 0
f 0
1
<?php
2
3
namespace Koded\Caching;
4
5
use Koded\Caching\Client\CacheClientFactory;
6
use Koded\Caching\Configuration\ConfigFactory;
7
use PHPUnit\Framework\TestCase;
8
9
class MemcachedTest extends TestCase
10
{
11
    use SimpleCacheTestCaseTrait;
12
13
    public function test_should_return_memcached_client()
14
    {
15
        $this->assertInstanceOf(\Memcached::class, $this->cache->client());
16
    }
17
18
    protected function setUp(): void
19
    {
20
        putenv('CACHE_CLIENT=memcached');
21
22
        if (false === extension_loaded('memcached')) {
23
            $this->markTestSkipped('Memcached extension is not loaded.');
24
        }
25
26
        if (getenv('CI')) {
27
            putenv('MEMCACHED_POOL=[["127.0.0.1", 11211]]');
28
        } else {
29
            putenv('MEMCACHED_POOL=[["memcached", 11211]]');
30
        }
31
32
        $this->cache = (new CacheClientFactory(new ConfigFactory))->new();
33
        $this->cache->clear();
34
    }
35
}