2
0

XcacheBackendTest.php 3.0 KB

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