RiakCacheTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. * @requires extension riak
  12. */
  13. class RiakCacheTest extends CacheTest
  14. {
  15. /**
  16. * @var \Riak\Connection
  17. */
  18. private $connection;
  19. /**
  20. * @var \Riak\Bucket
  21. */
  22. private $bucket;
  23. protected function setUp()
  24. {
  25. try {
  26. $this->connection = new Connection('127.0.0.1', 8087);
  27. $this->bucket = new Bucket($this->connection, 'test');
  28. } catch (Exception\RiakException $e) {
  29. $this->markTestSkipped('Cannot connect to Riak.');
  30. }
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. public function testGetStats()
  36. {
  37. $cache = $this->_getCacheDriver();
  38. $stats = $cache->getStats();
  39. $this->assertNull($stats);
  40. }
  41. /**
  42. * Retrieve RiakCache instance.
  43. *
  44. * @return \Doctrine\Common\Cache\RiakCache
  45. */
  46. protected function _getCacheDriver()
  47. {
  48. return new RiakCache($this->bucket);
  49. }
  50. }