redis.php 934 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. namespace Test\Memcache;
  9. class Redis extends Cache {
  10. static public function setUpBeforeClass() {
  11. parent::setUpBeforeClass();
  12. if (!\OC\Memcache\Redis::isAvailable()) {
  13. self::markTestSkipped('The redis extension is not available.');
  14. }
  15. set_error_handler(
  16. function($errno, $errstr) {
  17. restore_error_handler();
  18. self::markTestSkipped($errstr);
  19. },
  20. E_WARNING
  21. );
  22. $instance = new \OC\Memcache\Redis(self::getUniqueID());
  23. restore_error_handler();
  24. if ($instance->set(self::getUniqueID(), self::getUniqueID()) === false) {
  25. self::markTestSkipped('redis server seems to be down.');
  26. }
  27. }
  28. protected function setUp() {
  29. parent::setUp();
  30. $this->instance = new \OC\Memcache\Redis($this->getUniqueID());
  31. }
  32. }