ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ValidHTMLTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
25 
26 class ValidHTMLTest extends TestCase
27 {
28  public function testConstruct(): void
29  {
30  $this->assertInstanceOf(ValidHTML::class, new ValidHTML());
31  }
32 
38  public function testIsTrue(string $text, bool $result): void
39  {
40  $instance = new ValidHTML();
41  $this->assertSame($result, $instance->isTrue($text));
42  }
43 
44  public static function textProvider(): array
45  {
46  return [
47  'Plain Text' => ['phpunit', false],
48  'HTML Fragment' => ['php<b>unit</b>', true],
49  'HTML Fragment with Email Address Wrapped in <>' => ['php<b>unit</b> <info@ilias.de>', false],
50  'HTML' => ['<html><body>php<b>unit</b></body></html>', true],
51  'HTML with Email Address Wrapped in <>' => ['<html><body>php<b>unit</b>Php Unit <info@ilias.de></body></html>', false],
52  'HTML with Unsupported Entities' => ['<html><body>php<b>unit</b>Php Unit<figure></figure></body></html>', true],
53  'Invalid HTML' => ['<html><body>php<b>unit</b>Php Unit<div </body></html>', false],
54  ];
55  }
56 }
$text
Definition: xapiexit.php:21
testIsTrue(string $text, bool $result)
textProvider