ILIAS
trunk Revision v11.0_alpha-2638-g80c1d007f79
◀ ilDoc Overview
ValidHTMLTest.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\LegalDocuments\test
;
22
23
use
PHPUnit\Framework\TestCase
;
24
use
ILIAS\LegalDocuments\ValidHTML
;
25
use
PHPUnit\Framework\Attributes\DataProvider
;
26
27
class
ValidHTMLTest
extends
TestCase
28
{
29
public
function
testConstruct
(): void
30
{
31
$this->assertInstanceOf(ValidHTML::class,
new
ValidHTML
());
32
}
33
34
#[DataProvider('textProvider')]
35
public
function
testIsTrue
(
string
$text,
bool
$result): void
36
{
37
$instance =
new
ValidHTML
();
38
$this->assertSame($result, $instance->isTrue($text));
39
}
40
41
public
static
function
textProvider
(): array
42
{
43
return
[
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
],
51
];
52
}
53
}
ILIAS\LegalDocuments\ValidHTML
Definition:
ValidHTML.php:31
ILIAS\LegalDocuments\test\ValidHTMLTest\textProvider
static textProvider()
Definition:
ValidHTMLTest.php:41
ILIAS\LegalDocuments\test\ValidHTMLTest
Definition:
ValidHTMLTest.php:27
DataProvider
ILIAS\LegalDocuments\test
Definition:
AdministrationEditLinksTest.php:21
ValidHTML
ILIAS\LegalDocuments\test\ValidHTMLTest\testIsTrue
testIsTrue(string $text, bool $result)
Definition:
ValidHTMLTest.php:35
TestCase
ILIAS\LegalDocuments\test\ValidHTMLTest\testConstruct
testConstruct()
Definition:
ValidHTMLTest.php:29
components
ILIAS
LegalDocuments
tests
ValidHTMLTest.php
Generated on Sun Aug 31 2025 23:03:16 for ILIAS by
1.8.13 (using
Doxyfile
)