diff --git a/tests/Toolkit/DomTest.php b/tests/Toolkit/DomTest.php index fbc2ebee2f..7a66b64539 100644 --- a/tests/Toolkit/DomTest.php +++ b/tests/Toolkit/DomTest.php @@ -9,6 +9,7 @@ use DOMElement; use Kirby\Cms\App; use Kirby\Exception\InvalidArgumentException; +use PHPUnit\Framework\AssertionFailedError; /** * @coversDefaultClass \Kirby\Toolkit\Dom @@ -1665,7 +1666,9 @@ public static function sanitizeProvider(): array '', [ 'attrCallback' => function (DOMAttr $attr, array $options): array { - // $this->assertInstanceOf(Closure::class, $options['attrCallback']); + if (is_a($options['attrCallback'], Closure::class) !== true) { + throw new AssertionFailedError('Options provided to callback are not complete or invalid'); + } if ($attr->nodeName === 'b') { $attr->ownerElement->removeAttributeNode($attr); @@ -1733,7 +1736,9 @@ public static function sanitizeProvider(): array '', [ 'doctypeCallback' => function (DOMDocumentType $doctype, array $options): void { - // $this->assertInstanceOf(Closure::class, $options['doctypeCallback']); + if (is_a($options['doctypeCallback'], Closure::class) !== true) { + throw new AssertionFailedError('Options provided to callback are not complete or invalid'); + } throw new InvalidArgumentException('The "' . $doctype->name . '" doctype is not allowed'); } @@ -1759,7 +1764,9 @@ public static function sanitizeProvider(): array 'AB', [ 'elementCallback' => function (DOMElement $element, array $options): array { - // $this->assertInstanceOf(Closure::class, $options['elementCallback']); + if (is_a($options['elementCallback'], Closure::class) !== true) { + throw new AssertionFailedError('Options provided to callback are not complete or invalid'); + } if ($element->nodeName === 'b') { Dom::remove($element);