ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTermsOfServiceTrimmedDocumentPurifierTest Class Reference

Class ilTermsOfServiceTrimmedDocumentPurifierTest. More...

+ Inheritance diagram for ilTermsOfServiceTrimmedDocumentPurifierTest:
+ Collaboration diagram for ilTermsOfServiceTrimmedDocumentPurifierTest:

Public Member Functions

 stringsToTrimProvider ()
 
 stringElementsArrayToTrimProvider ()
 
 testSingleStringIsTrimmed (string $text, string $expectedResult)
 stringsToTrimProvider More...
 
 testArrayOfStringElementsIsTrimmed (array $texts, array $expectedResult)
 stringElementsArrayToTrimProvider More...
 

Additional Inherited Members

- Protected Member Functions inherited from ilTermsOfServiceCriterionBaseTest
 getRbacReviewMock ()
 
 getObjectDataCacheMock ()
 
 getRadioGroupMock ()
 
 getFormMock ()
 
 getUserMock ()
 
- Protected Member Functions inherited from ilTermsOfServiceBaseTest
 setUp ()
 
 getLanguageMock ()
 
 getUiFactoryMock ()
 
 setGlobalVariable (string $name, $value)
 
 getCriterionConfig ($value=null)
 
- Protected Attributes inherited from ilTermsOfServiceBaseTest
 $dic
 

Detailed Description

Member Function Documentation

◆ stringElementsArrayToTrimProvider()

ilTermsOfServiceTrimmedDocumentPurifierTest::stringElementsArrayToTrimProvider ( )
Returns
array[]

Definition at line 24 of file ilTermsOfServiceTrimmedDocumentPurifierTest.php.

24  : array
25  {
26  return [
27  'Text with or without Spaces' => [[' phpunit '], ['phpunit'],],
28  'Text with or without Line Endings and Tabs' => [["\n\r\tphpunit\n\r\t"], ['phpunit'],],
29  ];
30  }

◆ stringsToTrimProvider()

ilTermsOfServiceTrimmedDocumentPurifierTest::stringsToTrimProvider ( )
Returns
array[]

Definition at line 13 of file ilTermsOfServiceTrimmedDocumentPurifierTest.php.

13  : array
14  {
15  return [
16  'Text with or without Spaces' => [' phpunit ', 'phpunit',],
17  'Text with or without Line Endings and Tabs' => ["\n\r\tphpunit\n\r\t", 'phpunit',],
18  ];
19  }

◆ testArrayOfStringElementsIsTrimmed()

ilTermsOfServiceTrimmedDocumentPurifierTest::testArrayOfStringElementsIsTrimmed ( array  $texts,
array  $expectedResult 
)

stringElementsArrayToTrimProvider

Parameters
string[]$texts
string[]$expectedResult
Exceptions
ReflectionException

Definition at line 61 of file ilTermsOfServiceTrimmedDocumentPurifierTest.php.

61  : void
62  {
63  $aggregated = $this
64  ->getMockBuilder(ilHtmlPurifierInterface::class)
65  ->getMock();
66 
67  $aggregated
68  ->expects($this->exactly(count($texts)))
69  ->method('purify')
70  ->with($this->isType('string'))
71  ->willReturnArgument(0);
72 
73  $purifier = new ilTermsOfServiceTrimmedDocumentPurifier($aggregated);
74 
75  $this->assertEquals($expectedResult, $purifier->purifyArray($texts));
76  }

◆ testSingleStringIsTrimmed()

ilTermsOfServiceTrimmedDocumentPurifierTest::testSingleStringIsTrimmed ( string  $text,
string  $expectedResult 
)

stringsToTrimProvider

Parameters
string$text
string$expectedResult
Exceptions
ReflectionException

Definition at line 38 of file ilTermsOfServiceTrimmedDocumentPurifierTest.php.

38  : void
39  {
40  $aggregated = $this
41  ->getMockBuilder(ilHtmlPurifierInterface::class)
42  ->getMock();
43 
44  $aggregated
45  ->expects($this->once())
46  ->method('purify')
47  ->with($text)
48  ->willReturn($text);
49 
50  $purifier = new ilTermsOfServiceTrimmedDocumentPurifier($aggregated);
51 
52  $this->assertEquals($expectedResult, $purifier->purify($text));
53  }

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