0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-11-12 16:38:40 +00:00
htmlpurifier/tests/HTMLPurifier/HTMLModuleHarness.php
Edward Z. Yang a470fc5621 [1.7.0] Refactor HTMLModule unit tests
- AttrCollections does not barf when an inclusion is not present
- HTMLDefinition configuration directives now use new syntax
- Added %HTML.AllowedModules and %HTML.CoreModules for testing
- Extend Harness so that it can accept a default configuration object member variable
- Refactor modules to use Scaffolding, which defines some custom attributes that allows for the easy testing of attribute collections

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1082 48356398-32a2-884e-a903-53898d9a118a
2007-05-20 22:29:31 +00:00

35 lines
967 B
PHP

<?php
require_once 'HTMLPurifier/StrategyHarness.php';
require_once 'HTMLPurifier/Strategy/Core.php';
class HTMLPurifier_HTMLModuleHarness extends HTMLPurifier_StrategyHarness
{
function setup() {
parent::setup();
$this->obj = new HTMLPurifier_Strategy_Core();
}
function setupScaffold($module, $config = array()) {
$this->config = HTMLPurifier_Config::create($config);
$this->config->set('HTML', 'AllowedModules', $module);
$def =& $this->config->getHTMLDefinition(true);
$def->manager->addModule(new HTMLPurifier_HTMLModuleHarness_Scaffold());
}
}
/**
* Special module that defines scaffolding for easy unit testing
*/
class HTMLPurifier_HTMLModuleHarness_Scaffold extends HTMLPurifier_HTMLModule
{
var $name = 'Scaffold';
var $attr_collections = array(
'Common' => array('ac:common' => 'Text'),
'Core' => array('ac:core' => 'Text')
);
}
?>