RedisProfilerStorageTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\HttpKernel\Tests\Profiler;
  11. use Symfony\Component\HttpKernel\Profiler\RedisProfilerStorage;
  12. use Symfony\Component\HttpKernel\Tests\Profiler\Mock\RedisMock;
  13. /**
  14. * @group legacy
  15. */
  16. class RedisProfilerStorageTest extends AbstractProfilerStorageTest
  17. {
  18. protected static $storage;
  19. protected function setUp()
  20. {
  21. $redisMock = new RedisMock();
  22. $redisMock->connect('127.0.0.1', 6379);
  23. self::$storage = new RedisProfilerStorage('redis://127.0.0.1:6379', '', '', 86400);
  24. self::$storage->setRedis($redisMock);
  25. if (self::$storage) {
  26. self::$storage->purge();
  27. }
  28. }
  29. protected function tearDown()
  30. {
  31. if (self::$storage) {
  32. self::$storage->purge();
  33. self::$storage = false;
  34. }
  35. }
  36. /**
  37. * @return \Symfony\Component\HttpKernel\Profiler\ProfilerStorageInterface
  38. */
  39. protected function getStorage()
  40. {
  41. return self::$storage;
  42. }
  43. }