ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilHtmlPurifierLibWrapperTest Class Reference
+ Inheritance diagram for ilHtmlPurifierLibWrapperTest:
+ Collaboration diagram for ilHtmlPurifierLibWrapperTest:

Public Member Functions

 testPurifierIsCalledIfStringsArePurified ()
 
 testExceptionIsRaisedIfNonStringElementsArePassedForHtmlBatchProcessing ($element)
 

Static Public Member Functions

static invalidHtmlDataTypeProvider ()
 

Private Member Functions

 getPurifier ()
 

Private Attributes

const array TO_PURIFY
 

Detailed Description

Definition at line 24 of file ilHtmlPurifierLibWrapperTest.php.

Member Function Documentation

◆ getPurifier()

ilHtmlPurifierLibWrapperTest::getPurifier ( )
private

Definition at line 32 of file ilHtmlPurifierLibWrapperTest.php.

33 {
34 return new class () extends ilHtmlPurifierAbstractLibWrapper {
35 protected function getPurifierConfigInstance(): HTMLPurifier_Config
36 {
37 return HTMLPurifier_Config::createDefault();
38 }
39 };
40 }
Abstract class wrapping the HTMLPurifier instance.

Referenced by testExceptionIsRaisedIfNonStringElementsArePassedForHtmlBatchProcessing(), and testPurifierIsCalledIfStringsArePurified().

+ Here is the caller graph for this function:

◆ invalidHtmlDataTypeProvider()

static ilHtmlPurifierLibWrapperTest::invalidHtmlDataTypeProvider ( )
static
Returns
array{integer: int[], float: float[], null: null[], array: never[][], object: \stdClass[], bool: false[], resource: resource[]|false[]}

Definition at line 53 of file ilHtmlPurifierLibWrapperTest.php.

53 : array
54 {
55 return [
56 'integer' => [5],
57 'float' => [0.1],
58 'null' => [null],
59 'array' => [[]],
60 'object' => [new stdClass()],
61 'bool' => [false],
62 'resource' => [fopen('php://memory', 'rb')],
63 ];
64 }

◆ testExceptionIsRaisedIfNonStringElementsArePassedForHtmlBatchProcessing()

ilHtmlPurifierLibWrapperTest::testExceptionIsRaisedIfNonStringElementsArePassedForHtmlBatchProcessing (   $element)

Definition at line 67 of file ilHtmlPurifierLibWrapperTest.php.

67 : void
68 {
69 $this->expectException(InvalidArgumentException::class);
70
71 $purifier = $this->getPurifier();
72 $purifier->purifyArray([$element]);
73 }

References getPurifier().

+ Here is the call graph for this function:

◆ testPurifierIsCalledIfStringsArePurified()

ilHtmlPurifierLibWrapperTest::testPurifierIsCalledIfStringsArePurified ( )

Definition at line 42 of file ilHtmlPurifierLibWrapperTest.php.

42 : void
43 {
44 $purifier = $this->getPurifier();
45
46 $this->assertSame('phpunit', $purifier->purify('phpunit'));
47 $this->assertSame(self::TO_PURIFY, $purifier->purifyArray(self::TO_PURIFY));
48 }

References getPurifier().

+ Here is the call graph for this function:

Field Documentation

◆ TO_PURIFY

const array ilHtmlPurifierLibWrapperTest::TO_PURIFY
private
Initial value:
= [
'phpunit1',
'phpunit2',
'phpunit3',
]

Definition at line 26 of file ilHtmlPurifierLibWrapperTest.php.


The documentation for this class was generated from the following file: