mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-05 13:47:24 +02:00
[1.7.0] Add DefinitionCache decorators, implement Memory decorator
- Move serialization responsibility to Config - Create DefinitionCacheFactory - Implement Null definition cache git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1117 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
45
tests/HTMLPurifier/DefinitionCache/DecoratorTest.php
Normal file
45
tests/HTMLPurifier/DefinitionCache/DecoratorTest.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/DefinitionCacheHarness.php';
|
||||
require_once 'HTMLPurifier/DefinitionCache/Decorator.php';
|
||||
|
||||
class HTMLPurifier_DefinitionCache_DecoratorTest extends HTMLPurifier_DefinitionCacheHarness
|
||||
{
|
||||
|
||||
function test() {
|
||||
|
||||
generate_mock_once('HTMLPurifier_DefinitionCache');
|
||||
$mock =& new HTMLPurifier_DefinitionCacheMock($this);
|
||||
$mock->type = 'Test';
|
||||
|
||||
$cache = new HTMLPurifier_DefinitionCache_Decorator();
|
||||
$cache = $cache->decorate($mock);
|
||||
|
||||
$this->assertIdentical($cache->type, $mock->type);
|
||||
|
||||
$def = $this->generateDefinition();
|
||||
$config = $this->generateConfigMock();
|
||||
|
||||
$mock->expectOnce('add', array($def, $config));
|
||||
$cache->add($def, $config);
|
||||
|
||||
$mock->expectOnce('set', array($def, $config));
|
||||
$cache->set($def, $config);
|
||||
|
||||
$mock->expectOnce('replace', array($def, $config));
|
||||
$cache->replace($def, $config);
|
||||
|
||||
$mock->expectOnce('get', array($config));
|
||||
$cache->get($config);
|
||||
|
||||
$mock->expectOnce('flush', array());
|
||||
$cache->flush();
|
||||
|
||||
$mock->expectOnce('cleanup', array($config));
|
||||
$cache->cleanup($config);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user