ILIAS  release_8 Revision v8.23
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
Container $dic
 

Detailed Description

Member Function Documentation

◆ stringElementsArrayToTrimProvider()

ilTermsOfServiceTrimmedDocumentPurifierTest::stringElementsArrayToTrimProvider ( )

Definition at line 35 of file ilTermsOfServiceTrimmedDocumentPurifierTest.php.

35  : array
36  {
37  return [
38  'Text with or without Spaces' => [[' phpunit '], ['phpunit'],],
39  'Text with or without Line Endings and Tabs' => [["\n\r\tphpunit\n\r\t"], ['phpunit'],],
40  ];
41  }

◆ stringsToTrimProvider()

ilTermsOfServiceTrimmedDocumentPurifierTest::stringsToTrimProvider ( )

Definition at line 27 of file ilTermsOfServiceTrimmedDocumentPurifierTest.php.

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

◆ testArrayOfStringElementsIsTrimmed()

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

stringElementsArrayToTrimProvider

Parameters
string[]$texts
string[]$expectedResult

Definition at line 70 of file ilTermsOfServiceTrimmedDocumentPurifierTest.php.

70  : void
71  {
72  $aggregated = $this
73  ->getMockBuilder(ilHtmlPurifierInterface::class)
74  ->getMock();
75 
76  $aggregated
77  ->expects($this->exactly(count($texts)))
78  ->method('purify')
79  ->with($this->isType('string'))
80  ->willReturnArgument(0);
81 
82  $purifier = new ilTermsOfServiceTrimmedDocumentPurifier($aggregated);
83 
84  $this->assertSame($expectedResult, $purifier->purifyArray($texts));
85  }

◆ testSingleStringIsTrimmed()

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

stringsToTrimProvider

Parameters
string$text
string$expectedResult

Definition at line 48 of file ilTermsOfServiceTrimmedDocumentPurifierTest.php.

48  : void
49  {
50  $aggregated = $this
51  ->getMockBuilder(ilHtmlPurifierInterface::class)
52  ->getMock();
53 
54  $aggregated
55  ->expects($this->once())
56  ->method('purify')
57  ->with($text)
58  ->willReturn($text);
59 
60  $purifier = new ilTermsOfServiceTrimmedDocumentPurifier($aggregated);
61 
62  $this->assertSame($expectedResult, $purifier->purify($text));
63  }

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