Completed
Push — master ( e1f38a...73ba45 )
by Marco
10s
created

RiakCacheTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 3
dl 0
loc 41
rs 10
1
<?php
2
3
namespace Doctrine\Tests\Common\Cache;
4
5
use Doctrine\Common\Cache\CacheProvider;
6
use Doctrine\Common\Cache\RiakCache;
7
use Riak\Bucket;
8
use Riak\Connection;
9
use Riak\Exception;
10
11
/**
12
 * RiakCache test
13
 *
14
 * @group Riak
15
 * @requires extension riak
16
 */
17
class RiakCacheTest extends CacheTest
18
{
19
    /** @var Connection */
20
    private $connection;
21
22
    /** @var Bucket */
23
    private $bucket;
24
25
    protected function setUp() : void
26
    {
27
        try {
28
            $this->connection = new Connection('127.0.0.1', 8087);
29
            $this->bucket     = new Bucket($this->connection, 'test');
30
        } catch (Exception\RiakException $e) {
31
            $this->markTestSkipped('Cannot connect to Riak.');
32
        }
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function testGetStats() : void
39
    {
40
        $cache = $this->_getCacheDriver();
41
        $stats = $cache->getStats();
42
43
        self::assertNull($stats);
44
    }
45
46
    /**
47
     * Retrieve RiakCache instance.
48
     */
49
    protected function _getCacheDriver() : CacheProvider
50
    {
51
        return new RiakCache($this->bucket);
52
    }
53
}
54