ZendServerDiskTest.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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/ZendServer/Disk.php';
  11. /**
  12. * Common tests for backends
  13. */
  14. require_once 'CommonBackendTest.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_ZendServerDiskTest extends Zend_Cache_CommonBackendTest {
  24. protected $_instance;
  25. public function __construct($name = null, array $data = array(), $dataName = '')
  26. {
  27. parent::__construct('Zend_Cache_Backend_ZendServer_Disk', $data, $dataName);
  28. }
  29. public function setUp($notag = true)
  30. {
  31. $this->_instance = new Zend_Cache_Backend_ZendServer_Disk();
  32. parent::setUp(true);
  33. }
  34. public function tearDown()
  35. {
  36. parent::tearDown();
  37. unset($this->_instance);
  38. }
  39. public function testConstructorCorrectCall()
  40. {
  41. $test = new Zend_Cache_Backend_ZendServer_Disk();
  42. }
  43. public function testCleanModeOld() {
  44. $this->_instance->setDirectives(array('logging' => false));
  45. $this->_instance->clean('old');
  46. // do nothing, just to see if an error occured
  47. $this->_instance->setDirectives(array('logging' => true));
  48. }
  49. public function testCleanModeMatchingTags() {
  50. $this->_instance->setDirectives(array('logging' => false));
  51. $this->_instance->clean('matchingTag', array('tag1'));
  52. // do nothing, just to see if an error occured
  53. $this->_instance->setDirectives(array('logging' => true));
  54. }
  55. public function testCleanModeNotMatchingTags() {
  56. $this->_instance->setDirectives(array('logging' => false));
  57. $this->_instance->clean('notMatchingTag', array('tag1'));
  58. // do nothing, just to see if an error occured
  59. $this->_instance->setDirectives(array('logging' => true));
  60. }
  61. // Because of limitations of this backend...
  62. public function testGetWithAnExpiredCacheId() {}
  63. public function testCleanModeMatchingTags2() {}
  64. public function testCleanModeNotMatchingTags2() {}
  65. public function testCleanModeNotMatchingTags3() {}
  66. public function testSaveCorrectCall()
  67. {
  68. $this->_instance->setDirectives(array('logging' => false));
  69. parent::testSaveCorrectCall();
  70. $this->_instance->setDirectives(array('logging' => true));
  71. }
  72. public function testSaveWithNullLifeTime()
  73. {
  74. $this->_instance->setDirectives(array('logging' => false));
  75. parent::testSaveWithNullLifeTime();
  76. $this->_instance->setDirectives(array('logging' => true));
  77. }
  78. public function testSaveWithSpecificLifeTime()
  79. {
  80. $this->_instance->setDirectives(array('logging' => false));
  81. parent::testSaveWithSpecificLifeTime();
  82. $this->_instance->setDirectives(array('logging' => true));
  83. }
  84. }