1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-30 19:00:10 +02:00

[1.7.0] Add versioning to serializer cache

- Make some AttrDef member-variables lazy-loading to save serialization space, clean up others
- Refactor get*Definition() methods

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1116 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2007-05-29 18:19:42 +00:00
parent 426fbd1f97
commit d1187ed331
11 changed files with 169 additions and 71 deletions

View File

@@ -9,6 +9,22 @@ class HTMLPurifier_DefinitionCacheTest extends UnitTestCase
$cache = HTMLPurifier_DefinitionCache::create('Test', $config);
$this->assertEqual($cache, new HTMLPurifier_DefinitionCache_Serializer('Test'));
}
function test_isOld() {
$cache = new HTMLPurifier_DefinitionCache('Test'); // non-functional
$config = HTMLPurifier_Config::createDefault();
$config->version = '1.0.0';
$config->revision = 10;
$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);
}
}
?>