mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-06 22:26:31 +02:00
feat: PHP 8.4 support (#441)
This commit is contained in:
@@ -12,7 +12,7 @@ class HTMLPurifier_AttrTypesTest extends HTMLPurifier_Harness
|
||||
new HTMLPurifier_AttrDef_Text()
|
||||
);
|
||||
|
||||
$this->expectError('Cannot retrieve undefined attribute type foobar');
|
||||
$this->expectException(new Exception('Cannot retrieve undefined attribute type foobar'));
|
||||
$types->get('foobar');
|
||||
|
||||
$this->assertIdentical(
|
||||
|
@@ -84,7 +84,7 @@ extends HTMLPurifier_ChildDefHarness
|
||||
|
||||
public function testError()
|
||||
{
|
||||
$this->expectError('Cannot use non-block element as block wrapper');
|
||||
$this->expectException(new Exception('Cannot use non-block element as block wrapper'));
|
||||
$this->obj = new HTMLPurifier_ChildDef_StrictBlockquote('div | p');
|
||||
$this->config->set('HTML.BlockWrapper', 'dav');
|
||||
$this->config->set('Cache.DefinitionImpl', null);
|
||||
|
@@ -155,7 +155,7 @@ class HTMLPurifier_ConfigTest extends HTMLPurifier_Harness
|
||||
|
||||
$this->assertIdentical($config->get('Home.Rug'), 3);
|
||||
|
||||
$this->expectError('Cannot get value from aliased directive, use real name Home.Rug');
|
||||
$this->expectException(new Exception('Cannot get value from aliased directive, use real name Home.Rug'));
|
||||
$config->get('Home.Carpet');
|
||||
|
||||
$this->expectError('Home.Carpet is an alias, preferred directive name is Home.Rug');
|
||||
@@ -384,7 +384,7 @@ class HTMLPurifier_ConfigTest extends HTMLPurifier_Harness
|
||||
|
||||
$config->finalize();
|
||||
|
||||
$this->expectError('Cannot set directive after finalization');
|
||||
$this->expectException(new Exception('Cannot set directive after finalization'));
|
||||
$config->set('Poem.Meter', 'vedic');
|
||||
|
||||
$this->expectError('Cannot load directives after finalization');
|
||||
|
@@ -27,11 +27,11 @@ class HTMLPurifier_ContextTest extends HTMLPurifier_Harness
|
||||
$this->context->destroy('IDAccumulator');
|
||||
$this->assertFalse($this->context->exists('IDAccumulator'));
|
||||
|
||||
$this->expectError('Attempted to retrieve non-existent variable IDAccumulator');
|
||||
$this->expectException(new Exception('Attempted to retrieve non-existent variable IDAccumulator'));
|
||||
$accumulator_3 =& $this->context->get('IDAccumulator');
|
||||
$this->assertNull($accumulator_3);
|
||||
|
||||
$this->expectError('Attempted to destroy non-existent variable IDAccumulator');
|
||||
$this->expectException(new Exception('Attempted to destroy non-existent variable IDAccumulator'));
|
||||
$this->context->destroy('IDAccumulator');
|
||||
|
||||
}
|
||||
@@ -41,7 +41,7 @@ class HTMLPurifier_ContextTest extends HTMLPurifier_Harness
|
||||
$var = true;
|
||||
$this->context->register('OnceOnly', $var);
|
||||
|
||||
$this->expectError('Name OnceOnly produces collision, cannot re-register');
|
||||
$this->expectException(new Exception('Name OnceOnly produces collision, cannot re-register'));
|
||||
$this->context->register('OnceOnly', $var);
|
||||
|
||||
// destroy it, now registration is okay
|
||||
|
@@ -36,7 +36,7 @@ class HTMLPurifier_DoctypeRegistryTest extends HTMLPurifier_Harness
|
||||
|
||||
$registry = new HTMLPurifier_DoctypeRegistry();
|
||||
|
||||
$this->expectError('Doctype XHTML 2.0 does not exist');
|
||||
$this->expectException(new Exception('Doctype XHTML 2.0 does not exist'));
|
||||
$registry->get('XHTML 2.0');
|
||||
|
||||
// prevent XSS
|
||||
|
@@ -47,7 +47,7 @@ class HTMLPurifier_EncoderTest extends HTMLPurifier_Harness
|
||||
{
|
||||
if (!HTMLPurifier_Encoder::iconvAvailable()) return;
|
||||
$this->config->set('Core.Encoding', 'utf99');
|
||||
$this->expectError('Invalid encoding utf99');
|
||||
$this->expectException(new Exception('Invalid encoding utf99'));
|
||||
$this->assertIdentical(
|
||||
HTMLPurifier_Encoder::convertToUTF8("\xF6", $this->config, $this->context),
|
||||
''
|
||||
|
@@ -134,7 +134,7 @@ class HTMLPurifier_HTMLModule_TidyTest extends HTMLPurifier_Harness
|
||||
$module = new HTMLPurifier_HTMLModule_Tidy();
|
||||
$module->defaultLevel = 'bananas';
|
||||
|
||||
$this->expectError('Default level bananas does not exist');
|
||||
$this->expectException(new Exception('Default level bananas does not exist'));
|
||||
|
||||
$module->makeFixesForLevel(array(
|
||||
'fix-1' => 0
|
||||
|
@@ -115,7 +115,7 @@ class HTMLPurifier_Strategy_FixNestingTest extends HTMLPurifier_StrategyHarness
|
||||
// test fallback to div
|
||||
$this->config->set('HTML.Parent', 'obviously-impossible');
|
||||
$this->config->set('Cache.DefinitionImpl', null);
|
||||
$this->expectError('Cannot use unrecognized element as parent');
|
||||
$this->expectException(new Exception('Cannot use unrecognized element as parent'));
|
||||
$this->assertResult('<div>Accept</div>');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user