ApcBackendTest.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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/Apc.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_ApcBackendTest extends Zend_Cache_CommonExtendedBackendTest {
  24. protected $_instance;
  25. public function __construct($name = null, array $data = array(), $dataName = '')
  26. {
  27. parent::__construct('Zend_Cache_Backend_Apc', $data, $dataName);
  28. }
  29. public function setUp($notag = true)
  30. {
  31. $this->_instance = new Zend_Cache_Backend_Apc(array());
  32. parent::setUp($notag);
  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_Apc();
  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 testGetIdsMatchingTags() {}
  67. public function testGetIdsMatchingTags2() {}
  68. public function testGetIdsMatchingTags3() {}
  69. public function testGetIdsMatchingTags4() {}
  70. public function testGetIdsNotMatchingTags() {}
  71. public function testGetIdsNotMatchingTags2() {}
  72. public function testGetIdsNotMatchingTags3() {}
  73. public function testGetTags() {}
  74. public function testSaveCorrectCall()
  75. {
  76. $this->_instance->setDirectives(array('logging' => false));
  77. parent::testSaveCorrectCall();
  78. $this->_instance->setDirectives(array('logging' => true));
  79. }
  80. public function testSaveWithNullLifeTime()
  81. {
  82. $this->_instance->setDirectives(array('logging' => false));
  83. parent::testSaveWithNullLifeTime();
  84. $this->_instance->setDirectives(array('logging' => true));
  85. }
  86. public function testSaveWithSpecificLifeTime()
  87. {
  88. $this->_instance->setDirectives(array('logging' => false));
  89. parent::testSaveWithSpecificLifeTime();
  90. $this->_instance->setDirectives(array('logging' => true));
  91. }
  92. public function testGetMetadatas($notag = true)
  93. {
  94. parent::testGetMetadatas($notag);
  95. }
  96. }