2007-05-29 20:21:33 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class HTMLPurifier_DefinitionCache_DecoratorTest extends HTMLPurifier_DefinitionCacheHarness
|
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-29 20:21:33 +00:00
|
|
|
function test() {
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-29 20:21:33 +00:00
|
|
|
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';
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-29 20:21:33 +00:00
|
|
|
$cache = new HTMLPurifier_DefinitionCache_Decorator();
|
|
|
|
$cache = $cache->decorate($mock);
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-29 20:21:33 +00:00
|
|
|
$this->assertIdentical($cache->type, $mock->type);
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-29 20:21:33 +00:00
|
|
|
$def = $this->generateDefinition();
|
|
|
|
$config = $this->generateConfigMock();
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-29 20:21:33 +00:00
|
|
|
$mock->expectOnce('add', array($def, $config));
|
|
|
|
$cache->add($def, $config);
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-29 20:21:33 +00:00
|
|
|
$mock->expectOnce('set', array($def, $config));
|
|
|
|
$cache->set($def, $config);
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-29 20:21:33 +00:00
|
|
|
$mock->expectOnce('replace', array($def, $config));
|
|
|
|
$cache->replace($def, $config);
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-29 20:21:33 +00:00
|
|
|
$mock->expectOnce('get', array($config));
|
|
|
|
$cache->get($config);
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-06-16 20:46:44 +00:00
|
|
|
$mock->expectOnce('flush', array($config));
|
|
|
|
$cache->flush($config);
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-29 20:21:33 +00:00
|
|
|
$mock->expectOnce('cleanup', array($config));
|
|
|
|
$cache->cleanup($config);
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-29 20:21:33 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-29 20:21:33 +00:00
|
|
|
}
|
|
|
|
|