Skip to content

NOW MANAGED ON CODEBERG

Testing: Addressed failing tests and static checks

Dan Brown964633993358
diff --git a/app/Util/HtmlContentFilter.php b/app/Util/HtmlContentFilter.php
index 45144a0e8..2ef797d13 100644
--- a/app/Util/HtmlContentFilter.php
+++ b/app/Util/HtmlContentFilter.php
@@ -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);
}
}
diff --git a/tests/Entity/PageContentFilteringTest.php b/tests/Entity/PageContentFilteringTest.php
index 312f264ca..c048c09dc 100644
--- a/tests/Entity/PageContentFilteringTest.php
+++ b/tests/Entity/PageContentFilteringTest.php
@@ -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', '');
diff --git a/tests/Entity/PageDraftTest.php b/tests/Entity/PageDraftTest.php
index 2623acd3f..8a30a9750 100644
--- a/tests/Entity/PageDraftTest.php
+++ b/tests/Entity/PageDraftTest.php
@@ -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>',
]);
}