DriverCallCheckStub.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. /**
  14. * DriverExceptionStub is used for testing how Stash reacts to thrown errors. Every function but the constructor throws
  15. * an exception.
  16. *
  17. * @package Stash
  18. * @author Robert Hafner <tedivm@tedivm.com>
  19. *
  20. * @codeCoverageIgnore
  21. */
  22. class DriverCallCheckStub extends AbstractDriver
  23. {
  24. protected $store = array();
  25. protected $wasCalled = false;
  26. public function getData($key)
  27. {
  28. $this->wasCalled = true;
  29. }
  30. protected function getKeyIndex($key)
  31. {
  32. $this->wasCalled = true;
  33. }
  34. public function storeData($key, $data, $expiration)
  35. {
  36. $this->wasCalled = true;
  37. }
  38. public function clear($key = null)
  39. {
  40. $this->wasCalled = true;
  41. }
  42. public function purge()
  43. {
  44. $this->wasCalled = true;
  45. }
  46. public function wasCalled()
  47. {
  48. return $this->wasCalled;
  49. }
  50. public function canEnable()
  51. {
  52. return (defined('TESTING') && TESTING);
  53. }
  54. public static function isAvailable()
  55. {
  56. return (defined('TESTING') && TESTING);
  57. }
  58. }