ZendPlatformBackendTest.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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-2015 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/ZendPlatform.php';
  27. /**
  28. * Common tests for backends
  29. */
  30. require_once 'CommonBackendTest.php';
  31. /**
  32. * @category Zend
  33. * @package Zend_Cache
  34. * @subpackage UnitTests
  35. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  36. * @license http://framework.zend.com/license/new-bsd New BSD License
  37. * @group Zend_Cache
  38. */
  39. class Zend_Cache_ZendPlatformBackendTest extends Zend_Cache_CommonBackendTest {
  40. protected $_instance;
  41. public function __construct($name = null, array $data = array(), $dataName = '')
  42. {
  43. parent::__construct('Zend_Cache_Backend_ZendPlatform', $data, $dataName);
  44. }
  45. public function setUp($notag = false)
  46. {
  47. if(!function_exists('output_cache_get')) {
  48. $this->markTestSkipped('Zend Platform is not installed, skipping test');
  49. return;
  50. }
  51. $this->_instance = new Zend_Cache_Backend_ZendPlatform(array());
  52. parent::setUp($notag);
  53. }
  54. public function tearDown()
  55. {
  56. parent::tearDown();
  57. unset($this->_instance);
  58. }
  59. public function testConstructorCorrectCall()
  60. {
  61. $test = new Zend_Cache_Backend_ZendPlatform();
  62. }
  63. public function testRemoveCorrectCall()
  64. {
  65. $this->assertTrue($this->_instance->remove('bar'));
  66. $this->assertFalse($this->_instance->test('bar'));
  67. $this->assertTrue($this->_instance->remove('barbar'));
  68. $this->assertFalse($this->_instance->test('barbar'));
  69. }
  70. public function testGetWithAnExpiredCacheId()
  71. {
  72. sleep(2);
  73. $this->_instance->setDirectives(array('lifetime' => 1));
  74. $this->assertEquals('bar : data to cache', $this->_instance->load('bar', true));
  75. $this->assertFalse($this->_instance->load('bar'));
  76. $this->_instance->setDirectives(array('lifetime' => 3600));
  77. }
  78. // Because of limitations of this backend...
  79. public function testCleanModeNotMatchingTags2() {}
  80. public function testCleanModeNotMatchingTags3() {}
  81. public function testCleanModeOld() {}
  82. public function testCleanModeNotMatchingTags() {}
  83. }