fix: resolve test failures for HTMLPurifier and CdnManager
HTMLPurifier: set HTML.DefinitionID and HTML.DefinitionRev which are required when using maybeGetRawHTMLDefinition(). CdnManager: bind a stub in tests when Plug\Cdn\CdnManager class is not available (external dependency not in test environment). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ddd7857370
commit
381a97aa03
2 changed files with 8 additions and 1 deletions
|
|
@ -97,8 +97,10 @@ class HtmlSanitiser
|
||||||
$config->set('HTML.Nofollow', true);
|
$config->set('HTML.Nofollow', true);
|
||||||
$config->set('HTML.TargetNoopener', true);
|
$config->set('HTML.TargetNoopener', true);
|
||||||
|
|
||||||
// Disable cache to allow custom HTML definitions
|
// Disable cache and set definition ID for custom HTML definitions
|
||||||
$config->set('Cache.DefinitionImpl', null);
|
$config->set('Cache.DefinitionImpl', null);
|
||||||
|
$config->set('HTML.DefinitionID', 'core-content-html5');
|
||||||
|
$config->set('HTML.DefinitionRev', 1);
|
||||||
|
|
||||||
// Register HTML5 elements that HTMLPurifier doesn't know about
|
// Register HTML5 elements that HTMLPurifier doesn't know about
|
||||||
if ($def = $config->maybeGetRawHTMLDefinition()) {
|
if ($def = $config->maybeGetRawHTMLDefinition()) {
|
||||||
|
|
|
||||||
|
|
@ -27,5 +27,10 @@ abstract class TestCase extends BaseTestCase
|
||||||
'database' => ':memory:',
|
'database' => ':memory:',
|
||||||
'prefix' => '',
|
'prefix' => '',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// Stub external dependencies not available in test environment
|
||||||
|
if (! class_exists(\Plug\Cdn\CdnManager::class)) {
|
||||||
|
$app->bind(\Plug\Cdn\CdnManager::class, fn () => new class {});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue