Testing: Addressed failing tests and static checks

This commit is contained in:
Dan Brown
2026-02-17 11:23:34 +00:00
parent e4383765e1
commit 9646339933
3 changed files with 25 additions and 8 deletions

View File

@@ -176,7 +176,7 @@ class HtmlContentFilter
filterOutNonContentElements: false,
useAllowListFilter: false,
);
$filter = new static($config);
$filter = new self($config);
$filter->filterDocument($doc);
}
@@ -191,7 +191,7 @@ class HtmlContentFilter
filterOutNonContentElements: false,
useAllowListFilter: false,
);
$filter = new static($config);
$filter = new self($config);
return $filter->filterString($html);
}
}

View File

@@ -401,6 +401,26 @@ TESTCASE;
}
public function test_non_content_filtering_is_controlled_by_config()
{
config()->set('app.content_filtering', '');
$page = $this->entities->page();
$html = <<<'HTML'
<style>superbeans!</style>
<template id="template">superbeans!</template>
HTML;
$page->html = $html;
$page->save();
$resp = $this->asEditor()->get($page->getUrl());
$resp->assertSee('superbeans', false);
config()->set('app.content_filtering', 'h');
$resp = $this->asEditor()->get($page->getUrl());
$resp->assertDontSee('superbeans', false);
}
public function test_non_content_filtering()
{
config()->set('app.content_filtering', 'h');
$page = $this->entities->page();
@@ -421,11 +441,6 @@ HTML;
$resp->assertSee('inbetweenpsection', false);
}
public function test_non_content_filtering()
{
config()->set('app.content_filtering', 'h');
}
public function test_allow_list_filtering_is_controlled_by_config()
{
config()->set('app.content_filtering', '');

View File

@@ -160,9 +160,11 @@ class PageDraftTest extends TestCase
{
$this->asAdmin();
$page = $this->entities->page();
$page->html = '<p>test content<script>hellotherekitty</script></p>';
$page->save();
$this->getJson('/ajax/page/' . $page->id)->assertJson([
'html' => $page->html,
'html' => '<p>test content</p>',
]);
}