2007-05-25 01:32:29 +00:00
|
|
|
<?php
|
|
|
|
|
2007-08-01 14:06:59 +00:00
|
|
|
class HTMLPurifier_DefinitionCacheTest extends HTMLPurifier_Harness
|
2007-05-25 01:32:29 +00:00
|
|
|
{
|
2007-05-29 18:19:42 +00:00
|
|
|
|
|
|
|
function test_isOld() {
|
2007-11-25 02:24:39 +00:00
|
|
|
// using null subclass because parent is abstract
|
|
|
|
$cache = new HTMLPurifier_DefinitionCache_Null('Test');
|
2007-05-29 18:19:42 +00:00
|
|
|
|
2007-06-23 14:05:09 +00:00
|
|
|
generate_mock_once('HTMLPurifier_Config');
|
|
|
|
$config = new HTMLPurifier_ConfigMock();
|
|
|
|
$config->version = '1.0.0'; // hopefully no conflicts
|
|
|
|
$config->setReturnValue('get', 10, array('Test', 'DefinitionRev'));
|
|
|
|
$config->setReturnValue('getBatchSerial', 'hash', array('Test'));
|
2007-05-29 18:19:42 +00:00
|
|
|
|
2008-04-26 19:28:14 +00:00
|
|
|
$this->assertIdentical($cache->isOld('1.0.0,hash,10', $config), false);
|
|
|
|
$this->assertIdentical($cache->isOld('1.5.0,hash,1', $config), true);
|
2007-05-29 18:19:42 +00:00
|
|
|
|
2008-04-26 19:28:14 +00:00
|
|
|
$this->assertIdentical($cache->isOld('0.9.0,hash,1', $config), true);
|
|
|
|
$this->assertIdentical($cache->isOld('1.0.0,hash,1', $config), true);
|
|
|
|
$this->assertIdentical($cache->isOld('1.0.0beta,hash,11', $config), true);
|
2007-06-23 14:05:09 +00:00
|
|
|
|
2008-04-26 19:28:14 +00:00
|
|
|
$this->assertIdentical($cache->isOld('0.9.0,hash2,1', $config), true);
|
|
|
|
$this->assertIdentical($cache->isOld('1.0.0,hash2,1', $config), false); // if hash is different, don't touch!
|
|
|
|
$this->assertIdentical($cache->isOld('1.0.0beta,hash2,11', $config), true);
|
|
|
|
$this->assertIdentical($cache->isOld('1.0.0-dev,hash2,11', $config), true);
|
2007-06-20 02:43:43 +00:00
|
|
|
|
2007-05-29 18:19:42 +00:00
|
|
|
}
|
|
|
|
|
2007-05-25 01:32:29 +00:00
|
|
|
}
|
|
|
|
|