Completed
Push — master ( a8b991...dda2b8 )
by Marco
06:05 queued 02:56
created

RiakCacheTest::setUp()   A

Complexity

Conditions 2
Paths 3

Size

Total Lines 9
Code Lines 6

Duplication

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