2007-05-29 20:21:33 +00:00
|
|
|
<?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');
|
2007-06-26 15:40:04 +00:00
|
|
|
$mock = new HTMLPurifier_DefinitionCacheMock();
|
2007-05-29 20:21:33 +00:00
|
|
|
$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);
|
|
|
|
|
2007-06-16 20:46:44 +00:00
|
|
|
$mock->expectOnce('flush', array($config));
|
|
|
|
$cache->flush($config);
|
2007-05-29 20:21:33 +00:00
|
|
|
|
|
|
|
$mock->expectOnce('cleanup', array($config));
|
|
|
|
$cache->cleanup($config);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|