2
0

XcacheBackendTest.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Cache
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * Zend_Cache
  24. */
  25. require_once 'Zend/Cache.php';
  26. require_once 'Zend/Cache/Backend/Xcache.php';
  27. /**
  28. * Common tests for backends
  29. */
  30. require_once 'CommonBackendTest.php';
  31. /**
  32. * PHPUnit test case
  33. */
  34. require_once 'PHPUnit/Framework/TestCase.php';
  35. /**
  36. * @category Zend
  37. * @package Zend_Cache
  38. * @subpackage UnitTests
  39. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  40. * @license http://framework.zend.com/license/new-bsd New BSD License
  41. * @group Zend_Cache
  42. */
  43. class Zend_Cache_XcacheBackendTest extends Zend_Cache_CommonBackendTest {
  44. protected $_instance;
  45. public function __construct($name = null, array $data = array(), $dataName = '')
  46. {
  47. parent::__construct('Zend_Cache_Backend_Xcache', $data, $dataName);
  48. }
  49. public function setUp($notag = true)
  50. {
  51. $this->_instance = new Zend_Cache_Backend_Xcache(array(
  52. 'user' => TESTS_ZEND_CACHE_XCACHE_USER,
  53. 'password' => TESTS_ZEND_CACHE_XCACHE_PASSWORD
  54. ));
  55. parent::setUp($notag);
  56. }
  57. public function tearDown()
  58. {
  59. parent::tearDown();
  60. unset($this->_instance);
  61. }
  62. public function testConstructorCorrectCall()
  63. {
  64. $test = new Zend_Cache_Backend_Xcache();
  65. }
  66. public function testCleanModeOld() {
  67. $this->_instance->setDirectives(array('logging' => false));
  68. $this->_instance->clean('old');
  69. // do nothing, just to see if an error occured
  70. $this->_instance->setDirectives(array('logging' => true));
  71. }
  72. public function testCleanModeMatchingTags() {
  73. $this->_instance->setDirectives(array('logging' => false));
  74. $this->_instance->clean('matchingTag', array('tag1'));
  75. // do nothing, just to see if an error occured
  76. $this->_instance->setDirectives(array('logging' => true));
  77. }
  78. public function testCleanModeNotMatchingTags() {
  79. $this->_instance->setDirectives(array('logging' => false));
  80. $this->_instance->clean('notMatchingTag', array('tag1'));
  81. // do nothing, just to see if an error occured
  82. $this->_instance->setDirectives(array('logging' => true));
  83. }
  84. // Because of limitations of this backend...
  85. public function testGetWithAnExpiredCacheId() {}
  86. public function testCleanModeMatchingTags2() {}
  87. public function testCleanModeNotMatchingTags2() {}
  88. public function testCleanModeNotMatchingTags3() {}
  89. public function testSaveCorrectCall()
  90. {
  91. $this->_instance->setDirectives(array('logging' => false));
  92. parent::testSaveCorrectCall();
  93. $this->_instance->setDirectives(array('logging' => true));
  94. }
  95. public function testSaveWithNullLifeTime()
  96. {
  97. $this->_instance->setDirectives(array('logging' => false));
  98. parent::testSaveWithNullLifeTime();
  99. $this->_instance->setDirectives(array('logging' => true));
  100. }
  101. public function testSaveWithSpecificLifeTime()
  102. {
  103. $this->_instance->setDirectives(array('logging' => false));
  104. parent::testSaveWithSpecificLifeTime();
  105. $this->_instance->setDirectives(array('logging' => true));
  106. }
  107. }