Passed
Push — master ( dba830...8c74b2 )
by Adam
02:04
created

RedisCacheTest::setUp()   A

Complexity

Conditions 4
Paths 6

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 5
Bugs 0 Features 0
Metric Value
dl 0
loc 14
rs 9.2
c 5
b 0
f 0
cc 4
eloc 10
nc 6
nop 0
1
<?php
2
namespace DBAL\Tests\Caching;
3
4
use DBAL\Caching\RedisCache;
5
6
class RedisCacheTest extends CacheTest{
7
    
8
    protected $port = 6379;
9
    
10
    /**
11
     * @covers \DBAL\Caching\RedisCache::__construct
12
     * @covers \DBAL\Caching\RedisCache::connect
13
     * @covers \DBAL\Caching\RedisCache::addServer
14
     * @covers \DBAL\Caching\RedisCache::save
15
     * @covers \DBAL\Caching\RedisCache::fetch
16
     */
17
    public function setUp() {
18
        $success = false;
19
        $this->cache = new RedisCache();
20
        $this->cache->connect('127.0.0.1', $this->port);
21
        if ($this->cache->save('test', 'Success')) {
22
            if ($this->cache->fetch('test') == 'Success') {
23
                $success = true;
24
                parent::setUp();
25
            }
26
        }
27
        if($success !== true){
28
            $this->markTestSkipped('Redis extension may not be loaded');
29
        }
30
    }
31
    
32
}
33