ILIAS  release_8 Revision v8.24
ilTermsOfServiceDocumentsContainsHtmlValidatorTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25class ilTermsOfServiceDocumentsContainsHtmlValidatorTest extends \PHPUnit\Framework\TestCase
26{
27 public function textProvider(): array
28 {
29 return [
30 'Plain Text' => ['phpunit', false,],
31 'HTML Fragment' => ['php<b>unit</b>', true,],
32 'HTML Fragment with Email Address Wrapped in <>' => ['php<b>unit</b> <info@ilias.de>', false,],
33 'HTML' => ['<html><body>php<b>unit</b></body></html>', true,],
34 'HTML with Email Address Wrapped in <>' => ['<html><body>php<b>unit</b>Php Unit <info@ilias.de></body></html>', false,],
35 'HTML with Unsupported Entities' => ['<html><body>php<b>unit</b>Php Unit<figure></figure></body></html>', true,],
36 'Invalid HTML' => ['<html><body>php<b>unit</b>Php Unit<div </body></html>', false,],
37 ];
38 }
39
45 public function testHtmlCanBeDetected(string $text, bool $result): void
46 {
48 $this->assertSame($result, $validator->isValid());
49 }
50}
testHtmlCanBeDetected(string $text, bool $result)
@dataProvider textProvider