TwoLevelsBackendTest.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * @package Zend_Cache
  4. * @subpackage UnitTests
  5. */
  6. /**
  7. * Zend_Cache
  8. */
  9. require_once 'Zend/Cache.php';
  10. require_once 'Zend/Cache/Backend/TwoLevels.php';
  11. /**
  12. * Common tests for backends
  13. */
  14. require_once 'CommonExtendedBackendTest.php';
  15. /**
  16. * PHPUnit test case
  17. */
  18. require_once 'PHPUnit/Framework/TestCase.php';
  19. /**
  20. * @package Zend_Cache
  21. * @subpackage UnitTests
  22. */
  23. class Zend_Cache_TwoLevelsBackendTest extends Zend_Cache_CommonExtendedBackendTest {
  24. protected $_instance;
  25. private $_cache_dir;
  26. public function __construct($name = null, array $data = array(), $dataName = '')
  27. {
  28. parent::__construct('Zend_Cache_Backend_TwoLevels', $data, $dataName);
  29. }
  30. public function setUp($notag = false)
  31. {
  32. @mkdir($this->getTmpDir());
  33. $this->_cache_dir = $this->getTmpDir() . DIRECTORY_SEPARATOR;
  34. $slowBackend = 'File';
  35. $fastBackend = 'Apc';
  36. $slowBackendOptions = array(
  37. 'cache_dir' => $this->_cache_dir
  38. );
  39. $fastBackendOptions = array(
  40. );
  41. $this->_instance = new Zend_Cache_Backend_TwoLevels(array(
  42. 'fast_backend' => $fastBackend,
  43. 'slow_backend' => $slowBackend,
  44. 'fast_backend_options' => $fastBackendOptions,
  45. 'slow_backend_options' => $slowBackendOptions
  46. ));
  47. parent::setUp($notag);
  48. }
  49. public function tearDown()
  50. {
  51. parent::tearDown();
  52. unset($this->_instance);
  53. }
  54. public function testConstructorCorrectCall()
  55. {
  56. $slowBackend = 'File';
  57. $fastBackend = 'Apc';
  58. $slowBackendOptions = array(
  59. 'cache_dir' => $this->_cache_dir
  60. );
  61. $fastBackendOptions = array(
  62. );
  63. $test = new Zend_Cache_Backend_TwoLevels(array(
  64. 'fast_backend' => $fastBackend,
  65. 'slow_backend' => $slowBackend,
  66. 'fast_backend_options' => $fastBackendOptions,
  67. 'slow_backend_options' => $slowBackendOptions
  68. ));
  69. }
  70. }