RiakCacheTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace Doctrine\Tests\Common\Cache;
  3. use Riak\Bucket;
  4. use Riak\Connection;
  5. use Riak\Exception;
  6. use Doctrine\Common\Cache\RiakCache;
  7. /**
  8. * RiakCache test
  9. *
  10. * @group Riak
  11. */
  12. class RiakCacheTest extends CacheTest
  13. {
  14. /**
  15. * @var \Riak\Connection
  16. */
  17. private $connection;
  18. /**
  19. * @var \Riak\Bucket
  20. */
  21. private $bucket;
  22. /**
  23. * {@inheritdoc}
  24. */
  25. public function setUp()
  26. {
  27. if ( ! extension_loaded('riak')) {
  28. $this->markTestSkipped('The ' . __CLASS__ .' requires the use of Riak');
  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('The ' . __CLASS__ .' requires the use of Riak');
  35. }
  36. }
  37. /**
  38. * {@inheritdoc}
  39. */
  40. public function testGetStats()
  41. {
  42. $cache = $this->_getCacheDriver();
  43. $stats = $cache->getStats();
  44. $this->assertNull($stats);
  45. }
  46. /**
  47. * Retrieve RiakCache instance.
  48. *
  49. * @return \Doctrine\Common\Cache\RiakCache
  50. */
  51. protected function _getCacheDriver()
  52. {
  53. return new RiakCache($this->bucket);
  54. }
  55. }