Skip to content

Commit

Permalink
OXDEV-7182 Correct test to properly handle node without a parent
Browse files Browse the repository at this point in the history
  • Loading branch information
RahatHameed committed Sep 2, 2024
1 parent 3383fc2 commit 29386a1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tests/Unit/HtmlFilter/HtmlTagRemoverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@ class HtmlTagRemoverTest extends TestCase
public function throwExceptionOnNoParentNode(): void
{
$doc = new DOMDocument();
$doc->loadHTML('<div></div>', 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]
Expand Down

0 comments on commit 29386a1

Please sign in to comment.