2007-05-25 01:32:29 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once 'HTMLPurifier/DefinitionCache.php';
|
|
|
|
|
|
|
|
class HTMLPurifier_DefinitionCacheTest extends UnitTestCase
|
|
|
|
{
|
2007-05-29 18:19:42 +00:00
|
|
|
|
|
|
|
function test_isOld() {
|
|
|
|
$cache = new HTMLPurifier_DefinitionCache('Test'); // non-functional
|
|
|
|
|
2007-06-20 02:43:43 +00:00
|
|
|
$old_copy = HTMLPurifier_ConfigSchema::instance();
|
|
|
|
$o = new HTMLPurifier_ConfigSchema();
|
|
|
|
HTMLPurifier_ConfigSchema::instance($o);
|
|
|
|
|
|
|
|
HTMLPurifier_ConfigSchema::defineNamespace('Test', 'Test namespace');
|
|
|
|
HTMLPurifier_ConfigSchema::define('Test', 'DefinitionRev', 1, 'int', 'Definition revision.');
|
|
|
|
|
2007-05-29 18:19:42 +00:00
|
|
|
$config = HTMLPurifier_Config::createDefault();
|
|
|
|
$config->version = '1.0.0';
|
2007-06-20 02:43:43 +00:00
|
|
|
$config->set('Test', 'DefinitionRev', 10);
|
2007-05-29 18:19:42 +00:00
|
|
|
|
|
|
|
$this->assertIdentical($cache->isOld('1.0.0-10-hashstuffhere', $config), false);
|
|
|
|
$this->assertIdentical($cache->isOld('1.5.0-1-hashstuffhere', $config), false);
|
|
|
|
|
|
|
|
$this->assertIdentical($cache->isOld('0.9.0-1-hashstuffhere', $config), true);
|
|
|
|
$this->assertIdentical($cache->isOld('1.0.0-1-hashstuffhere', $config), true);
|
|
|
|
$this->assertIdentical($cache->isOld('1.0.0beta-11-hashstuffhere', $config), true);
|
2007-06-20 02:43:43 +00:00
|
|
|
|
|
|
|
HTMLPurifier_ConfigSchema::instance($old_copy);
|
|
|
|
|
2007-05-29 18:19:42 +00:00
|
|
|
}
|
|
|
|
|
2007-05-25 01:32:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|