From 29386a18564b571c88ba2b78b489d7f5d5d86607 Mon Sep 17 00:00:00 2001 From: RahatHameed Date: Mon, 2 Sep 2024 14:10:28 +0200 Subject: [PATCH] OXDEV-7182 Correct test to properly handle node without a parent --- tests/Unit/HtmlFilter/HtmlTagRemoverTest.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/Unit/HtmlFilter/HtmlTagRemoverTest.php b/tests/Unit/HtmlFilter/HtmlTagRemoverTest.php index 0623d06..5d66353 100644 --- a/tests/Unit/HtmlFilter/HtmlTagRemoverTest.php +++ b/tests/Unit/HtmlFilter/HtmlTagRemoverTest.php @@ -22,16 +22,14 @@ class HtmlTagRemoverTest extends TestCase public function throwExceptionOnNoParentNode(): void { $doc = new DOMDocument(); - $doc->loadHTML('
', LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); - $node = $doc->getElementsByTagName('div')->item(0); - $parentlessNode = $node->parentNode; + $node = $doc->createElement('div'); $remover = new HtmlTagRemover(); $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage("The node does not have a parent."); - $remover->remove($parentlessNode); + $remover->remove($node); } #[Test]