mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-01 11:50:28 +02:00
[1.7.0] DefinitionCache->flush() now requires configuration object. DefinitionCache_Serializer now will create directories for new types on the fly, and can accept custom directories to save serials into.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1147 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -32,8 +32,8 @@ class HTMLPurifier_DefinitionCache_DecoratorTest extends HTMLPurifier_Definition
|
||||
$mock->expectOnce('get', array($config));
|
||||
$cache->get($config);
|
||||
|
||||
$mock->expectOnce('flush', array());
|
||||
$cache->flush();
|
||||
$mock->expectOnce('flush', array($config));
|
||||
$cache->flush($config);
|
||||
|
||||
$mock->expectOnce('cleanup', array($config));
|
||||
$cache->cleanup($config);
|
||||
|
@@ -102,7 +102,7 @@ class HTMLPurifier_DefinitionCache_SerializerTest extends HTMLPurifier_Definitio
|
||||
$this->assertEqual($def2, $cache->get($config2));
|
||||
$this->assertEqual($def3, $cache->get($config3));
|
||||
|
||||
$cache->flush();
|
||||
$cache->flush($config1); // only essential directive is %Cache.SerializerPath
|
||||
|
||||
$this->assertFalse($cache->get($config1));
|
||||
$this->assertFalse($cache->get($config2));
|
||||
@@ -153,6 +153,24 @@ class HTMLPurifier_DefinitionCache_SerializerTest extends HTMLPurifier_Definitio
|
||||
$this->assertFalse(file_exists($file), 'Expected ' . $file . ' does not exist');
|
||||
}
|
||||
|
||||
function testAlternatePath() {
|
||||
|
||||
$cache = new HTMLPurifier_DefinitionCache_Serializer('Test');
|
||||
$config = $this->generateConfigMock('serial');
|
||||
$config->version = '1.0.0';
|
||||
$config->revision = 1;
|
||||
$dir = dirname(__FILE__) . '/SerializerTest';
|
||||
$config->setReturnValue('get', $dir, array('Cache', 'SerializerPath'));
|
||||
|
||||
$def_original = $this->generateDefinition();
|
||||
$cache->add($def_original, $config);
|
||||
$this->assertFileExist($dir . '/Test/1.0.0-1-serial.ser');
|
||||
|
||||
unlink($dir . '/Test/1.0.0-1-serial.ser');
|
||||
rmdir( $dir . '/Test');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user