ZendPlatformBackendTest.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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/ZendPlatform.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_ZendPlatformBackendTest extends Zend_Cache_CommonBackendTest {
  24. protected $_instance;
  25. public function __construct($name = null, array $data = array(), $dataName = '')
  26. {
  27. parent::__construct('Zend_Cache_Backend_ZendPlatform', $data, $dataName);
  28. }
  29. public function setUp($notag = false)
  30. {
  31. if(!function_exists('output_cache_get')) {
  32. $this->markTestSkipped('Zend Platform is not installed, skipping test');
  33. return;
  34. }
  35. $this->_instance = new Zend_Cache_Backend_ZendPlatform(array());
  36. parent::setUp($notag);
  37. }
  38. public function tearDown()
  39. {
  40. parent::tearDown();
  41. unset($this->_instance);
  42. }
  43. public function testConstructorCorrectCall()
  44. {
  45. $test = new Zend_Cache_Backend_ZendPlatform();
  46. }
  47. public function testRemoveCorrectCall()
  48. {
  49. $this->assertTrue($this->_instance->remove('bar'));
  50. $this->assertFalse($this->_instance->test('bar'));
  51. $this->assertTrue($this->_instance->remove('barbar'));
  52. $this->assertFalse($this->_instance->test('barbar'));
  53. }
  54. public function testGetWithAnExpiredCacheId()
  55. {
  56. sleep(2);
  57. $this->_instance->setDirectives(array('lifetime' => 1));
  58. $this->assertEquals('bar : data to cache', $this->_instance->load('bar', true));
  59. $this->assertFalse($this->_instance->load('bar'));
  60. $this->_instance->setDirectives(array('lifetime' => 3600));
  61. }
  62. // Because of limitations of this backend...
  63. public function testCleanModeNotMatchingTags2() {}
  64. public function testCleanModeNotMatchingTags3() {}
  65. public function testCleanModeOld() {}
  66. public function testCleanModeNotMatchingTags() {}
  67. }