19declare(strict_types=1);
23use PHPUnit\Framework\TestCase;
25use PHPUnit\Framework\Attributes\DataProvider;
31 $this->assertInstanceOf(ValidHTML::class,
new ValidHTML());
34 #[DataProvider('textProvider')]
35 public function testIsTrue(
string $text,
bool $result): void
38 $this->assertSame($result, $instance->isTrue($text));
44 'Plain Text' => [
'phpunit',
false],
45 'HTML Fragment' => [
'php<b>unit</b>',
true],
46 'HTML Fragment with Email Address Wrapped in <>' => [
'php<b>unit</b> <info@ilias.de>',
false],
47 'HTML' => [
'<html><body>php<b>unit</b></body></html>',
true],
48 'HTML with Email Address Wrapped in <>' => [
'<html><body>php<b>unit</b>Php Unit <info@ilias.de></body></html>',
false],
49 'HTML with Unsupported Entities' => [
'<html><body>php<b>unit</b>Php Unit<figure></figure></body></html>',
true],
50 'Invalid HTML' => [
'<html><body>php<b>unit</b>Php Unit<div </body></html>',
false],
testIsTrue(string $text, bool $result)