mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-10 08:04:37 +02:00
Convert all to new configuration get/set format.
Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
@@ -116,7 +116,7 @@ class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
|
||||
}
|
||||
|
||||
function testProprietary() {
|
||||
$this->config->set('CSS', 'Proprietary', true);
|
||||
$this->config->set('CSS.Proprietary', true);
|
||||
|
||||
$this->assertDef('scrollbar-arrow-color:#ff0;');
|
||||
$this->assertDef('scrollbar-base-color:#ff6347;');
|
||||
@@ -133,12 +133,12 @@ class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
|
||||
}
|
||||
|
||||
function testImportant() {
|
||||
$this->config->set('CSS', 'AllowImportant', true);
|
||||
$this->config->set('CSS.AllowImportant', true);
|
||||
$this->assertDef('float:left !important;');
|
||||
}
|
||||
|
||||
function testTricky() {
|
||||
$this->config->set('CSS', 'AllowTricky', true);
|
||||
$this->config->set('CSS.AllowTricky', true);
|
||||
$this->assertDef('display:none;');
|
||||
$this->assertDef('visibility:visible;');
|
||||
$this->assertDef('overflow:scroll;');
|
||||
|
@@ -16,7 +16,7 @@ class HTMLPurifier_AttrDef_HTML_FrameTargetTest extends HTMLPurifier_AttrDefHarn
|
||||
}
|
||||
|
||||
function test() {
|
||||
$this->config->set('Attr', 'AllowedFrameTargets', 'foo,_blank');
|
||||
$this->config->set('Attr.AllowedFrameTargets', 'foo,_blank');
|
||||
$this->assertDef('', false);
|
||||
$this->assertDef('foo');
|
||||
$this->assertDef('_blank');
|
||||
|
@@ -8,7 +8,7 @@ class HTMLPurifier_AttrDef_HTML_IDTest extends HTMLPurifier_AttrDefHarness
|
||||
|
||||
$id_accumulator = new HTMLPurifier_IDAccumulator();
|
||||
$this->context->register('IDAccumulator', $id_accumulator);
|
||||
$this->config->set('Attr', 'EnableID', true);
|
||||
$this->config->set('Attr.EnableID', true);
|
||||
$this->def = new HTMLPurifier_AttrDef_HTML_ID();
|
||||
|
||||
}
|
||||
@@ -37,7 +37,7 @@ class HTMLPurifier_AttrDef_HTML_IDTest extends HTMLPurifier_AttrDefHarness
|
||||
|
||||
function testPrefix() {
|
||||
|
||||
$this->config->set('Attr', 'IDPrefix', 'user_');
|
||||
$this->config->set('Attr.IDPrefix', 'user_');
|
||||
|
||||
$this->assertDef('alpha', 'user_alpha');
|
||||
$this->assertDef('<asa', false);
|
||||
@@ -52,8 +52,8 @@ class HTMLPurifier_AttrDef_HTML_IDTest extends HTMLPurifier_AttrDefHarness
|
||||
|
||||
function testTwoPrefixes() {
|
||||
|
||||
$this->config->set('Attr', 'IDPrefix', 'user_');
|
||||
$this->config->set('Attr', 'IDPrefixLocal', 'story95_');
|
||||
$this->config->set('Attr.IDPrefix', 'user_');
|
||||
$this->config->set('Attr.IDPrefixLocal', 'story95_');
|
||||
|
||||
$this->assertDef('alpha', 'user_story95_alpha');
|
||||
$this->assertDef('<asa', false);
|
||||
@@ -66,8 +66,8 @@ class HTMLPurifier_AttrDef_HTML_IDTest extends HTMLPurifier_AttrDefHarness
|
||||
|
||||
function testLocalPrefixWithoutMainPrefix() {
|
||||
// no effect when IDPrefix isn't set
|
||||
$this->config->set('Attr', 'IDPrefix', '');
|
||||
$this->config->set('Attr', 'IDPrefixLocal', 'story95_');
|
||||
$this->config->set('Attr.IDPrefix', '');
|
||||
$this->config->set('Attr.IDPrefixLocal', 'story95_');
|
||||
$this->expectError('%Attr.IDPrefixLocal cannot be used unless '.
|
||||
'%Attr.IDPrefix is set');
|
||||
$this->assertDef('amherst');
|
||||
@@ -96,7 +96,7 @@ class HTMLPurifier_AttrDef_HTML_IDTest extends HTMLPurifier_AttrDefHarness
|
||||
|
||||
function testRegexp() {
|
||||
|
||||
$this->config->set('Attr', 'IDBlacklistRegexp', '/^g_/');
|
||||
$this->config->set('Attr.IDBlacklistRegexp', '/^g_/');
|
||||
|
||||
$this->assertDef('good_id');
|
||||
$this->assertDef('g_bad_id', false);
|
||||
|
@@ -6,7 +6,7 @@ class HTMLPurifier_AttrDef_HTML_LinkTypesTest extends HTMLPurifier_AttrDefHarnes
|
||||
function testNull() {
|
||||
|
||||
$this->def = new HTMLPurifier_AttrDef_HTML_LinkTypes('rel');
|
||||
$this->config->set('Attr', 'AllowedRel', array('nofollow', 'foo'));
|
||||
$this->config->set('Attr.AllowedRel', array('nofollow', 'foo'));
|
||||
|
||||
$this->assertDef('', false);
|
||||
$this->assertDef('nofollow', true);
|
||||
|
@@ -49,7 +49,7 @@ class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness
|
||||
}
|
||||
|
||||
function testConfigMunge() {
|
||||
$this->config->set('URI', 'Munge', 'http://www.google.com/url?q=%s');
|
||||
$this->config->set('URI.Munge', 'http://www.google.com/url?q=%s');
|
||||
$this->assertDef(
|
||||
'http://www.example.com/',
|
||||
'http://www.google.com/url?q=http%3A%2F%2Fwww.example.com%2F'
|
||||
@@ -77,7 +77,7 @@ class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness
|
||||
function testURIDefinitionValidation() {
|
||||
$parser = new HTMLPurifier_URIParser();
|
||||
$uri = $parser->parse('http://example.com');
|
||||
$this->config->set('URI', 'DefinitionID', 'HTMLPurifier_AttrDef_URITest->testURIDefinitionValidation');
|
||||
$this->config->set('URI.DefinitionID', 'HTMLPurifier_AttrDef_URITest->testURIDefinitionValidation');
|
||||
|
||||
generate_mock_once('HTMLPurifier_URIDefinition');
|
||||
$uri_def = new HTMLPurifier_URIDefinitionMock();
|
||||
@@ -121,8 +121,8 @@ class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness
|
||||
/*
|
||||
function test_validate_configWhitelist() {
|
||||
|
||||
$this->config->set('URI', 'HostPolicy', 'DenyAll');
|
||||
$this->config->set('URI', 'HostWhitelist', array(null, 'google.com'));
|
||||
$this->config->set('URI.HostPolicy', 'DenyAll');
|
||||
$this->config->set('URI.HostWhitelist', array(null, 'google.com'));
|
||||
|
||||
$this->assertDef('http://example.com/fo/google.com', false);
|
||||
$this->assertDef('server.txt');
|
||||
|
Reference in New Issue
Block a user