You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.3KB

  1. <?php
  2. class HTMLPurifier_DefinitionCacheTest extends HTMLPurifier_Harness
  3. {
  4. public function test_isOld()
  5. {
  6. // using null subclass because parent is abstract
  7. $cache = new HTMLPurifier_DefinitionCache_Null('Test');
  8. generate_mock_once('HTMLPurifier_Config');
  9. $config = new HTMLPurifier_ConfigMock();
  10. $config->version = '1.0.0'; // hopefully no conflicts
  11. $config->setReturnValue('get', 10, array('Test.DefinitionRev'));
  12. $config->setReturnValue('getBatchSerial', 'hash', array('Test'));
  13. $this->assertIdentical($cache->isOld('1.0.0,hash,10', $config), false);
  14. $this->assertIdentical($cache->isOld('1.5.0,hash,1', $config), true);
  15. $this->assertIdentical($cache->isOld('0.9.0,hash,1', $config), true);
  16. $this->assertIdentical($cache->isOld('1.0.0,hash,1', $config), true);
  17. $this->assertIdentical($cache->isOld('1.0.0beta,hash,11', $config), true);
  18. $this->assertIdentical($cache->isOld('0.9.0,hash2,1', $config), true);
  19. $this->assertIdentical($cache->isOld('1.0.0,hash2,1', $config), false); // if hash is different, don't touch!
  20. $this->assertIdentical($cache->isOld('1.0.0beta,hash2,11', $config), true);
  21. $this->assertIdentical($cache->isOld('1.0.0-dev,hash2,11', $config), true);
  22. }
  23. }
  24. // vim: et sw=4 sts=4