e7d5f3dd33dd2abdd3a1021be727f15bde12655e
[yaffs-website] / vendor / doctrine / cache / tests / Doctrine / Tests / Common / Cache / RiakCacheTest.php
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 }