DriverUnavailableStub.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /*
  3. * This file is part of the Stash package.
  4. *
  5. * (c) Robert Hafner <tedivm@tedivm.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 Stash\Test\Stubs;
  11. use Stash;
  12. use Stash\Driver\AbstractDriver;
  13. use Stash\Test\Exception\TestException;
  14. /**
  15. * DriverExceptionStub is used for testing how Stash reacts to thrown errors. Every function but the constructor throws
  16. * an exception.
  17. *
  18. * @package Stash
  19. * @author Robert Hafner <tedivm@tedivm.com>
  20. *
  21. * @codeCoverageIgnore
  22. */
  23. class DriverUnavailableStub extends AbstractDriver
  24. {
  25. protected $store = array();
  26. public function getData($key)
  27. {
  28. throw new TestException('Test exception for ' . __FUNCTION__ . ' call');
  29. }
  30. protected function getKeyIndex($key)
  31. {
  32. throw new TestException('Test exception for ' . __FUNCTION__ . ' call');
  33. }
  34. public function storeData($key, $data, $expiration)
  35. {
  36. throw new TestException('Test exception for ' . __FUNCTION__ . ' call');
  37. }
  38. public function clear($key = null)
  39. {
  40. throw new TestException('Test exception for ' . __FUNCTION__ . ' call');
  41. }
  42. public function purge()
  43. {
  44. throw new TestException('Test exception for ' . __FUNCTION__ . ' call');
  45. }
  46. public function canEnable()
  47. {
  48. return false;
  49. }
  50. public static function isAvailable()
  51. {
  52. return false;
  53. }
  54. }