ILIAS  release_8 Revision v8.23
ilHtmlPurifierLibWrapperTest Class Reference

Class ilHtmlPurifierLibWrapperTest. More...

+ Inheritance diagram for ilHtmlPurifierLibWrapperTest:
+ Collaboration diagram for ilHtmlPurifierLibWrapperTest:

Public Member Functions

 testPurifierIsCalledIfStringsArePurified ()
 
 invalidHtmlDataTypeProvider ()
 
 testExceptionIsRaisedIfNonStringElementsArePassedForHtmlBatchProcessing ($element)
 invalidHtmlDataTypeProvider More...
 

Private Member Functions

 getPurifier ()
 

Detailed Description

Member Function Documentation

◆ getPurifier()

ilHtmlPurifierLibWrapperTest::getPurifier ( )
private

Definition at line 29 of file ilHtmlPurifierLibWrapperTest.php.

Referenced by testExceptionIsRaisedIfNonStringElementsArePassedForHtmlBatchProcessing(), and testPurifierIsCalledIfStringsArePurified().

30  {
31  return new class () extends ilHtmlPurifierAbstractLibWrapper {
32  protected function getPurifierConfigInstance(): HTMLPurifier_Config
33  {
34  return HTMLPurifier_Config::createDefault();
35  }
36  };
37  }
Abstract class wrapping the HTMLPurifier instance.
+ Here is the caller graph for this function:

◆ invalidHtmlDataTypeProvider()

ilHtmlPurifierLibWrapperTest::invalidHtmlDataTypeProvider ( )

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)

invalidHtmlDataTypeProvider

Definition at line 69 of file ilHtmlPurifierLibWrapperTest.php.

References getPurifier().

69  : void
70  {
71  $this->expectException(InvalidArgumentException::class);
72 
73  $purifier = $this->getPurifier();
74  $purifier->purifyArray([$element]);
75  }
+ Here is the call graph for this function:

◆ testPurifierIsCalledIfStringsArePurified()

ilHtmlPurifierLibWrapperTest::testPurifierIsCalledIfStringsArePurified ( )

Definition at line 39 of file ilHtmlPurifierLibWrapperTest.php.

References getPurifier().

39  : void
40  {
41  $purifier = $this->getPurifier();
42 
43  $this->assertSame('phpunit', $purifier->purify('phpunit'));
44 
45  $toPurify = [
46  'phpunit1',
47  'phpunit2',
48  'phpunit3',
49  ];
50  $this->assertSame($toPurify, $purifier->purifyArray($toPurify));
51  }
+ Here is the call graph for this function:

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